From 1d8b828d1bbe0e0daa64f6fc2689799c7169afa0 Mon Sep 17 00:00:00 2001
From: Kit La Touche <kit@transneptune.net>
Date: Thu, 19 Sep 2024 23:26:39 -0400
Subject: Add basic browser client

Using Svelte.

No tests, no linting, yet.

This is just starting to get familiar with things.

You'll still have to run the dev server and the dev client builder each
in their own terminals.

Enjoy!
---
 hi-ui/src/routes/+layout.svelte | 7 +++++++
 1 file changed, 7 insertions(+)
 create mode 100644 hi-ui/src/routes/+layout.svelte

(limited to 'hi-ui/src/routes/+layout.svelte')

diff --git a/hi-ui/src/routes/+layout.svelte b/hi-ui/src/routes/+layout.svelte
new file mode 100644
index 0000000..e3c6561
--- /dev/null
+++ b/hi-ui/src/routes/+layout.svelte
@@ -0,0 +1,7 @@
+<script>
+  import "../app.css";
+</script>
+
+<div class="container mx-auto">
+    <slot />
+</div>
-- 
cgit v1.2.3


From b892bd9fdba5fe9397f3c4432b3039aa961b7a14 Mon Sep 17 00:00:00 2001
From: Kit La Touche <kit@transneptune.net>
Date: Fri, 27 Sep 2024 23:08:56 -0400
Subject: Add lots of style and layout

---
 hi-ui/src/lib/Channel.svelte    |  4 ++--
 hi-ui/src/lib/LogOut.svelte     | 12 +++++++++++-
 hi-ui/src/routes/+layout.svelte | 11 ++++++++++-
 hi-ui/src/routes/+page.svelte   | 28 +++++++++++++++++++++++-----
 4 files changed, 46 insertions(+), 9 deletions(-)

(limited to 'hi-ui/src/routes/+layout.svelte')

diff --git a/hi-ui/src/lib/Channel.svelte b/hi-ui/src/lib/Channel.svelte
index 80c4505..7826c46 100644
--- a/hi-ui/src/lib/Channel.svelte
+++ b/hi-ui/src/lib/Channel.svelte
@@ -15,8 +15,8 @@
 </script>
 
 <li
-    class="cursor-pointer hover:bg-teal-100"
-    class:bg-teal-300={active}
+    class="cursor-pointer hover:bg-slate-300"
+    class:bg-slate-400={active}
     on:click={activate}
 >
     #{name}
diff --git a/hi-ui/src/lib/LogOut.svelte b/hi-ui/src/lib/LogOut.svelte
index 439a530..64d26c9 100644
--- a/hi-ui/src/lib/LogOut.svelte
+++ b/hi-ui/src/lib/LogOut.svelte
@@ -2,6 +2,12 @@
     import { logOut} from '../apiServer';
     import { currentUser } from '../store';
 
+    let user;
+
+    currentUser.subscribe((value) => {
+        user = value;
+    });
+
     async function handleLogout(event) {
         event.preventDefault();
         const response = await logOut();
@@ -12,7 +18,11 @@
 </script>
 
 <form on:submit={handleLogout}>
-    <button type="submit">log out</button>
+    @{user.username}
+    <button
+        class="border-slate-500 border-solid border-2 font-bold p-1 rounded"
+        type="submit"
+    >log out</button>
 </form>
 
 <style>
diff --git a/hi-ui/src/routes/+layout.svelte b/hi-ui/src/routes/+layout.svelte
index e3c6561..3673e58 100644
--- a/hi-ui/src/routes/+layout.svelte
+++ b/hi-ui/src/routes/+layout.svelte
@@ -2,6 +2,15 @@
   import "../app.css";
 </script>
 
-<div class="container mx-auto">
+<div id="app">
     <slot />
 </div>
+
+<style>
+    #app {
+        margin: 0;
+        padding: 1rem;
+        height: 100vh;
+        width: 100%;
+    }
+</style>
diff --git a/hi-ui/src/routes/+page.svelte b/hi-ui/src/routes/+page.svelte
index 4ef26db..6025b6f 100644
--- a/hi-ui/src/routes/+page.svelte
+++ b/hi-ui/src/routes/+page.svelte
@@ -46,17 +46,35 @@
 {#if loading}
     <h2>Loading&hellip;</h2>
 {:else if user != null}
-    <LogOut /> @{user.username}
-    <div class="flex flex-row">
-        <div class="basis-1/4 border-solid border-2 border-sky-500">
+    <LogOut />
+    <div id="interface">
+        <div>
             <ChannelList />
-            <CreateChannelForm />
         </div>
-        <div class="basis-3/4 border-solid border-2 border-sky-500">
+        <div>
             <ActiveChannel />
+        </div>
+        <div>
+            <CreateChannelForm />
+        </div>
+        <div>
             <MessageInput />
         </div>
     </div>
 {:else}
     <LogIn />
 {/if}
+
+<style>
+    #interface {
+        height: 90%;
+        margin: 1rem;
+        display: grid;
+        grid-template-columns: 18rem auto;
+        grid-template-rows: auto 2rem;
+        grid-gap: 0.25rem;
+    }
+    #interface div {
+        border: 1px solid grey;
+    }
+</style>
-- 
cgit v1.2.3


From a6a170ab5320d9ef0a2e007ac3ab75edee574fef Mon Sep 17 00:00:00 2001
From: Kit La Touche <kit@transneptune.net>
Date: Mon, 30 Sep 2024 21:41:09 -0400
Subject: Move layout concerns into layout

---
 hi-ui/src/routes/+layout.svelte | 2 ++
 hi-ui/src/routes/+page.svelte   | 2 --
 2 files changed, 2 insertions(+), 2 deletions(-)

(limited to 'hi-ui/src/routes/+layout.svelte')

diff --git a/hi-ui/src/routes/+layout.svelte b/hi-ui/src/routes/+layout.svelte
index 3673e58..f54f3bf 100644
--- a/hi-ui/src/routes/+layout.svelte
+++ b/hi-ui/src/routes/+layout.svelte
@@ -3,6 +3,8 @@
 </script>
 
 <div id="app">
+    <h1>hi</h1>
+
     <slot />
 </div>
 
diff --git a/hi-ui/src/routes/+page.svelte b/hi-ui/src/routes/+page.svelte
index 6025b6f..6d60b0c 100644
--- a/hi-ui/src/routes/+page.svelte
+++ b/hi-ui/src/routes/+page.svelte
@@ -41,8 +41,6 @@
 	});
 </script>
 
-<h1>hi</h1>
-
 {#if loading}
     <h2>Loading&hellip;</h2>
 {:else if user != null}
-- 
cgit v1.2.3


From 671b36c2c8d4026eb7a34f0ac7bd5720b34f1a0d Mon Sep 17 00:00:00 2001
From: Owen Jacobson <owen@grimoire.ca>
Date: Sat, 28 Sep 2024 00:43:43 -0400
Subject: Configure the SvelteKit build process to build a static site.

This is the [recommended] adapter for a single-page app. That's approximately how I expect to deploy the UI.

[recommended]: https://kit.svelte.dev/docs/single-page-apps
---
 hi-ui/package-lock.json         | 11 +++++++++++
 hi-ui/package.json              |  1 +
 hi-ui/src/routes/+layout.svelte |  2 ++
 hi-ui/svelte.config.js          |  6 ++++--
 4 files changed, 18 insertions(+), 2 deletions(-)

(limited to 'hi-ui/src/routes/+layout.svelte')

diff --git a/hi-ui/package-lock.json b/hi-ui/package-lock.json
index 14e0c8a..65bf5af 100644
--- a/hi-ui/package-lock.json
+++ b/hi-ui/package-lock.json
@@ -12,6 +12,7 @@
 			},
 			"devDependencies": {
 				"@sveltejs/adapter-auto": "^3.0.0",
+				"@sveltejs/adapter-static": "^3.0.5",
 				"@sveltejs/kit": "^2.0.0",
 				"@sveltejs/vite-plugin-svelte": "^3.0.0",
 				"@types/eslint": "^9.6.0",
@@ -1088,6 +1089,16 @@
 				"@sveltejs/kit": "^2.0.0"
 			}
 		},
+		"node_modules/@sveltejs/adapter-static": {
+			"version": "3.0.5",
+			"resolved": "https://registry.npmjs.org/@sveltejs/adapter-static/-/adapter-static-3.0.5.tgz",
+			"integrity": "sha512-kFJR7RxeB6FBvrKZWAEzIALatgy11ISaaZbcPup8JdWUdrmmfUHHTJ738YHJTEfnCiiXi6aX8Q6ePY7tnSMD6Q==",
+			"dev": true,
+			"license": "MIT",
+			"peerDependencies": {
+				"@sveltejs/kit": "^2.0.0"
+			}
+		},
 		"node_modules/@sveltejs/kit": {
 			"version": "2.5.28",
 			"resolved": "https://registry.npmjs.org/@sveltejs/kit/-/kit-2.5.28.tgz",
diff --git a/hi-ui/package.json b/hi-ui/package.json
index 663cf81..de72564 100644
--- a/hi-ui/package.json
+++ b/hi-ui/package.json
@@ -11,6 +11,7 @@
 	},
 	"devDependencies": {
 		"@sveltejs/adapter-auto": "^3.0.0",
+		"@sveltejs/adapter-static": "^3.0.5",
 		"@sveltejs/kit": "^2.0.0",
 		"@sveltejs/vite-plugin-svelte": "^3.0.0",
 		"@types/eslint": "^9.6.0",
diff --git a/hi-ui/src/routes/+layout.svelte b/hi-ui/src/routes/+layout.svelte
index f54f3bf..67a5fa5 100644
--- a/hi-ui/src/routes/+layout.svelte
+++ b/hi-ui/src/routes/+layout.svelte
@@ -1,5 +1,7 @@
 <script>
   import "../app.css";
+
+  export const ssr = false;
 </script>
 
 <div id="app">
diff --git a/hi-ui/svelte.config.js b/hi-ui/svelte.config.js
index 7f55c59..07e332f 100644
--- a/hi-ui/svelte.config.js
+++ b/hi-ui/svelte.config.js
@@ -1,4 +1,4 @@
-import adapter from '@sveltejs/adapter-auto';
+import adapter from '@sveltejs/adapter-static';
 import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
 
 /** @type {import('@sveltejs/kit').Config} */
@@ -7,7 +7,9 @@ const config = {
 		// adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list.
 		// If your environment is not supported, or you settled on a specific environment, switch out the adapter.
 		// See https://kit.svelte.dev/docs/adapters for more information about adapters.
-		adapter: adapter()
+		adapter: adapter({
+			fallback: 'index.html',
+		}),
   },
   preprocess: vitePreprocess()
 };
-- 
cgit v1.2.3

