Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Navigation collapse (#893)
Browse files* add collapse behaviour
* add collapsedNavigation setting
* Revert "add collapsedNavigation setting"
This reverts commit 6c9baf480834ba5bf2b5bdd3cbf93232afce02a7.
* last tweaks
* rm unused
* Update src/lib/components/ExpandNavigation.svelte
Co-authored-by: Mishig <[email protected]>
---------
Co-authored-by: Mishig <[email protected]>
src/lib/components/ExpandNavigation.svelte
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<script lang="ts">
|
| 2 |
+
export let isCollapsed: boolean;
|
| 3 |
+
export let classNames: string;
|
| 4 |
+
</script>
|
| 5 |
+
|
| 6 |
+
<button
|
| 7 |
+
on:click
|
| 8 |
+
class="{classNames} group flex h-16 w-6 flex-col items-center justify-center -space-y-1 outline-none *:h-3 *:w-1 *:rounded-full *:hover:bg-gray-300 max-md:hidden dark:*:hover:bg-gray-600 {!isCollapsed
|
| 9 |
+
? '*:bg-gray-200/70 dark:*:bg-gray-800'
|
| 10 |
+
: '*:bg-gray-200 dark:*:bg-gray-700'}"
|
| 11 |
+
>
|
| 12 |
+
<div class={!isCollapsed ? "group-hover:rotate-[20deg]" : "group-hover:-rotate-[20deg]"} />
|
| 13 |
+
<div class={!isCollapsed ? "group-hover:-rotate-[20deg]" : "group-hover:rotate-[20deg]"} />
|
| 14 |
+
</button>
|
src/lib/components/chat/ChatMessage.svelte
CHANGED
|
@@ -111,7 +111,7 @@
|
|
| 111 |
if (contentEl) {
|
| 112 |
loadingEl = new IconLoading({
|
| 113 |
target: deepestChild(contentEl),
|
| 114 |
-
props: { classNames: "loading inline ml-2" },
|
| 115 |
});
|
| 116 |
}
|
| 117 |
}, 600);
|
|
|
|
| 111 |
if (contentEl) {
|
| 112 |
loadingEl = new IconLoading({
|
| 113 |
target: deepestChild(contentEl),
|
| 114 |
+
props: { classNames: "loading inline ml-2 first:ml-0" },
|
| 115 |
});
|
| 116 |
}
|
| 117 |
}, 600);
|
src/routes/+layout.svelte
CHANGED
|
@@ -1,31 +1,37 @@
|
|
| 1 |
<script lang="ts">
|
|
|
|
|
|
|
| 2 |
import { onDestroy } from "svelte";
|
| 3 |
import { goto, invalidate } from "$app/navigation";
|
| 4 |
-
import { page } from "$app/stores";
|
| 5 |
-
import "../styles/main.css";
|
| 6 |
import { base } from "$app/paths";
|
|
|
|
|
|
|
|
|
|
| 7 |
import {
|
| 8 |
PUBLIC_APP_DESCRIPTION,
|
| 9 |
PUBLIC_ORIGIN,
|
| 10 |
PUBLIC_PLAUSIBLE_SCRIPT_URL,
|
| 11 |
} from "$env/static/public";
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
import { shareConversation } from "$lib/shareConversation";
|
| 14 |
import { UrlDependency } from "$lib/types/UrlDependency";
|
| 15 |
-
import { error } from "$lib/stores/errors";
|
| 16 |
|
| 17 |
-
import MobileNav from "$lib/components/MobileNav.svelte";
|
| 18 |
-
import NavMenu from "$lib/components/NavMenu.svelte";
|
| 19 |
import Toast from "$lib/components/Toast.svelte";
|
| 20 |
-
import
|
|
|
|
| 21 |
import titleUpdate from "$lib/stores/titleUpdate";
|
| 22 |
-
import { createSettingsStore } from "$lib/stores/settings";
|
| 23 |
-
import { browser } from "$app/environment";
|
| 24 |
import DisclaimerModal from "$lib/components/DisclaimerModal.svelte";
|
|
|
|
| 25 |
|
| 26 |
export let data;
|
| 27 |
|
| 28 |
let isNavOpen = false;
|
|
|
|
|
|
|
| 29 |
let errorToastTimeout: ReturnType<typeof setTimeout>;
|
| 30 |
let currentError: string | null;
|
| 31 |
|
|
@@ -176,8 +182,18 @@
|
|
| 176 |
<DisclaimerModal />
|
| 177 |
{/if}
|
| 178 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 179 |
<div
|
| 180 |
-
class="grid h-full w-screen grid-cols-1 grid-rows-[auto,1fr] overflow-hidden text-smd
|
|
|
|
|
|
|
| 181 |
>
|
| 182 |
<MobileNav isOpen={isNavOpen} on:toggle={(ev) => (isNavOpen = ev.detail)} title={mobileNavTitle}>
|
| 183 |
<NavMenu
|
|
@@ -189,7 +205,9 @@
|
|
| 189 |
on:editConversationTitle={(ev) => editConversationTitle(ev.detail.id, ev.detail.title)}
|
| 190 |
/>
|
| 191 |
</MobileNav>
|
| 192 |
-
<nav
|
|
|
|
|
|
|
| 193 |
<NavMenu
|
| 194 |
conversations={data.conversations}
|
| 195 |
user={data.user}
|
|
|
|
| 1 |
<script lang="ts">
|
| 2 |
+
import "../styles/main.css";
|
| 3 |
+
|
| 4 |
import { onDestroy } from "svelte";
|
| 5 |
import { goto, invalidate } from "$app/navigation";
|
|
|
|
|
|
|
| 6 |
import { base } from "$app/paths";
|
| 7 |
+
import { page } from "$app/stores";
|
| 8 |
+
import { browser } from "$app/environment";
|
| 9 |
+
|
| 10 |
import {
|
| 11 |
PUBLIC_APP_DESCRIPTION,
|
| 12 |
PUBLIC_ORIGIN,
|
| 13 |
PUBLIC_PLAUSIBLE_SCRIPT_URL,
|
| 14 |
} from "$env/static/public";
|
| 15 |
+
import { PUBLIC_APP_ASSETS, PUBLIC_APP_NAME } from "$env/static/public";
|
| 16 |
+
|
| 17 |
+
import { error } from "$lib/stores/errors";
|
| 18 |
+
import { createSettingsStore } from "$lib/stores/settings";
|
| 19 |
|
| 20 |
import { shareConversation } from "$lib/shareConversation";
|
| 21 |
import { UrlDependency } from "$lib/types/UrlDependency";
|
|
|
|
| 22 |
|
|
|
|
|
|
|
| 23 |
import Toast from "$lib/components/Toast.svelte";
|
| 24 |
+
import NavMenu from "$lib/components/NavMenu.svelte";
|
| 25 |
+
import MobileNav from "$lib/components/MobileNav.svelte";
|
| 26 |
import titleUpdate from "$lib/stores/titleUpdate";
|
|
|
|
|
|
|
| 27 |
import DisclaimerModal from "$lib/components/DisclaimerModal.svelte";
|
| 28 |
+
import ExpandNavigation from "$lib/components/ExpandNavigation.svelte";
|
| 29 |
|
| 30 |
export let data;
|
| 31 |
|
| 32 |
let isNavOpen = false;
|
| 33 |
+
let isNavCollapsed = false;
|
| 34 |
+
|
| 35 |
let errorToastTimeout: ReturnType<typeof setTimeout>;
|
| 36 |
let currentError: string | null;
|
| 37 |
|
|
|
|
| 182 |
<DisclaimerModal />
|
| 183 |
{/if}
|
| 184 |
|
| 185 |
+
<ExpandNavigation
|
| 186 |
+
isCollapsed={isNavCollapsed}
|
| 187 |
+
on:click={() => (isNavCollapsed = !isNavCollapsed)}
|
| 188 |
+
classNames="absolute inset-y-0 z-10 my-auto {!isNavCollapsed
|
| 189 |
+
? 'left-[280px]'
|
| 190 |
+
: 'left-0'} *:transition-transform"
|
| 191 |
+
/>
|
| 192 |
+
|
| 193 |
<div
|
| 194 |
+
class="grid h-full w-screen grid-cols-1 grid-rows-[auto,1fr] overflow-hidden text-smd {!isNavCollapsed
|
| 195 |
+
? 'md:grid-cols-[280px,1fr]'
|
| 196 |
+
: 'md:grid-cols-[0px,1fr]'} transition-[300ms] [transition-property:grid-template-columns] md:grid-rows-[1fr] dark:text-gray-300"
|
| 197 |
>
|
| 198 |
<MobileNav isOpen={isNavOpen} on:toggle={(ev) => (isNavOpen = ev.detail)} title={mobileNavTitle}>
|
| 199 |
<NavMenu
|
|
|
|
| 205 |
on:editConversationTitle={(ev) => editConversationTitle(ev.detail.id, ev.detail.title)}
|
| 206 |
/>
|
| 207 |
</MobileNav>
|
| 208 |
+
<nav
|
| 209 |
+
class=" grid max-h-screen grid-cols-1 grid-rows-[auto,1fr,auto] overflow-hidden *:w-[280px] max-md:hidden"
|
| 210 |
+
>
|
| 211 |
<NavMenu
|
| 212 |
conversations={data.conversations}
|
| 213 |
user={data.user}
|
src/routes/settings/+layout.svelte
CHANGED
|
@@ -33,7 +33,7 @@
|
|
| 33 |
</script>
|
| 34 |
|
| 35 |
<div
|
| 36 |
-
class="fixed inset-0 flex items-center justify-center bg-black/80 backdrop-blur-sm dark:bg-black/50"
|
| 37 |
in:fade
|
| 38 |
>
|
| 39 |
<dialog
|
|
@@ -42,7 +42,7 @@
|
|
| 42 |
use:clickOutside={() => {
|
| 43 |
goto(previousPage);
|
| 44 |
}}
|
| 45 |
-
class="
|
| 46 |
>
|
| 47 |
<div class="col-span-1 mb-4 flex items-center justify-between md:col-span-3">
|
| 48 |
<h2 class="text-xl font-bold">Settings</h2>
|
|
|
|
| 33 |
</script>
|
| 34 |
|
| 35 |
<div
|
| 36 |
+
class="fixed inset-0 z-20 flex items-center justify-center bg-black/80 backdrop-blur-sm dark:bg-black/50"
|
| 37 |
in:fade
|
| 38 |
>
|
| 39 |
<dialog
|
|
|
|
| 42 |
use:clickOutside={() => {
|
| 43 |
goto(previousPage);
|
| 44 |
}}
|
| 45 |
+
class="grid h-[95dvh] w-[90dvw] grid-cols-1 content-start gap-x-8 overflow-hidden rounded-2xl bg-white p-4 shadow-2xl outline-none sm:h-[80dvh] md:grid-cols-3 md:grid-rows-[auto,1fr] md:p-8 xl:w-[1200px] 2xl:h-[70dvh]"
|
| 46 |
>
|
| 47 |
<div class="col-span-1 mb-4 flex items-center justify-between md:col-span-3">
|
| 48 |
<h2 class="text-xl font-bold">Settings</h2>
|