-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: reimplemented routing based on pages
- Loading branch information
Thomas Junk
committed
Oct 5, 2023
1 parent
c3108c7
commit 2c77d70
Showing
9 changed files
with
130 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<script lang="ts"> | ||
import "chota/dist/chota.min.css"; | ||
import "boxicons/css/boxicons.min.css"; | ||
import { appStore } from "$lib/store"; | ||
/*global __APP_VERSION__*/ | ||
const version: string = __APP_VERSION__; | ||
const MODE = { | ||
SINGLE: "Switch to ROLIE-feed", | ||
FEED: "Switch to single view" | ||
}; | ||
$: mode = $appStore.ui.appMode; | ||
$: switchToRoute = mode === MODE.SINGLE ? "/feed" : "/"; | ||
const disable = (e: Event) => { | ||
e.preventDefault(); | ||
}; | ||
</script> | ||
|
||
<svelte:window on:dragover={disable} on:drop={disable} /> | ||
|
||
<div class="content"> | ||
<!-- svelte-ignore a11y-no-redundant-roles --> | ||
<div class="header"> | ||
<h1 role="heading" class="text-center">CSAF Webview+</h1> | ||
<a href={switchToRoute} class="switchbutton button">{mode}</a> | ||
<h4>v. {version}</h4> | ||
</div> | ||
<slot /> | ||
</div> | ||
|
||
<style> | ||
.switchbutton { | ||
box-shadow: 1px 3px 3px #c1c1c1; | ||
} | ||
.header > h1 { | ||
font-weight: bold; | ||
} | ||
.content { | ||
margin-left: 3rem; | ||
margin-right: 3rem; | ||
} | ||
.header { | ||
display: flex; | ||
align-items: center; | ||
justify-content: space-between; | ||
} | ||
.switchbutton { | ||
position: relative; | ||
left: -90px; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<script lang="ts"> | ||
import FeedView from "$lib/feedview/FeedView.svelte"; | ||
import { onMount } from "svelte"; | ||
import { appStore } from "$lib/store"; | ||
import { page } from "$app/stores"; | ||
import { loadFeed, loadProviderMetaData } from "$lib/urlloader"; | ||
$: if (/^\?q=/.test($page.url.search)) { | ||
const url = $page.url.search.replace("?q=", ""); | ||
if (/provider-metadata\.json/.test(url)) { | ||
loadProviderMetaData(url); | ||
} else { | ||
loadFeed(url); | ||
} | ||
} else { | ||
appStore.setCurrentFeed(null); | ||
appStore.setProviderMetadata(null); | ||
} | ||
appStore.setFeedMode(); | ||
onMount(() => { | ||
if (/^\?q=/.test($page.url.search)) { | ||
const url = $page.url.search.replace("?q=", ""); | ||
if (/provider-metadata\.json/.test(url)) { | ||
loadProviderMetaData(url); | ||
} else { | ||
loadFeed(url); | ||
} | ||
} else { | ||
appStore.setCurrentFeed(null); | ||
appStore.setProviderMetadata(null); | ||
} | ||
appStore.setFeedMode(); | ||
}); | ||
</script> | ||
|
||
<FeedView /> |