mirror of
https://github.com/drawdb-io/drawdb.git
synced 2025-09-01 10:25:13 +00:00
clean up sharing
This commit is contained in:
@@ -66,6 +66,7 @@ export default function Share({ title, setModal }) {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const updateOrGenerateLink = async () => {
|
const updateOrGenerateLink = async () => {
|
||||||
|
setLoading(true);
|
||||||
try {
|
try {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
if (!gistId || gistId === "") {
|
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() {
|
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 (
|
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) => {
|
const loadFromGist = async (shareId) => {
|
||||||
try {
|
try {
|
||||||
const res = await get(shareId);
|
const gist = await get(shareId);
|
||||||
const diagramSrc = res.data.files["share.json"].content;
|
const diagramSrc = gist.files["share.json"].content;
|
||||||
const d = JSON.parse(diagramSrc);
|
const d = JSON.parse(diagramSrc);
|
||||||
setGistId(shareId);
|
setGistId(shareId);
|
||||||
setUndoStack([]);
|
setUndoStack([]);
|
||||||
|
@@ -259,6 +259,7 @@ const en = {
|
|||||||
label: "Label",
|
label: "Label",
|
||||||
many_side_label: "Many(n) side label",
|
many_side_label: "Many(n) side label",
|
||||||
revisions: "Revisions",
|
revisions: "Revisions",
|
||||||
|
no_saved_revisions: "No saved revisions",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user