Fix open newly created card and on column change

This commit is contained in:
Brieuc Dubois 2024-01-17 01:14:57 +01:00
parent 4a3d768aa1
commit c39b2d5b26
5 changed files with 13 additions and 9 deletions

View File

@ -4,7 +4,7 @@
import ModalCard from './ModalCard.svelte';
export let card: Card;
export let showModal = false;
$: showModal = card.showModal;
</script>
<div
@ -34,8 +34,8 @@
</div>
{#if showModal}
<ModalCard {card} bind:showModal />
{/if}
<ModalCard {card} />
{:else}{/if}
<style lang="less">
.card {

View File

@ -6,7 +6,6 @@
import { cards } from '$lib/types/Card';
export let card: Card;
export let showModal: boolean;
let newTitle: string = card.title;
let newContent: string = card.content;
@ -15,7 +14,7 @@
if (card.title !== newTitle || card.content !== newContent) {
if (!(await card.update(newTitle, newContent))) return;
}
if (closeModal) showModal = false;
if (closeModal) card.showModal = false;
cards.reload();
}
@ -37,12 +36,12 @@
<button
on:click|once={async () => {
await card.delete();
showModal = false;
card.showModal = false;
}}
>
<TrashIcon />
</button>
<button on:click|once={() => (showModal = false)}>
<button on:click|once={() => (card.showModal = false)}>
<CloseIcon />
</button>
</div>

View File

@ -68,6 +68,8 @@
}
cards.reload();
card.showModal = true;
}
</script>

View File

@ -29,6 +29,8 @@
}
isOpen = false;
cards.reload();
card.showModal = true;
}
async function createOption() {

View File

@ -1,10 +1,10 @@
import cardsApi from '$lib/api/cardsApi';
import { toastAlert } from '$lib/utils/toasts';
import { get, writable } from 'svelte/store';
import CardTag from './CardTag';
import Project from './Project';
import { toastAlert } from '$lib/utils/toasts';
import type TagOption from './TagOption';
import type ProjectTag from './ProjectTag';
import type TagOption from './TagOption';
const { subscribe, set, update } = writable([] as Card[]);
@ -21,6 +21,7 @@ export default class Card {
private _title: string;
private _content: string;
private _cardTags: CardTag[];
public showModal: boolean = false;
private constructor(
id: number,