Fix first-start issues
This commit is contained in:
parent
9d38545179
commit
157cd74826
|
@ -7,7 +7,6 @@
|
||||||
export let card: Card;
|
export let card: Card;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<!-- on:dragend={() => currentDraggedCard.set(null)} -->
|
|
||||||
<div
|
<div
|
||||||
class="card"
|
class="card"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
export let isOpen = false;
|
export let isOpen = false;
|
||||||
export let choices: { id: number; value: string }[] = [];
|
export let choices: { id: number; value: string }[] = [];
|
||||||
export let onChoice = (id: number) => {};
|
export let onChoice = (id: number) => {};
|
||||||
export let currentChoice: number = -1;
|
export let currentChoice: number;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Menu {isOpen}>
|
<Menu {isOpen}>
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
import GroupMenu from './groupMenu.svelte';
|
import GroupMenu from './groupMenu.svelte';
|
||||||
|
|
||||||
export let project: Project;
|
export let project: Project;
|
||||||
export let currentTagId: number;
|
export let view: View;
|
||||||
let groupMenuOpen = false;
|
let groupMenuOpen = false;
|
||||||
|
|
||||||
function getEmptyTags(): TagValue[] {
|
function getEmptyTags(): TagValue[] {
|
||||||
|
@ -44,7 +44,7 @@
|
||||||
<div>
|
<div>
|
||||||
<button
|
<button
|
||||||
on:click={() => (groupMenuOpen = !groupMenuOpen)}
|
on:click={() => (groupMenuOpen = !groupMenuOpen)}
|
||||||
class:defined={$currentView?.primary_tag_id}>Group</button
|
class:defined={$currentView?.primary_tag_id !== -1}>Group</button
|
||||||
>
|
>
|
||||||
<GroupMenu
|
<GroupMenu
|
||||||
isOpen={groupMenuOpen}
|
isOpen={groupMenuOpen}
|
||||||
|
@ -53,7 +53,7 @@
|
||||||
if (!(await setGroup(id))) return;
|
if (!(await setGroup(id))) return;
|
||||||
groupMenuOpen = false;
|
groupMenuOpen = false;
|
||||||
}}
|
}}
|
||||||
currentChoice={currentTagId}
|
currentChoice={view?.primary_tag_id}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
|
|
@ -25,30 +25,41 @@
|
||||||
|
|
||||||
{#if project}
|
{#if project}
|
||||||
<section>
|
<section>
|
||||||
{#if view && $projectTags[view.primary_tag_id] && $cards}
|
{#if view}
|
||||||
<Header {project} currentTagId={view.primary_tag_id} />
|
<Header {project} {view} />
|
||||||
|
{#if cards}
|
||||||
<div class="grid">
|
<div class="grid">
|
||||||
|
{#if view.primary_tag_id !== -1}
|
||||||
{#each $projectTags[view.primary_tag_id].options as option}
|
{#each $projectTags[view.primary_tag_id].options as option}
|
||||||
<Column
|
<Column
|
||||||
{option}
|
{option}
|
||||||
columnCards={$cards.filter((c) => c.tags.map((t) => t.option_id).includes(option.id))}
|
columnCards={$cards.filter((c) =>
|
||||||
|
c.tags.map((t) => t.option_id).includes(option.id)
|
||||||
|
)}
|
||||||
projectId={project.id}
|
projectId={project.id}
|
||||||
/>
|
/>
|
||||||
{/each}
|
{/each}
|
||||||
|
{/if}
|
||||||
<Column
|
<Column
|
||||||
option={{
|
option={{
|
||||||
id: -1,
|
id: -1,
|
||||||
tag_id: view.primary_tag_id,
|
tag_id: view.primary_tag_id,
|
||||||
value: `No ${$projectTags[view.primary_tag_id].title}`
|
value:
|
||||||
|
view.primary_tag_id !== -1
|
||||||
|
? `No ${$projectTags[view.primary_tag_id].title}`
|
||||||
|
: 'No groups'
|
||||||
}}
|
}}
|
||||||
columnCards={$cards.filter(
|
columnCards={view.primary_tag_id !== -1
|
||||||
|
? $cards.filter(
|
||||||
(c) => !c.tags.map((t) => t.tag_id).includes(view?.primary_tag_id || -2)
|
(c) => !c.tags.map((t) => t.tag_id).includes(view?.primary_tag_id || -2)
|
||||||
)}
|
)
|
||||||
|
: $cards}
|
||||||
projectId={project.id}
|
projectId={project.id}
|
||||||
editable={false}
|
editable={false}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
{/if}
|
||||||
</section>
|
</section>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
import ViewIcon from './icons/viewIcon.svelte';
|
import ViewIcon from './icons/viewIcon.svelte';
|
||||||
import projectTags from '../stores/projectTags';
|
import projectTags from '../stores/projectTags';
|
||||||
import EditIcon from './icons/editIcon.svelte';
|
import EditIcon from './icons/editIcon.svelte';
|
||||||
|
import { get } from 'svelte/store';
|
||||||
|
|
||||||
export let project: Project;
|
export let project: Project;
|
||||||
|
|
||||||
|
@ -15,10 +16,10 @@
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
await views.init(project.id);
|
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;
|
if (!$views) return;
|
||||||
|
|
||||||
const primaryTagId =
|
const primaryTagId =
|
||||||
|
@ -35,7 +36,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
async function saveView(view: View) {
|
async function saveView(view: View) {
|
||||||
await tick();
|
|
||||||
if (!view || !$views.includes(view)) return;
|
if (!view || !$views.includes(view)) return;
|
||||||
if (viewEditId === view.id && viewEditValue !== view.title) {
|
if (viewEditId === view.id && viewEditValue !== view.title) {
|
||||||
if (!(await views.edit(view))) return;
|
if (!(await views.edit(view))) return;
|
||||||
|
@ -53,10 +53,10 @@
|
||||||
<span id="version">v0.0.1</span>
|
<span id="version">v0.0.1</span>
|
||||||
</div>
|
</div>
|
||||||
<div id="views">
|
<div id="views">
|
||||||
{#if views}
|
|
||||||
<h2>{project.title}</h2>
|
<h2>{project.title}</h2>
|
||||||
|
{#if views}
|
||||||
<ul>
|
<ul>
|
||||||
{#each $views as view}
|
{#each get(views) as view}
|
||||||
<!-- svelte-ignore a11y-no-noninteractive-element-to-interactive-role -->
|
<!-- svelte-ignore a11y-no-noninteractive-element-to-interactive-role -->
|
||||||
<li
|
<li
|
||||||
on:click={() => currentView.set(view)}
|
on:click={() => currentView.set(view)}
|
||||||
|
@ -79,7 +79,7 @@
|
||||||
id="viewTitle-{view.id}"
|
id="viewTitle-{view.id}"
|
||||||
on:keydown={(e) => {
|
on:keydown={(e) => {
|
||||||
if (e.key === 'Enter') {
|
if (e.key === 'Enter') {
|
||||||
saveView(view);
|
e.currentTarget.blur();
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
@ -106,12 +106,12 @@
|
||||||
<div class="separator"></div>
|
<div class="separator"></div>
|
||||||
<div
|
<div
|
||||||
id="newView"
|
id="newView"
|
||||||
on:click={newView}
|
on:click={createView}
|
||||||
role="button"
|
role="button"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
on:keydown={(e) => {
|
on:keydown={(e) => {
|
||||||
if (e.key === 'Enter') {
|
if (e.key === 'Enter') {
|
||||||
newView();
|
createView();
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|
|
@ -20,10 +20,12 @@ export default {
|
||||||
|
|
||||||
const tags: { [key: number]: MeTag } = {};
|
const tags: { [key: number]: MeTag } = {};
|
||||||
|
|
||||||
|
if (metags) {
|
||||||
metags.forEach((tag: MeTag) => {
|
metags.forEach((tag: MeTag) => {
|
||||||
if (tag.options === null) tag.options = [];
|
if (tag.options === null) tag.options = [];
|
||||||
tags[tag.id] = tag;
|
tags[tag.id] = tag;
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
set(tags);
|
set(tags);
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,9 @@ export const views = (() => {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (response.data) {
|
||||||
set(response.data);
|
set(response.data);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue