mirror of
https://github.com/drawdb-io/drawdb.git
synced 2025-08-29 02:25:26 +00:00
clean up sharing
This commit is contained in:
@@ -66,6 +66,7 @@ export default function Share({ title, setModal }) {
|
||||
|
||||
useEffect(() => {
|
||||
const updateOrGenerateLink = async () => {
|
||||
setLoading(true);
|
||||
try {
|
||||
setLoading(true);
|
||||
if (!gistId || gistId === "") {
|
||||
|
@@ -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 (
|
||||
<div className="text-blue-500 text-center">
|
||||
<Spin size="middle" />
|
||||
<div>{t("loading")}</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="sidesheet-theme">Revisions</div>
|
||||
)
|
||||
<div className="mx-5">
|
||||
<Button icon={<IconPlus />} block onClick={() => {}}>
|
||||
{t("record_version")}
|
||||
</Button>
|
||||
{!gistId && <div className="my-3">{t("no_saved_revisions")}</div>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
@@ -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([]);
|
||||
|
@@ -259,6 +259,7 @@ const en = {
|
||||
label: "Label",
|
||||
many_side_label: "Many(n) side label",
|
||||
revisions: "Revisions",
|
||||
no_saved_revisions: "No saved revisions",
|
||||
},
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user