mirror of
https://github.com/edufeed-org/educards.git
synced 2025-12-09 16:24:34 +00:00
Add logout
This commit is contained in:
parent
08ad305cc2
commit
1f3234b799
4 changed files with 11 additions and 8 deletions
|
|
@ -4,7 +4,7 @@
|
|||
export let board;
|
||||
</script>
|
||||
|
||||
<div class="card w-96 flex-none bg-base-100 shadow-xl">
|
||||
<div class="card w-96 bg-base-100 shadow-xl">
|
||||
<div class="card-body">
|
||||
<h2 class="card-title">{eventTitle(board)}</h2>
|
||||
<div class="card-actions justify-end">
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
<div class="form-control">
|
||||
<!-- <input type="text" placeholder="Search" class="input input-bordered w-24 md:w-auto" /> -->
|
||||
</div>
|
||||
{#if $user}
|
||||
{#if $user?.pubkey}
|
||||
<div class="dropdown dropdown-end">
|
||||
<div tabindex="0" role="button" class="avatar btn btn-circle btn-ghost">
|
||||
<div class="w-10 rounded-full">
|
||||
|
|
@ -29,7 +29,7 @@
|
|||
</a>
|
||||
</li>
|
||||
<li><a>Settings</a></li>
|
||||
<li><a>Logout</a></li>
|
||||
<li><a onclick={() => user.set(null)}>Logout</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
{:else}
|
||||
|
|
|
|||
|
|
@ -63,8 +63,11 @@ export const cardsForColumn = (columnId) => {
|
|||
export const user = writable(null);
|
||||
|
||||
export const userBoards = derived([user, boards], ([$user, $boards]) => {
|
||||
const newUserBoards = $boards.filter((b) => b.pubkey === $user.pubkey);
|
||||
return newUserBoards;
|
||||
if ($user?.pubkey) {
|
||||
const newUserBoards = $boards.filter((b) => b.pubkey === $user.pubkey);
|
||||
return newUserBoards;
|
||||
}
|
||||
return [];
|
||||
});
|
||||
|
||||
export const db = writable({
|
||||
|
|
@ -86,9 +89,9 @@ async function initNDK() {
|
|||
|
||||
const subDelete = ndk.subscribe({ kinds: [5] });
|
||||
subDelete.on('event', async (event) => {
|
||||
const toBeDeletedDs = event.getMatchingTags('a').map((e) => e[1].split(':')[2]);
|
||||
const toBeDeletedDs = event.getMatchingTags('a').map((e) => e[1]);
|
||||
events.update((events) => {
|
||||
return events.filter((e) => !toBeDeletedDs.includes(e.dTag));
|
||||
return events.filter((e) => !toBeDeletedDs.includes(e.tagAddress()));
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
{#if $boards.length > 0}
|
||||
<h1 class="mx-auto text-lg">Alle Boards</h1>
|
||||
<div class="flex flex-wrap justify-start gap-2">
|
||||
<div class="flex grid grid-flow-col grid-rows-2 overflow-y-auto">
|
||||
{#if $user}
|
||||
{#each $boards.filter((e) => e.pubkey !== $user.pubkey) as board (board.id)}
|
||||
<BoardCard {board} />
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue