mirror of
https://github.com/morgan9e/chatgpt-web
synced 2026-04-14 00:14:04 +09:00
Added hash-based routing using svelte-spa-router
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
<script lang="ts">
|
||||
import Router, {location} from 'svelte-spa-router';
|
||||
import routes from "./routes";
|
||||
|
||||
import Navbar from "./lib/Navbar.svelte";
|
||||
import Sidebar from "./lib/Sidebar.svelte";
|
||||
import Home from "./lib/Home.svelte";
|
||||
@@ -15,8 +18,6 @@
|
||||
if (urlParams.has("key")) {
|
||||
apiKeyStorage.set(urlParams.get("key")!);
|
||||
}
|
||||
|
||||
let activeChatId: number;
|
||||
</script>
|
||||
|
||||
<Navbar />
|
||||
@@ -25,14 +26,12 @@
|
||||
<div class="container is-fullhd">
|
||||
<div class="columns">
|
||||
<div class="column is-one-fifth">
|
||||
<Sidebar bind:apiKey bind:sortedChats bind:activeChatId />
|
||||
<Sidebar bind:apiKey bind:sortedChats />
|
||||
</div>
|
||||
<div class="column is-four-fifths">
|
||||
{#if activeChatId}
|
||||
<Chat bind:chatId={activeChatId} />
|
||||
{:else}
|
||||
<Home bind:activeChatId />
|
||||
{/if}
|
||||
{#key $location}
|
||||
<Router {routes}/>
|
||||
{/key}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user