diff --git a/src/components/EditorHeader/Modal/Share.jsx b/src/components/EditorHeader/Modal/Share.jsx index 87f843c..b72e296 100644 --- a/src/components/EditorHeader/Modal/Share.jsx +++ b/src/components/EditorHeader/Modal/Share.jsx @@ -66,6 +66,7 @@ export default function Share({ title, setModal }) { useEffect(() => { const updateOrGenerateLink = async () => { + setLoading(true); try { setLoading(true); if (!gistId || gistId === "") { diff --git a/src/components/EditorHeader/SideSheet/Revisions.jsx b/src/components/EditorHeader/SideSheet/Revisions.jsx index dfcb67d..9d23e21 100644 --- a/src/components/EditorHeader/SideSheet/Revisions.jsx +++ b/src/components/EditorHeader/SideSheet/Revisions.jsx @@ -1,5 +1,33 @@ +import { useContext, useEffect, useState } from "react"; +import { IdContext } from "../../Workspace"; +import { useTranslation } from "react-i18next"; +import { Button, Spin } from "@douyinfe/semi-ui"; +import { IconPlus } from "@douyinfe/semi-icons"; + export default function Revisions() { + const { gistId } = useContext(IdContext); + const { t } = useTranslation(); + const [isLoading, setIsLoading] = useState(true); + + useEffect(() => { + setIsLoading(false); + }, []); + + if (gistId && isLoading) { + return ( +
+ +
{t("loading")}
+
+ ); + } + return ( -
Revisions
- ) +
+ + {!gistId &&
{t("no_saved_revisions")}
} +
+ ); } diff --git a/src/components/Workspace.jsx b/src/components/Workspace.jsx index fd24554..1f3a220 100644 --- a/src/components/Workspace.jsx +++ b/src/components/Workspace.jsx @@ -287,8 +287,8 @@ export default function WorkSpace() { const loadFromGist = async (shareId) => { try { - const res = await get(shareId); - const diagramSrc = res.data.files["share.json"].content; + const gist = await get(shareId); + const diagramSrc = gist.files["share.json"].content; const d = JSON.parse(diagramSrc); setGistId(shareId); setUndoStack([]); diff --git a/src/i18n/locales/en.js b/src/i18n/locales/en.js index adaeb2e..b298f0e 100644 --- a/src/i18n/locales/en.js +++ b/src/i18n/locales/en.js @@ -259,6 +259,7 @@ const en = { label: "Label", many_side_label: "Many(n) side label", revisions: "Revisions", + no_saved_revisions: "No saved revisions", }, };