From 8f360dd9cc45bb14431238ccc5e3d137c020fa7b Mon Sep 17 00:00:00 2001 From: Kit La Touche Date: Wed, 23 Oct 2024 21:52:24 -0400 Subject: Do a big mobile app design thing Mobile-friendly anyway. Thanks to [Miriam](https://www.miriamsuzanne.com/) for the CSS that enables a sliding menu on mobile size, constant menu on larger. --- tools/run | 15 ++++-- ui/lib/assets/logo.png | Bin 0 -> 137101 bytes ui/lib/components/Channel.svelte | 8 ++- ui/lib/store.js | 1 + ui/routes/(app)/+layout.svelte | 108 ++++++++++++++++++++++++++++----------- ui/routes/+layout.svelte | 41 +++++++++------ ui/static/favicon.png | Bin 1571 -> 137101 bytes 7 files changed, 123 insertions(+), 50 deletions(-) create mode 100644 ui/lib/assets/logo.png diff --git a/tools/run b/tools/run index 452355e..562a94d 100755 --- a/tools/run +++ b/tools/run @@ -1,8 +1,15 @@ #!/bin/bash -e ## tools/run [ARGS...] -## -## Run the server in development mode. Shorthand for `cargo run`. -tools/build-ui -cargo run -- "$@" +if [ -z ${HI_DEV+x} ]; then + tools/build-ui + cargo run -- "$@" +else + npm run dev & PIDS[0]=$! + cargo run -- "$@" & PIDS[1]=$! + + trap "kill ${PIDS[*]}" SIGINT + + wait +fi diff --git a/ui/lib/assets/logo.png b/ui/lib/assets/logo.png new file mode 100644 index 0000000..5df6b4e Binary files /dev/null and b/ui/lib/assets/logo.png differ diff --git a/ui/lib/components/Channel.svelte b/ui/lib/components/Channel.svelte index e62f0f3..bbe9ff7 100644 --- a/ui/lib/components/Channel.svelte +++ b/ui/lib/components/Channel.svelte @@ -1,14 +1,20 @@
  • - + # {name} diff --git a/ui/lib/store.js b/ui/lib/store.js index ae17ffa..bdd3e3b 100644 --- a/ui/lib/store.js +++ b/ui/lib/store.js @@ -3,6 +3,7 @@ import { Channels } from '$lib/store/channels'; import { Messages } from '$lib/store/messages'; import { Logins } from '$lib/store/logins'; +export const showMenu = writable(false); export const currentUser = writable(null); export const logins = writable(new Logins()); export const channelsList = writable(new Channels()); diff --git a/ui/routes/(app)/+layout.svelte b/ui/routes/(app)/+layout.svelte index 9abaaf4..b63a607 100644 --- a/ui/routes/(app)/+layout.svelte +++ b/ui/routes/(app)/+layout.svelte @@ -4,7 +4,7 @@ import { onMount, onDestroy } from 'svelte'; import { boot, subscribeToEvents } from '$lib/apiServer'; - import { currentUser, logins, channelsList, messages } from '$lib/store'; + import { showMenu, currentUser, logins, channelsList, messages } from '$lib/store'; import ChannelList from '$lib/components/ChannelList.svelte'; import CreateChannelForm from '$lib/components/CreateChannelForm.svelte'; @@ -12,6 +12,15 @@ let loading = true; let events = null; + let showMenuValue; + showMenu.subscribe((value) => { + showMenuValue = value; + }); + + + function toggleMenu() { + showMenu.update((value) => !value); + } $: channel = $page?.params?.channel; @@ -57,37 +66,76 @@ {#if loading}

    Loading…

    {:else} -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    +
    +
    +
    + +
    +
    + +
    +
    + +
    {/if} diff --git a/ui/routes/+layout.svelte b/ui/routes/+layout.svelte index 7b99d62..1b2391c 100644 --- a/ui/routes/+layout.svelte +++ b/ui/routes/+layout.svelte @@ -1,29 +1,40 @@ -
    - - 🌳 +
    +
    + + + + logo + + understory - - {#if $currentUser} - - {/if} - - - + + {#if $currentUser} + + {/if} + + +