From 29cf83a578c25b0ccca271337f8bfb3586e2fc8b Mon Sep 17 00:00:00 2001 From: b1ek Date: Sat, 26 Aug 2023 11:49:10 +1000 Subject: [PATCH] move back button to sidebar --- src/page/Explore/Explore.svelte | 14 -------------- src/store/RouteStore.ts | 3 ++- src/widget/Sidebar/Sidebar.svelte | 8 +++++++- src/widget/Sidebar/style.module.scss | 11 ++++++++++- 4 files changed, 19 insertions(+), 17 deletions(-) diff --git a/src/page/Explore/Explore.svelte b/src/page/Explore/Explore.svelte index cfc1114..639e417 100644 --- a/src/page/Explore/Explore.svelte +++ b/src/page/Explore/Explore.svelte @@ -2,9 +2,6 @@ import style from './style.module.scss'; import Jumper from 'svelte-loading-spinners/Jumper.svelte'; - import Icon from 'svelte-icons-pack/Icon.svelte'; - import VscArrowLeft from "svelte-icons-pack/vsc/VscArrowLeft"; - import { invoke } from '@tauri-apps/api/tauri'; import { back } from '../../store/RouteStore'; @@ -39,12 +36,6 @@
-

- -

-

Homeservers

@@ -89,11 +80,6 @@ {#each list as server} -

{server.name}

diff --git a/src/store/RouteStore.ts b/src/store/RouteStore.ts index 6f5d899..f179c4b 100644 --- a/src/store/RouteStore.ts +++ b/src/store/RouteStore.ts @@ -40,7 +40,8 @@ export function route(path) { export function back() { const history: string[] = store.getState().history; - console.log(history[history.length - 2]); + if (history[history.length - 2] == '/load') return + store.dispatch({ type: 'setPath', path: history[history.length - 2] }); store.dispatch({ type: 'popHistory' }); } \ No newline at end of file diff --git a/src/widget/Sidebar/Sidebar.svelte b/src/widget/Sidebar/Sidebar.svelte index cb9c09b..69e099e 100644 --- a/src/widget/Sidebar/Sidebar.svelte +++ b/src/widget/Sidebar/Sidebar.svelte @@ -3,11 +3,17 @@ import Icon from 'svelte-icons-pack/Icon.svelte'; import VscHome from 'svelte-icons-pack/vsc/VscHome'; + import VscArrowLeft from "svelte-icons-pack/vsc/VscArrowLeft"; import BsGearFill from 'svelte-icons-pack/bs/BsGearFill'; - import { route } from '../../store/RouteStore'; + import { route, back } from '../../store/RouteStore';
+ + + diff --git a/src/widget/Sidebar/style.module.scss b/src/widget/Sidebar/style.module.scss index ec8d991..7309588 100644 --- a/src/widget/Sidebar/style.module.scss +++ b/src/widget/Sidebar/style.module.scss @@ -22,6 +22,7 @@ width: calc(var(--sidebar-width) - (var(--sidebar-button-margin) * 2)); height: calc(var(--sidebar-width) - (var(--sidebar-button-margin) * 2)); margin: var(--sidebar-button-margin); + margin-bottom: 0; border: 3px solid #272222; &:hover { @@ -42,8 +43,16 @@ width: var(--sidebar-button-icon-size); } } + .back { + height: fit-content !important; + border-width: 1px; + padding: calc(var(--sidebar-button-margin) / 2); + svg { + transform: translate(0, 1px); + } + } .bottom { position: absolute; - bottom: 0; + bottom: var(--sidebar-button-margin); } } \ No newline at end of file