diff --git a/package.json b/package.json index 0dd1aea..ba90bfd 100644 --- a/package.json +++ b/package.json @@ -43,6 +43,7 @@ "@smui/switch": "^7.0.0", "@smui/textfield": "^7.0.0", "@smui/tooltip": "^7.0.0", + "@smui/top-app-bar": "^7.0.0", "@sveltejs/vite-plugin-svelte": "^3.1.1", "@tsconfig/svelte": "^5.0.4", "date-fns": "^3.6.0", diff --git a/src/App.svelte b/src/App.svelte index ee39b4e..a1350b2 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -1,5 +1,6 @@ -
- - open = o} /> - -
- {#if isMobile() && !(pathname === "/login" || pathname === "/register")} - - {/if} -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
-
-
+ +
+ {#if $svelteLoc !== "/login" && $svelteLoc !== "/register"} +
+ + +
+ drawerOpen.update((open) => !open)}>{#if $drawerOpen}close{:else}menu{/if} + MeetPlan +
+
+ + +
+
+
+
+ {/if} + +
+ + +
+ {#if isMobile() && !($svelteLoc === "/login" || $svelteLoc === "/register")} + + {/if} +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+
diff --git a/src/Classes.svelte b/src/Classes.svelte index d4706d7..7cbe736 100644 --- a/src/Classes.svelte +++ b/src/Classes.svelte @@ -22,13 +22,13 @@ async function getClasses() { let response = await fetch(`${baseurl}/classes/get`, {credentials: "include"}); let r = await response.json(); - items = r["data"]; + items = r.data; } async function getTeachers() { let response = await fetch(`${baseurl}/teachers/get`, {credentials: "include"}); - let r = response.json(); - teachers = r["data"]; + let r = await response.json(); + teachers = r.data; } getClasses(); diff --git a/src/Drawer.svelte b/src/Drawer.svelte index a1672ce..6c10e13 100644 --- a/src/Drawer.svelte +++ b/src/Drawer.svelte @@ -22,6 +22,7 @@ import {useLocation} from "svelte-routing"; import Checkbox from "@smui/checkbox"; + import {drawerOpen, svelteLoc} from "./stores"; const location = useLocation(); @@ -32,19 +33,18 @@ let communicationUnread = {}; let unreadMessages; - let allPaths = {}; + let allPaths: Record = {}; let lastUrl = ""; - let showDrawer = false; let hasRequested = false; $: (async () => { - statusCallback(open); - if (!($location.pathname === "/login" || $location.pathname === "/register")) { - showDrawer = true; + const path = $location.pathname; - let path = $location.pathname; + console.log(path); + svelteLoc.set(path); + if (path !== "/login" && path !== "/register") { if (path === lastUrl) { return } @@ -77,7 +77,7 @@ communicationActive = pathSplit[2]; } } else { - console.log("resetting", $location.pathname) + console.log("resetting", path) meetingActive = undefined communicationActive = undefined } @@ -105,7 +105,7 @@ return } - showDrawer = false; + drawerOpen.set(false); hasRequested = false; // Set a fake timeout to get the highest timeout id @@ -160,8 +160,6 @@ let user = 0; const mobile = isMobile(); - export let open: boolean = !mobile; - export let statusCallback; async function fetchData() { if (hasRequested) { @@ -237,7 +235,8 @@

-

- - -
- +{#if $drawerOpen} + {/if} -

Pozdravljeni v MeetPlan sistemu

-Vaša dovoljenja: {localStorage.getItem("role")} +Vaša dovoljenja: {localStorage.getItem("role")}