From: PhiTux Date: Fri, 18 Jul 2025 16:56:06 +0000 (+0200) Subject: changed frontend structure X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=66f94685dbaf8d32b518d338f7ff789f73a6ec66;p=DailyTxT.git changed frontend structure --- diff --git a/frontend/src/lib/DatepickerLogic.svelte b/frontend/src/lib/DatepickerLogic.svelte index 650aa20..9e2212f 100644 --- a/frontend/src/lib/DatepickerLogic.svelte +++ b/frontend/src/lib/DatepickerLogic.svelte @@ -2,6 +2,7 @@ import { API_URL } from '$lib/APIurl.js'; import { cal } from '$lib/calendarStore.js'; import axios from 'axios'; + import { currentUser } from '$lib/helpers.js'; $effect(() => { if ($cal.currentMonth || $cal.currentYear) { @@ -17,6 +18,11 @@ return; } + if (!$currentUser) { + console.log('User not logged in, skipping loadMarkedDays'); + return; + } + if (isLoadingMarkedDays) { return; } diff --git a/frontend/src/lib/helpers.js b/frontend/src/lib/helpers.js index bb8590b..086fa6d 100644 --- a/frontend/src/lib/helpers.js +++ b/frontend/src/lib/helpers.js @@ -26,5 +26,3 @@ export let alwaysShowSidenav = writable(true); // check if offcanvas/sidenav is open export let offcanvasIsOpen = writable(false); - -export let currentUser = writable("") \ No newline at end of file diff --git a/frontend/src/routes/(authed)/+layout.svelte b/frontend/src/routes/(authed)/+layout.svelte new file mode 100644 index 0000000..4644868 --- /dev/null +++ b/frontend/src/routes/(authed)/+layout.svelte @@ -0,0 +1,1318 @@ + + +
+ + + {#key page.data} +
+ {@render children()} +
+ {/key} +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + diff --git a/frontend/src/routes/read/+page.js b/frontend/src/routes/(authed)/read/+page.js similarity index 100% rename from frontend/src/routes/read/+page.js rename to frontend/src/routes/(authed)/read/+page.js diff --git a/frontend/src/routes/read/+page.svelte b/frontend/src/routes/(authed)/read/+page.svelte similarity index 98% rename from frontend/src/routes/read/+page.svelte rename to frontend/src/routes/(authed)/read/+page.svelte index ee97280..2ae3ca5 100644 --- a/frontend/src/routes/read/+page.svelte +++ b/frontend/src/routes/(authed)/read/+page.svelte @@ -69,10 +69,10 @@ $effect(() => { if ($selectedDate) { - $cal.currentYear = $selectedDate.getFullYear(); - $cal.currentMonth = $selectedDate.getMonth(); + $cal.currentYear = $selectedDate.year; + $cal.currentMonth = $selectedDate.month - 1; - let el = document.querySelector(`.log[data-log-day="${$selectedDate.getDate()}"]`); + let el = document.querySelector(`.log[data-log-day="${$selectedDate.day}"]`); if (el) { el.scrollIntoView({ behavior: 'smooth', block: 'start' }); } diff --git a/frontend/src/routes/write/+page.js b/frontend/src/routes/(authed)/write/+page.js similarity index 100% rename from frontend/src/routes/write/+page.js rename to frontend/src/routes/(authed)/write/+page.js diff --git a/frontend/src/routes/write/+page.svelte b/frontend/src/routes/(authed)/write/+page.svelte similarity index 99% rename from frontend/src/routes/write/+page.svelte rename to frontend/src/routes/(authed)/write/+page.svelte index 2ac0d6f..a3dcce0 100644 --- a/frontend/src/routes/write/+page.svelte +++ b/frontend/src/routes/(authed)/write/+page.svelte @@ -1,5 +1,5 @@
- -
- {#key page.data} + {#key routeToFromLoginKey}
{/key}
- - - - - - -
- - - - - - - - - - - - - - - - - - - -