mirror of
https://github.com/edufeed-org/educards.git
synced 2025-12-10 00:34:34 +00:00
Forking of boards, better routing, lots of other stuff
This commit is contained in:
parent
c4bde3e147
commit
08ad305cc2
7 changed files with 165 additions and 64 deletions
|
|
@ -1,6 +1,6 @@
|
|||
<script>
|
||||
import { onMount } from 'svelte';
|
||||
import { db, boards } from '$lib/db';
|
||||
import { db, boards, user, userBoards } from '$lib/db';
|
||||
import { getBoards } from '$lib/ndk';
|
||||
import AddBoardModal from '$lib/components/AddBoardModal.svelte';
|
||||
import BoardCard from '$lib/components/BoardCard.svelte';
|
||||
|
|
@ -16,14 +16,35 @@
|
|||
});
|
||||
</script>
|
||||
|
||||
<button onclick={openModal}>Add Board</button>
|
||||
<div class="flex w-full">
|
||||
<button class="btn ml-auto mr-2" disabled={!$user} onclick={openModal}>Add Board</button>
|
||||
</div>
|
||||
<AddBoardModal bind:modalRef={addBoardModal} />
|
||||
|
||||
<h1>Boards</h1>
|
||||
{#if $boards.length > 0}
|
||||
<div class="flex flex-wrap gap-2">
|
||||
{#each $boards as board (board.id)}
|
||||
<BoardCard {board} />
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
<div class="flex w-full flex-col gap-2">
|
||||
{#if $user}
|
||||
<h1 class="mx-auto text-lg">Your Boards</h1>
|
||||
<div class="grid grid-flow-col grid-rows-2 gap-2 overflow-x-auto">
|
||||
{#key $userBoards}
|
||||
{#each $userBoards as board (board.id)}
|
||||
<BoardCard {board} />
|
||||
{/each}
|
||||
{/key}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if $boards.length > 0}
|
||||
<h1 class="mx-auto text-lg">Alle Boards</h1>
|
||||
<div class="flex flex-wrap justify-start gap-2">
|
||||
{#if $user}
|
||||
{#each $boards.filter((e) => e.pubkey !== $user.pubkey) as board (board.id)}
|
||||
<BoardCard {board} />
|
||||
{/each}
|
||||
{:else}
|
||||
{#each $boards as board (board.id)}
|
||||
<BoardCard {board} />
|
||||
{/each}
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
<script>
|
||||
import Board from '$lib/components/Board.svelte';
|
||||
import { currentBoardId } from '$lib/db.js';
|
||||
import { currentBoardAddress } from '$lib/db.js';
|
||||
export let data;
|
||||
|
||||
console.log('data.id', data.id);
|
||||
$currentBoardId = data.id;
|
||||
console.log(data.id);
|
||||
$currentBoardAddress = data.id;
|
||||
</script>
|
||||
|
||||
<Board boardId={data.id} />
|
||||
<Board boardAddress={data.id} />
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue