fix: eslint errors and warnings (#8149)
This commit is contained in:
parent
83fdebf64d
commit
8307badae5
137 changed files with 97 additions and 216 deletions
|
|
@ -1,6 +1,5 @@
|
|||
"use client";
|
||||
|
||||
import type { FC } from "react";
|
||||
import { useCallback, useMemo } from "react";
|
||||
import { observer } from "mobx-react";
|
||||
import { Pencil, ExternalLink, Link, Trash2 } from "lucide-react";
|
||||
|
|
@ -30,8 +29,7 @@ export const ProjectLinkDetail = observer(function ProjectLinkDetail(props: TPro
|
|||
const { t } = useTranslation();
|
||||
// derived values
|
||||
const linkDetail = getLinkById(linkId);
|
||||
|
||||
if (!linkDetail) return null;
|
||||
const linkUrl = linkDetail?.url;
|
||||
|
||||
// handlers
|
||||
const handleEdit = useCallback(
|
||||
|
|
@ -43,18 +41,19 @@ export const ProjectLinkDetail = observer(function ProjectLinkDetail(props: TPro
|
|||
);
|
||||
|
||||
const handleCopyText = useCallback(() => {
|
||||
copyTextToClipboard(linkDetail.url).then(() => {
|
||||
if (!linkUrl) return;
|
||||
copyTextToClipboard(linkUrl).then(() => {
|
||||
setToast({
|
||||
type: TOAST_TYPE.SUCCESS,
|
||||
title: t("link_copied"),
|
||||
message: t("view_link_copied_to_clipboard"),
|
||||
});
|
||||
});
|
||||
}, [linkDetail.url, t]);
|
||||
}, [linkUrl, t]);
|
||||
|
||||
const handleOpenInNewTab = useCallback(() => {
|
||||
window.open(linkDetail.url, "_blank", "noopener,noreferrer");
|
||||
}, [linkDetail.url]);
|
||||
window.open(linkUrl, "_blank", "noopener,noreferrer");
|
||||
}, [linkUrl]);
|
||||
|
||||
const handleDelete = useCallback(() => {
|
||||
linkOperations.remove(linkId);
|
||||
|
|
@ -91,6 +90,8 @@ export const ProjectLinkDetail = observer(function ProjectLinkDetail(props: TPro
|
|||
[handleEdit, handleOpenInNewTab, handleCopyText, handleDelete, t]
|
||||
);
|
||||
|
||||
if (!linkDetail) return null;
|
||||
|
||||
return (
|
||||
<LinkItemBlock
|
||||
title={linkDetail.title || linkDetail.url}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue