diff --git a/frontend/src/components/project/card/card.svelte b/frontend/src/components/project/card/card.svelte index b5ec9cd..155661e 100644 --- a/frontend/src/components/project/card/card.svelte +++ b/frontend/src/components/project/card/card.svelte @@ -7,7 +7,6 @@ export let card: Card; -
{}; - export let currentChoice: number = -1; + export let currentChoice: number; diff --git a/frontend/src/components/project/header.svelte b/frontend/src/components/project/header.svelte index 387a52c..4f7d3dd 100644 --- a/frontend/src/components/project/header.svelte +++ b/frontend/src/components/project/header.svelte @@ -6,7 +6,7 @@ import GroupMenu from './groupMenu.svelte'; export let project: Project; - export let currentTagId: number; + export let view: View; let groupMenuOpen = false; function getEmptyTags(): TagValue[] { @@ -44,7 +44,7 @@
Group
diff --git a/frontend/src/components/project/project.svelte b/frontend/src/components/project/project.svelte index 78c178b..720f6e2 100644 --- a/frontend/src/components/project/project.svelte +++ b/frontend/src/components/project/project.svelte @@ -25,29 +25,40 @@ {#if project}
- {#if view && $projectTags[view.primary_tag_id] && $cards} -
-
- {#each $projectTags[view.primary_tag_id].options as option} + {#if view} +
+ {#if cards} +
+ {#if view.primary_tag_id !== -1} + {#each $projectTags[view.primary_tag_id].options as option} + + c.tags.map((t) => t.option_id).includes(option.id) + )} + projectId={project.id} + /> + {/each} + {/if} c.tags.map((t) => t.option_id).includes(option.id))} + option={{ + id: -1, + tag_id: view.primary_tag_id, + value: + view.primary_tag_id !== -1 + ? `No ${$projectTags[view.primary_tag_id].title}` + : 'No groups' + }} + columnCards={view.primary_tag_id !== -1 + ? $cards.filter( + (c) => !c.tags.map((t) => t.tag_id).includes(view?.primary_tag_id || -2) + ) + : $cards} projectId={project.id} + editable={false} /> - {/each} - !c.tags.map((t) => t.tag_id).includes(view?.primary_tag_id || -2) - )} - projectId={project.id} - editable={false} - /> -
+
+ {/if} {/if}
{/if} diff --git a/frontend/src/components/sidebar.svelte b/frontend/src/components/sidebar.svelte index 26d8ad4..201296b 100644 --- a/frontend/src/components/sidebar.svelte +++ b/frontend/src/components/sidebar.svelte @@ -6,6 +6,7 @@ import ViewIcon from './icons/viewIcon.svelte'; import projectTags from '../stores/projectTags'; import EditIcon from './icons/editIcon.svelte'; + import { get } from 'svelte/store'; export let project: Project; @@ -15,10 +16,10 @@ onMount(async () => { await views.init(project.id); - if ($views.length > 0) currentView.set($views[0]); + if ($views && $views.length > 0) currentView.set($views[0]); }); - async function newView() { + async function createView() { if (!$views) return; const primaryTagId = @@ -35,7 +36,6 @@ } async function saveView(view: View) { - await tick(); if (!view || !$views.includes(view)) return; if (viewEditId === view.id && viewEditValue !== view.title) { if (!(await views.edit(view))) return; @@ -53,10 +53,10 @@ v0.0.1
+

{project.title}

{#if views} -

{project.title}

    - {#each $views as view} + {#each get(views) as view}
  • currentView.set(view)} @@ -79,7 +79,7 @@ id="viewTitle-{view.id}" on:keydown={(e) => { if (e.key === 'Enter') { - saveView(view); + e.currentTarget.blur(); } }} /> @@ -106,12 +106,12 @@
    { if (e.key === 'Enter') { - newView(); + createView(); } }} > diff --git a/frontend/src/stores/projectTags.ts b/frontend/src/stores/projectTags.ts index ec25c2e..033cf00 100644 --- a/frontend/src/stores/projectTags.ts +++ b/frontend/src/stores/projectTags.ts @@ -20,10 +20,12 @@ export default { const tags: { [key: number]: MeTag } = {}; - metags.forEach((tag: MeTag) => { - if (tag.options === null) tag.options = []; - tags[tag.id] = tag; - }); + if (metags) { + metags.forEach((tag: MeTag) => { + if (tag.options === null) tag.options = []; + tags[tag.id] = tag; + }); + } set(tags); diff --git a/frontend/src/stores/smallStore.ts b/frontend/src/stores/smallStore.ts index dbf8a12..c591db9 100644 --- a/frontend/src/stores/smallStore.ts +++ b/frontend/src/stores/smallStore.ts @@ -69,7 +69,9 @@ export const views = (() => { return false; } - set(response.data); + if (response.data) { + set(response.data); + } return true; };