From 43ffa36a8bce537d3dafdda7e8f1afa58a3efd04 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Sat, 15 May 2021 23:27:39 +0530 Subject: [PATCH] History --- src/global.d.ts | 7 ++++ src/lib/History/index.svelte | 62 ++++++++++++++++++++++++++++++++++++ src/lib/Tabs/index.svelte | 34 ++++++++++---------- src/lib/Util/history.ts | 3 ++ src/lib/Util/state.ts | 2 -- 5 files changed, 88 insertions(+), 20 deletions(-) create mode 100644 src/lib/History/index.svelte create mode 100644 src/lib/Util/history.ts diff --git a/src/global.d.ts b/src/global.d.ts index b6d747a6..49def610 100644 --- a/src/global.d.ts +++ b/src/global.d.ts @@ -23,3 +23,10 @@ interface State { updateDiagram: boolean; autoSync: boolean; } + +interface HistoryEntry { + state: State; + time: Date; + name: string; + auto: boolean; +} diff --git a/src/lib/History/index.svelte b/src/lib/History/index.svelte new file mode 100644 index 00000000..83c4f0b8 --- /dev/null +++ b/src/lib/History/index.svelte @@ -0,0 +1,62 @@ + + + +
+
+
+
+ +
+
+
    + {#each history as { state, time, name }} +
  • + {time} + +
  • + {/each} +
+ diff --git a/src/lib/Tabs/index.svelte b/src/lib/Tabs/index.svelte index 66db7aef..4b6e540f 100644 --- a/src/lib/Tabs/index.svelte +++ b/src/lib/Tabs/index.svelte @@ -10,21 +10,19 @@ }; -
- -
+ diff --git a/src/lib/Util/history.ts b/src/lib/Util/history.ts new file mode 100644 index 00000000..6820e198 --- /dev/null +++ b/src/lib/Util/history.ts @@ -0,0 +1,3 @@ +import { Writable, writable } from 'svelte/store'; + +export const historyStore: Writable = writable([]); diff --git a/src/lib/Util/state.ts b/src/lib/Util/state.ts index 0a357ea4..3187782d 100644 --- a/src/lib/Util/state.ts +++ b/src/lib/Util/state.ts @@ -50,8 +50,6 @@ export const updateConfig = (config: string, updateEditor: boolean): void => { export const initURLSubscription = (): void => { codeStore.subscribe((state: State) => { - console.log(state); - window.location.hash = encode(JSON.stringify(state), true); }); };