diff --git a/src/app.css b/src/app.css index c12fde8..ba7dbbd 100644 --- a/src/app.css +++ b/src/app.css @@ -189,7 +189,7 @@ input[type='search']:-webkit-autofill, input[type='text']:-webkit-autofill, inpu .content { width: 100%; - @apply px-6; + @apply px-2; } diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index b466694..5119951 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -3,6 +3,7 @@ import { onMount } from 'svelte'; import { updateUserState, userState } from '$lib/shared.svelte'; import { PERMISSIONS } from '$lib/consts'; + import { MediaQuery } from 'svelte/reactivity'; let currentTheme: string = $state(''); @@ -18,6 +19,15 @@ currentTheme = theme; } + function toggleMenu() { + var menu = document.getElementById('mobile-menu')!; + if (menu.style.display === 'block') { + menu.style.display = 'none'; + } else { + menu.style.display = 'block'; + } + } + onMount(() => { const savedTheme = document.documentElement.getAttribute('data-theme'); if (savedTheme) { @@ -31,11 +41,13 @@ updateUserState(); }); + const largeScreen = new MediaQuery('min-width: 640px'); + let { children } = $props(); @@ -50,57 +62,100 @@ src="/mdevtriangle.svg" width="24" /> -
Home
+ - {#if (userState.perms & PERMISSIONS.VIEW) > 0} - Postings - {/if} - {#if (userState.perms & PERMISSIONS.VIEW) > 0} - Companies - {/if} - {#if (userState.perms & (PERMISSIONS.MANAGE_POSTINGS | PERMISSIONS.MANAGE_TAGS | PERMISSIONS.MANAGE_USERS)) > 0} - 0 - ? '/admin/postings' - : (userState.perms & PERMISSIONS.MANAGE_USERS) > 0 - ? '/admin/users' - : // TODO: Implement tags - // : (userState.perms & PERMISSIONS.MANAGE_TAGS) > 0 - // ? '/admin/tags' - (userState.perms & PERMISSIONS.MANAGE_COMPANIES) > 0 - ? '/admin/companies' - : '/admin'} - class="hover-bg-color mr-1 rounded px-3 py-2 text-sm">Administration + {#if largeScreen.current} + {#if (userState.perms & PERMISSIONS.VIEW) > 0} + Postings + Companies + {/if} + {#if (userState.perms & (PERMISSIONS.MANAGE_POSTINGS | PERMISSIONS.MANAGE_TAGS | PERMISSIONS.MANAGE_USERS)) > 0} + 0 + ? '/admin/postings' + : (userState.perms & PERMISSIONS.MANAGE_USERS) > 0 + ? '/admin/users' + : // TODO: Implement tags + // : (userState.perms & PERMISSIONS.MANAGE_TAGS) > 0 + // ? '/admin/tags' + (userState.perms & PERMISSIONS.MANAGE_COMPANIES) > 0 + ? '/admin/companies' + : '/admin'} + class="hover-bg-color mr-1 rounded px-3 py-2 text-sm">Administration + {/if} {/if}
- - - - {userState.id !== null ? 'account_circle' : 'login'} - - - {userState.id !== null ? 'Account' : 'Sign-in'} - - + {currentTheme === 'light' ? 'light_mode' : 'dark_mode'} + + {#if largeScreen.current} + + + {userState.id !== null ? 'account_circle' : 'login'} + + + {userState.id !== null ? 'Account' : 'Sign-in'} + + + {:else} + + {/if}
+
{@render children()}
-