Add some state management stuff

This commit is contained in:
Jon Staab
2024-08-06 15:46:37 -07:00
parent 36a920df51
commit fb04a68168
18 changed files with 5474 additions and 5206 deletions
+6 -3
View File
@@ -8,7 +8,8 @@
<script lang="ts">
import Icon from "@lib/components/Icon.svelte"
import PrimaryNavItem from "@lib/components/PrimaryNavItem.svelte"
import {spaces} from "@app/state"
import {getGroupName, getGroupPicture, makeGroupId} from "@app/domain"
import {userGroupRelaysByNom, groupsById} from "@app/state"
</script>
<div class="relative w-14 bg-base-100">
@@ -22,10 +23,12 @@
src="https://img.daisyui.com/images/stock/photo-1534528741775-53994a69daeb.webp" />
</div>
</PrimaryNavItem>
{#each $spaces as { id, name, picture } (id)}
{#each $userGroupRelaysByNom.entries() as [nom, relays] (nom)}
{@const event = $groupsById.get(makeGroupId(relays[0], nom))}
{@const name = getGroupName(event)}
<PrimaryNavItem title={name}>
<div class="w-10 rounded-full border border-solid border-base-300">
<img alt={name} src={picture} />
<img alt={name} src={getGroupPicture(event)} />
</div>
</PrimaryNavItem>
{/each}
+1 -1
View File
@@ -4,7 +4,7 @@
</script>
<div class="flex w-60 flex-col gap-1 bg-base-300 px-2 py-4">
<SecondaryNavItem href="/">
<SecondaryNavItem href="/home">
<Icon icon="home-smile" /> Home
</SecondaryNavItem>
<SecondaryNavItem href="/people">