mirror of
https://github.com/edufeed-org/educards.git
synced 2025-12-10 00:34:34 +00:00
Basic crud works kind of
This commit is contained in:
commit
c4bde3e147
30 changed files with 5594 additions and 0 deletions
8
src/routes/+layout.svelte
Normal file
8
src/routes/+layout.svelte
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
<script>
|
||||
import '../app.css';
|
||||
import Navbar from '$lib/components/Navbar.svelte';
|
||||
let { children } = $props();
|
||||
</script>
|
||||
|
||||
<Navbar />
|
||||
{@render children()}
|
||||
29
src/routes/+page.svelte
Normal file
29
src/routes/+page.svelte
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<script>
|
||||
import { onMount } from 'svelte';
|
||||
import { db, boards } from '$lib/db';
|
||||
import { getBoards } from '$lib/ndk';
|
||||
import AddBoardModal from '$lib/components/AddBoardModal.svelte';
|
||||
import BoardCard from '$lib/components/BoardCard.svelte';
|
||||
|
||||
let addBoardModal;
|
||||
|
||||
function openModal() {
|
||||
addBoardModal.showModal();
|
||||
}
|
||||
|
||||
onMount(async () => {
|
||||
await getBoards();
|
||||
});
|
||||
</script>
|
||||
|
||||
<button onclick={openModal}>Add Board</button>
|
||||
<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}
|
||||
5
src/routes/board/[id]/+page.js
Normal file
5
src/routes/board/[id]/+page.js
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
export async function load({ params }) {
|
||||
return {
|
||||
id: params.id
|
||||
};
|
||||
}
|
||||
10
src/routes/board/[id]/+page.svelte
Normal file
10
src/routes/board/[id]/+page.svelte
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<script>
|
||||
import Board from '$lib/components/Board.svelte';
|
||||
import { currentBoardId } from '$lib/db.js';
|
||||
export let data;
|
||||
|
||||
console.log('data.id', data.id);
|
||||
$currentBoardId = data.id;
|
||||
</script>
|
||||
|
||||
<Board boardId={data.id} />
|
||||
Loading…
Add table
Add a link
Reference in a new issue