Skip to content

Commit

Permalink
feat: Updated packages/hub/src/app/models/[owner]/
Browse files Browse the repository at this point in the history
  • Loading branch information
sweep-ai[bot] authored Oct 27, 2023
1 parent 51964bd commit 51c135b
Showing 1 changed file with 36 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import { SquiggleSnippetDraftDialog_Model$key } from "@/__generated__/SquiggleSn
import { SquiggleSnippetFormShape } from "./EditSquiggleSnippetModel";
import { useClientOnlyRender } from "@/hooks/useClientOnlyRender";

const { navigator } = window;

export type Draft = {
formState: SquiggleSnippetFormShape;
version: string;
Expand Down Expand Up @@ -133,7 +135,41 @@ export const SquiggleSnippetDraftDialog: FC<Props> = ({
</div>
</TextTooltip>
</div>
</Modal.Footer> <Modal.Footer>
<div className="flex items-center justify-end gap-2">
<TextTooltip text="Draft will be ignored but you'll see this prompt again on next load.">
<div>
<Button onClick={skip}>Ignore</Button>
</div>
</TextTooltip>
<TextTooltip text="Draft will be discarded.">
<div>
<Button onClick={discard}>Discard</Button>
</div>
</TextTooltip>
<TextTooltip text="Code and version will be replaced by draft version. You'll still need to save it manually.">
<div>
<Button theme="primary" onClick={_restore}>
Restore
</Button>
</div>
</TextTooltip>
</div>
</Modal.Footer>
<TextTooltip text="Draft will be copied to clipboard.">
<div>
<Button onClick={() => {
const draft = draftUtils.load(draftLocator);
if (draft) {
try {
navigator.clipboard.writeText(JSON.stringify(draft));
} catch (error) {
alert('Failed to copy draft to clipboard. Please try again.');
}
}
}}>Copy to Clipboard</Button>
</div>
</TextTooltip>
</Modal>
);
};

0 comments on commit 51c135b

Please sign in to comment.