From ae3b632f537f5199f0c73be11830b3bdafacabe9 Mon Sep 17 00:00:00 2001 From: Steven Date: Fri, 18 Aug 2023 22:52:57 +0800 Subject: [PATCH] chore: remove analytics dialog --- web/src/components/AnalyticsDialog.tsx | 32 ------------------- .../components/ShortcutActionsDropdown.tsx | 12 ++++--- web/src/components/ShortcutCard.tsx | 10 ++---- web/src/pages/ShortcutDetail.tsx | 2 +- 4 files changed, 11 insertions(+), 45 deletions(-) delete mode 100644 web/src/components/AnalyticsDialog.tsx diff --git a/web/src/components/AnalyticsDialog.tsx b/web/src/components/AnalyticsDialog.tsx deleted file mode 100644 index 6a83367..0000000 --- a/web/src/components/AnalyticsDialog.tsx +++ /dev/null @@ -1,32 +0,0 @@ -import { Button, Modal, ModalDialog } from "@mui/joy"; -import { useTranslation } from "react-i18next"; -import AnalyticsView from "./AnalyticsView"; -import Icon from "./Icon"; - -interface Props { - shortcutId: ShortcutId; - onClose: () => void; -} - -const AnalyticsDialog: React.FC = (props: Props) => { - const { shortcutId, onClose } = props; - const { t } = useTranslation(); - - return ( - - -
- {t("analytics.self")} - -
-
- -
-
-
- ); -}; - -export default AnalyticsDialog; diff --git a/web/src/components/ShortcutActionsDropdown.tsx b/web/src/components/ShortcutActionsDropdown.tsx index 954a195..914369a 100644 --- a/web/src/components/ShortcutActionsDropdown.tsx +++ b/web/src/components/ShortcutActionsDropdown.tsx @@ -1,9 +1,9 @@ import { useState } from "react"; import { useTranslation } from "react-i18next"; +import { useNavigate } from "react-router-dom"; import { shortcutService } from "../services"; import useUserStore from "../stores/v1/user"; import { showCommonDialog } from "./Alert"; -import AnalyticsDialog from "./AnalyticsDialog"; import CreateShortcutDialog from "./CreateShortcutDialog"; import GenerateQRCodeDialog from "./GenerateQRCodeDialog"; import Icon from "./Icon"; @@ -16,10 +16,10 @@ interface Props { const ShortcutActionsDropdown = (props: Props) => { const { shortcut } = props; const { t } = useTranslation(); + const navigate = useNavigate(); const currentUser = useUserStore().getCurrentUser(); const [showEditDialog, setShowEditDialog] = useState(false); const [showQRCodeDialog, setShowQRCodeDialog] = useState(false); - const [showAnalyticsDialog, setShowAnalyticsDialog] = useState(false); const havePermission = currentUser.role === "ADMIN" || shortcut.creatorId === currentUser.id; const handleDeleteShortcutButtonClick = (shortcut: Shortcut) => { @@ -33,6 +33,10 @@ const ShortcutActionsDropdown = (props: Props) => { }); }; + const gotoAnalytics = () => { + navigate(`/shortcut/${shortcut.id}#analytics`); + }; + return ( <> { @@ -82,8 +86,6 @@ const ShortcutActionsDropdown = (props: Props) => { )} {showQRCodeDialog && setShowQRCodeDialog(false)} />} - - {showAnalyticsDialog && setShowAnalyticsDialog(false)} />} ); }; diff --git a/web/src/components/ShortcutCard.tsx b/web/src/components/ShortcutCard.tsx index 3c75ada..805c33a 100644 --- a/web/src/components/ShortcutCard.tsx +++ b/web/src/components/ShortcutCard.tsx @@ -8,7 +8,6 @@ import { Link } from "react-router-dom"; import { absolutifyLink } from "../helpers/utils"; import useFaviconStore from "../stores/v1/favicon"; import useViewStore from "../stores/v1/view"; -import AnalyticsDialog from "./AnalyticsDialog"; import Icon from "./Icon"; import ShortcutActionsDropdown from "./ShortcutActionsDropdown"; import VisibilityIcon from "./VisibilityIcon"; @@ -23,7 +22,6 @@ const ShortcutView = (props: Props) => { const viewStore = useViewStore(); const faviconStore = useFaviconStore(); const [favicon, setFavicon] = useState(undefined); - const [showAnalyticsDialog, setShowAnalyticsDialog] = useState(false); const shortcutLink = absolutifyLink(`/s/${shortcut.name}`); useEffect(() => { @@ -124,18 +122,16 @@ const ShortcutView = (props: Props) => { -
setShowAnalyticsDialog(true)} > {shortcut.view} visits -
+
- - {showAnalyticsDialog && setShowAnalyticsDialog(false)} />} ); }; diff --git a/web/src/pages/ShortcutDetail.tsx b/web/src/pages/ShortcutDetail.tsx index 1d56e6d..f7696d6 100644 --- a/web/src/pages/ShortcutDetail.tsx +++ b/web/src/pages/ShortcutDetail.tsx @@ -175,7 +175,7 @@ const ShortcutDetail = () => {
-

+

Analytics