mirror of
https://github.com/usememos/memos.git
synced 2025-01-01 10:01:54 +08:00
chore: update share memo buttons (#1498)
This commit is contained in:
parent
91a24ef9ce
commit
df30304d00
4 changed files with 32 additions and 38 deletions
|
@ -1,4 +1,3 @@
|
|||
import copy from "copy-to-clipboard";
|
||||
import dayjs from "dayjs";
|
||||
import { memo, useEffect, useRef, useState } from "react";
|
||||
import { toast } from "react-hot-toast";
|
||||
|
@ -12,7 +11,6 @@ import MemoContent from "./MemoContent";
|
|||
import MemoResources from "./MemoResources";
|
||||
import showShareMemo from "./ShareMemoDialog";
|
||||
import showPreviewImageDialog from "./PreviewImageDialog";
|
||||
import showEmbedMemoDialog from "./EmbedMemoDialog";
|
||||
import showChangeMemoCreatedTsDialog from "./ChangeMemoCreatedTsDialog";
|
||||
import "@/less/memo.less";
|
||||
|
||||
|
@ -58,15 +56,6 @@ const Memo: React.FC<Props> = (props: Props) => {
|
|||
navigate(`/m/${memo.id}`);
|
||||
};
|
||||
|
||||
const handleShowEmbedMemoDialog = () => {
|
||||
showEmbedMemoDialog(memo.id);
|
||||
};
|
||||
|
||||
const handleCopyLink = () => {
|
||||
copy(`${window.location.origin}/m/${memo.id}`);
|
||||
toast.success(t("message.succeed-copy-link"));
|
||||
};
|
||||
|
||||
const handleTogglePinMemoBtnClick = async () => {
|
||||
try {
|
||||
if (memo.pinned) {
|
||||
|
@ -253,15 +242,9 @@ const Memo: React.FC<Props> = (props: Props) => {
|
|||
/>
|
||||
</Tooltip>
|
||||
</div>
|
||||
<span className="btn" onClick={handleCopyLink}>
|
||||
{t("memo.copy-link")}
|
||||
</span>
|
||||
<span className="btn" onClick={handleViewMemoDetailPage}>
|
||||
{t("memo.view-detail")}
|
||||
</span>
|
||||
<span className="btn" onClick={handleShowEmbedMemoDialog}>
|
||||
{t("memo.embed")}
|
||||
</span>
|
||||
<span className="btn text-orange-500" onClick={handleArchiveMemoClick}>
|
||||
{t("common.archive")}
|
||||
</span>
|
||||
|
|
|
@ -15,6 +15,7 @@ import Icon from "./Icon";
|
|||
import { generateDialog } from "./Dialog";
|
||||
import MemoContent from "./MemoContent";
|
||||
import MemoResources from "./MemoResources";
|
||||
import showEmbedMemoDialog from "./EmbedMemoDialog";
|
||||
import "@/less/share-memo-dialog.less";
|
||||
|
||||
interface Props extends DialogProps {
|
||||
|
@ -96,6 +97,10 @@ const ShareMemoDialog: React.FC<Props> = (props: Props) => {
|
|||
});
|
||||
};
|
||||
|
||||
const handleShowEmbedMemoDialog = () => {
|
||||
showEmbedMemoDialog(memo.id);
|
||||
};
|
||||
|
||||
const handleCopyLinkBtnClick = () => {
|
||||
copy(`${window.location.origin}/m/${memo.id}`);
|
||||
toast.success(t("message.succeed-copy-link"));
|
||||
|
@ -121,14 +126,15 @@ const ShareMemoDialog: React.FC<Props> = (props: Props) => {
|
|||
|
||||
return (
|
||||
<>
|
||||
<div className="dialog-header-container py-3 px-4 pl-6 !mb-0 rounded-t-lg">
|
||||
<div className="dialog-header-container py-3 px-4 !mb-0 rounded-t-lg">
|
||||
<p className="">{t("common.share")} Memo</p>
|
||||
<button className="btn close-btn" onClick={handleCloseBtnClick}>
|
||||
<Icon.X className="icon-img" />
|
||||
</button>
|
||||
</div>
|
||||
<div className="dialog-content-container w-full flex flex-col justify-start items-start relative">
|
||||
<div className="px-4 pb-3 border-b w-full flex flex-row justify-between items-center">
|
||||
<div className="px-4 pb-3 w-full flex flex-row justify-start items-center">
|
||||
<span className="text-sm mr-2">{t("common.visibility")}:</span>
|
||||
<Select
|
||||
className="!min-w-[10rem] w-auto text-sm"
|
||||
value={state.memoVisibility}
|
||||
|
@ -144,24 +150,28 @@ const ShareMemoDialog: React.FC<Props> = (props: Props) => {
|
|||
</Option>
|
||||
))}
|
||||
</Select>
|
||||
<div className="flex flex-row justify-end items-center">
|
||||
<button disabled={createLoadingState.isLoading} className="btn-normal h-8 mr-2" onClick={handleDownloadBtnClick}>
|
||||
{createLoadingState.isLoading ? (
|
||||
<Icon.Loader className="w-4 h-auto sm:mr-1 animate-spin" />
|
||||
) : (
|
||||
<Icon.Download className="w-4 h-auto sm:mr-1" />
|
||||
)}
|
||||
<span className="hidden sm:block">{t("common.image")}</span>
|
||||
</button>
|
||||
<button className="btn-normal h-8" onClick={handleCopyLinkBtnClick}>
|
||||
<Icon.Link className="w-4 h-auto sm:mr-1" />
|
||||
<span className="hidden sm:block">{t("common.link")}</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div className="w-full rounded-lg overflow-clip">
|
||||
<div className="px-4 pb-3 w-full flex flex-row justify-start items-center space-x-2">
|
||||
<button disabled={createLoadingState.isLoading} className="btn-normal h-8" onClick={handleDownloadBtnClick}>
|
||||
{createLoadingState.isLoading ? (
|
||||
<Icon.Loader className="w-4 h-auto mr-1 animate-spin" />
|
||||
) : (
|
||||
<Icon.Download className="w-4 h-auto mr-1" />
|
||||
)}
|
||||
{t("common.image")}
|
||||
</button>
|
||||
<button className="btn-normal h-8" onClick={handleShowEmbedMemoDialog}>
|
||||
<Icon.Code className="w-4 h-auto mr-1" />
|
||||
{t("memo.embed")}
|
||||
</button>
|
||||
<button className="btn-normal h-8" onClick={handleCopyLinkBtnClick}>
|
||||
<Icon.Link className="w-4 h-auto mr-1" />
|
||||
{t("common.link")}
|
||||
</button>
|
||||
</div>
|
||||
<div className="w-full rounded-lg border-t overflow-clip">
|
||||
<div
|
||||
className="w-96 max-w-full h-auto select-none relative flex flex-col justify-start items-start bg-white dark:bg-zinc-800"
|
||||
className="w-full h-auto select-none relative flex flex-col justify-start items-start bg-white dark:bg-zinc-800"
|
||||
ref={memoElRef}
|
||||
>
|
||||
<span className="w-full px-6 pt-5 pb-2 text-sm text-gray-500">{memo.createdAtStr}</span>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
.share-memo-dialog {
|
||||
> .dialog-container {
|
||||
@apply w-96 max-w-full p-0 bg-white dark:bg-zinc-800;
|
||||
@apply w-112 max-w-full p-0 bg-white dark:bg-zinc-800;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,7 +51,8 @@
|
|||
"preview": "Preview",
|
||||
"rename": "Rename",
|
||||
"clear": "Clear",
|
||||
"name": "Name"
|
||||
"name": "Name",
|
||||
"visibility": "Visibility"
|
||||
},
|
||||
"router": {
|
||||
"back-to-home": "Back to Home"
|
||||
|
@ -76,7 +77,7 @@
|
|||
"memo": {
|
||||
"view-detail": "View Detail",
|
||||
"copy-link": "Copy Link",
|
||||
"embed": "Embed memo",
|
||||
"embed": "Embed",
|
||||
"archived-memos": "Archived Memos",
|
||||
"no-archived-memos": "No archived memos.",
|
||||
"fetching-data": "fetching data...",
|
||||
|
|
Loading…
Reference in a new issue