From 15cfc9e1f5f9b41af526ed92ddce63fd2215ed8c Mon Sep 17 00:00:00 2001 From: Steven Date: Tue, 20 Sep 2022 22:55:24 +0800 Subject: [PATCH] chore: add memo detail page --- web/src/components/MemoCardDialog.tsx | 10 ++- web/src/helpers/api.ts | 4 ++ web/src/pages/Explore.tsx | 14 +---- web/src/pages/MemoDetail.tsx | 91 +++++++++++++++++++++++++++ web/src/router/index.tsx | 12 ++++ web/src/services/memoService.ts | 7 +++ 6 files changed, 119 insertions(+), 19 deletions(-) create mode 100644 web/src/pages/MemoDetail.tsx diff --git a/web/src/components/MemoCardDialog.tsx b/web/src/components/MemoCardDialog.tsx index 28113cab..8800b8c3 100644 --- a/web/src/components/MemoCardDialog.tsx +++ b/web/src/components/MemoCardDialog.tsx @@ -1,4 +1,3 @@ -import copy from "copy-to-clipboard"; import { useState, useEffect, useCallback } from "react"; import { useTranslation } from "react-i18next"; import { editorStateService, memoService, userService } from "../services"; @@ -116,14 +115,13 @@ const MemoCardDialog: React.FC = (props: Props) => { setMemo(memo); }, []); - const handleCopyMemoLinkBtnClick = () => { + const handleGotoMemoLinkBtnClick = () => { if (memo.visibility === "PRIVATE") { toastHelper.error(t("message.private-only")); return; } - copy(`${window.location.origin}/explore?memoId=${memo.id}`); - toastHelper.success(t("message.copied")); + window.open(`/m/${memo.id}`); }; const handleEditMemoBtnClick = () => { @@ -169,8 +167,8 @@ const MemoCardDialog: React.FC = (props: Props) => {
<> -