diff options
| author | Owen Jacobson <owen@grimoire.ca> | 2024-11-03 15:33:43 -0500 |
|---|---|---|
| committer | Owen Jacobson <owen@grimoire.ca> | 2024-11-03 15:33:43 -0500 |
| commit | 30fa0c4c1faece6b054105fe3cce5107f24a2fa2 (patch) | |
| tree | 6b66eec84a702103f368f6a5ba0e96736fc56fd6 /ui/routes/(app) | |
| parent | f2285a52822fbd1d82a24fe3b51c4343dc9e9ae6 (diff) | |
Svelte 5: go through and use runes in components, pages, and layouts.
Does not use runes in stores (yet).
Diffstat (limited to 'ui/routes/(app)')
| -rw-r--r-- | ui/routes/(app)/+layout.svelte | 6 | ||||
| -rw-r--r-- | ui/routes/(app)/ch/[channel]/+page.svelte | 2 | ||||
| -rw-r--r-- | ui/routes/(app)/me/+page.svelte | 17 |
3 files changed, 13 insertions, 12 deletions
diff --git a/ui/routes/(app)/+layout.svelte b/ui/routes/(app)/+layout.svelte index 5d1023d..356a096 100644 --- a/ui/routes/(app)/+layout.svelte +++ b/ui/routes/(app)/+layout.svelte @@ -9,10 +9,10 @@ import ChannelList from '$lib/components/ChannelList.svelte'; import CreateChannelForm from '$lib/components/CreateChannelForm.svelte'; - let loading = true; let events = null; - $: channel = $page?.params?.channel; + let loading = $state(true); + let channel = $derived($page.params.channel); function onBooted(boot) { currentUser.update(() => ({ @@ -63,7 +63,7 @@ <div id="interface" class="p-2"> <nav id="sidebar" data-expanded={$showMenu}> <div class="channel-list"> - <ChannelList active={channel} /> + <ChannelList active={channel} channels={$channelsList.channels} /> </div> <div class="create-channel"> <CreateChannelForm /> diff --git a/ui/routes/(app)/ch/[channel]/+page.svelte b/ui/routes/(app)/ch/[channel]/+page.svelte index 2c1b40a..a5836fc 100644 --- a/ui/routes/(app)/ch/[channel]/+page.svelte +++ b/ui/routes/(app)/ch/[channel]/+page.svelte @@ -3,7 +3,7 @@ import ActiveChannel from '$lib/components/ActiveChannel.svelte'; import MessageInput from '$lib/components/MessageInput.svelte'; - $: channel = $page?.params?.channel; + let channel = $derived($page.params.channel); </script> <div class="active-channel"> diff --git a/ui/routes/(app)/me/+page.svelte b/ui/routes/(app)/me/+page.svelte index 26537ad..4531a91 100644 --- a/ui/routes/(app)/me/+page.svelte +++ b/ui/routes/(app)/me/+page.svelte @@ -3,15 +3,16 @@ import Invites from '$lib/components/Invites.svelte'; - let currentPassword = '', - newPassword = '', - confirmPassword = '', + let currentPassword = $state(''), + newPassword = $state(''), + confirmPassword = $state(''), passwordForm; - let pending = false; - $: valid = newPassword === confirmPassword && newPassword !== currentPassword; - $: disabled = pending || !valid; + let pending = $state(false); + let valid = $derived(newPassword === confirmPassword && newPassword !== currentPassword); + let disabled = $derived(pending || !valid); - async function onPasswordChange() { + async function onPasswordChange(event) { + event.preventDefault(); pending = true; let response = await changePassword(currentPassword, newPassword); switch (response.status) { @@ -23,7 +24,7 @@ } </script> -<form on:submit|preventDefault={onPasswordChange} bind:this={passwordForm}> +<form onsubmit={onPasswordChange} bind:this={passwordForm}> <label >current password <input |
