diff --git a/src/routes/store.ts b/src/routes/store.ts index 82f79e22..4d15b968 100644 --- a/src/routes/store.ts +++ b/src/routes/store.ts @@ -1,4 +1,3 @@ -import { Assignment, type FileInfo } from '@/api/apiStore'; import { writable } from 'svelte/store'; export const themeVariant = writable(localStorage.getItem('themeVariant') || 'light'); @@ -6,7 +5,3 @@ export const themeVariant = writable(localStorage.getItem('themeVariant') || 'li themeVariant.subscribe((value) => { localStorage.setItem('themeVariant', value); }); - -export const currentFile = writable(null); - -currentFile.set(new Assignment({})); diff --git a/src/routes/workspace/FileViewer.svelte b/src/routes/workspace/FileViewer.svelte index d3702920..f5bd4c5a 100644 --- a/src/routes/workspace/FileViewer.svelte +++ b/src/routes/workspace/FileViewer.svelte @@ -5,12 +5,11 @@ import { getContext, setContext } from 'svelte'; import SideBarElem from './SideBarElem.svelte'; import randomName from '$lib/randomName'; - import { documentStore, type FileInfo } from '@/api/apiStore'; - import { currentFile } from '../store'; + import { DocumentInfo, currentFile, documentStore } from '@/api/apiStore'; const api = getContext('api') as ApiHandler; - export let files: FileInfo[] = $documentStore; + export let files: DocumentInfo[] = $documentStore; $: files = $documentStore; diff --git a/src/routes/workspace/editor/+page.svelte b/src/routes/workspace/editor/+page.svelte index bd92bf1f..e4f368e1 100644 --- a/src/routes/workspace/editor/+page.svelte +++ b/src/routes/workspace/editor/+page.svelte @@ -2,13 +2,13 @@ import Toolbar from './Toolbar/Toolbar.svelte'; import FileEditor from './FileEditor.svelte'; import Workspace from '../Workspace.svelte'; - import { currentFile } from '../../store'; import { getContext } from 'svelte'; import ApiHandler from '@/api'; import type { Readable } from 'svelte/store'; import type { AuthorizerState } from 'akademia-authorizer-svelte/types'; import type { Editor } from 'svelte-tiptap'; import { goto } from '$app/navigation'; + import { currentFile } from '@/api/apiStore'; let editor: Readable; const api = new ApiHandler(>getContext('authorizerContext')); diff --git a/src/routes/workspace/editor/Toolbar/MoreActions.svelte b/src/routes/workspace/editor/Toolbar/MoreActions.svelte index 2b28f896..815fdd2b 100644 --- a/src/routes/workspace/editor/Toolbar/MoreActions.svelte +++ b/src/routes/workspace/editor/Toolbar/MoreActions.svelte @@ -3,10 +3,9 @@ import * as Dialog from '$lib/components/ui/dialog'; import Button from '@/components/ui/button/button.svelte'; import { MoreHorizontal, Trash2, LogOut, Download, Printer } from 'lucide-svelte'; - import { currentFile } from '../../../store'; import { getContext } from 'svelte'; import type ApiHandler from '@/api'; - import { documentStore } from '@/api/apiStore'; + import { currentFile, documentStore } from '@/api/apiStore'; import { printUsingWindow } from '@/utils/printer'; let isDeleteOpen = false; diff --git a/src/routes/workspace/editor/Toolbar/ShareDocument.svelte b/src/routes/workspace/editor/Toolbar/ShareDocument.svelte index 302c57fe..8b8ad0b5 100644 --- a/src/routes/workspace/editor/Toolbar/ShareDocument.svelte +++ b/src/routes/workspace/editor/Toolbar/ShareDocument.svelte @@ -9,8 +9,7 @@ import { Separator } from '$lib/components/ui/separator'; import { getContext, onMount } from 'svelte'; import type ApiHandler from '@/api'; - import { currentFile } from '../../../store'; - import type { FileInfo } from '@/api/apiStore'; + import type { FileInfo, currentFile } from '@/api/apiStore'; const api = getContext('api') as ApiHandler; diff --git a/src/routes/workspace/home/+page.svelte b/src/routes/workspace/home/+page.svelte index 8099244e..83889af9 100644 --- a/src/routes/workspace/home/+page.svelte +++ b/src/routes/workspace/home/+page.svelte @@ -2,7 +2,7 @@ import ActiveFiles from './activeFiles/ActiveFiles.svelte'; import Workspace from './../Workspace.svelte'; import Calendar from './Calendar/Calendar.svelte'; - import { currentFile } from '../../store'; + import { currentFile } from '@/api/apiStore'; currentFile.set(null); diff --git a/src/routes/workspace/quickActions/SearchQ.svelte b/src/routes/workspace/quickActions/SearchQ.svelte index 1c153478..f65060a7 100644 --- a/src/routes/workspace/quickActions/SearchQ.svelte +++ b/src/routes/workspace/quickActions/SearchQ.svelte @@ -5,13 +5,12 @@ import { getContext, setContext, tick } from 'svelte'; import { expoOut, quadIn, quadInOut, quadOut, sineInOut, sineOut } from 'svelte/easing'; import * as Command from '$lib/components/ui/command'; - import { documentStore, type FileInfo } from '@/api/apiStore'; + import { currentFile, documentStore, type FileInfo } from '@/api/apiStore'; import { goto } from '$app/navigation'; import { BookPlus, File, FilePen, FilePlus2, NotebookPen, Plus } from 'lucide-svelte'; import { CalendarPlus } from 'lucide-svelte'; import type ApiHandler from '@/api'; import randomName from '@/randomName'; - import { currentFile } from '../../store'; let isSeaching = false; const api = getContext('api') as ApiHandler;