diff --git a/src/lib/components/assignment/AssignmentGrid/AssignmentBox.svelte b/src/lib/components/assignment/AssignmentGrid/AssignmentBox.svelte index ae5b465..a00a325 100644 --- a/src/lib/components/assignment/AssignmentGrid/AssignmentBox.svelte +++ b/src/lib/components/assignment/AssignmentGrid/AssignmentBox.svelte @@ -15,6 +15,7 @@ import Modal from '$lib/components/modal/Modal.svelte'; import Store from '$lib/components/utils/Store.svelte'; import { currentCustomDate, sort } from '$lib/utils/dates/custom'; + import { useAuth } from '$lib/utils/store/auth'; export let assignment: Assignment; export let school: string; @@ -30,15 +31,13 @@ const state: Writable = writable({ view: 'read' }); - const userDetails = svocal('dlool.ownUserDetails'); const transparencyOfOverdue = svocal('settings.homework.transparency'); - $: hasEditRights = $userDetails?.classes.some(({ name, school: schoolObj }) => { - const classMatches = assignment.class.name === name; - const schoolMatches = school === schoolObj.name; + const queryStore = writable({ school, classes: [assignment.class.name] }); + $: queryStore.update((props) => ({ ...props, school })); + $: queryStore.update((props) => ({ ...props, classes: [assignment.class.name] })); - return classMatches && schoolMatches; - }); + const { isLoggedIn, isInClass } = useAuth({ query: queryStore }); $: isOverdue = sort(assignment.due, currentCustomDate()) === -1; @@ -56,7 +55,7 @@ > - {#if hasEditRights} + {#if $isInClass && $isLoggedIn}
-
+
diff --git a/src/lib/components/select/NotTyppable.svelte b/src/lib/components/select/NotTyppable.svelte index c5cb331..d9a292b 100644 --- a/src/lib/components/select/NotTyppable.svelte +++ b/src/lib/components/select/NotTyppable.svelte @@ -3,7 +3,7 @@ import { flip, offset, shift } from '@floating-ui/core'; import { createFloatingActions } from 'svelte-floating-ui'; - import { ChevronDown } from 'svelte-hero-icons'; + import { ChevronDown, Icon } from 'svelte-hero-icons'; import QuickAction from '../buttons/QuickAction.svelte'; import Frame from '../input/Frame.svelte'; import type { Readable } from 'svelte/store'; @@ -50,13 +50,15 @@ {/if} - { - showOptions = !showOptions; - }} - /> +
+ +