ui-svelte: make it easier to toggle panels in logs view
This commit is contained in:
@@ -12,47 +12,33 @@
|
|||||||
let direction = $derived<"horizontal" | "vertical">(
|
let direction = $derived<"horizontal" | "vertical">(
|
||||||
$screenWidth === "xs" || $screenWidth === "sm" ? "vertical" : "horizontal"
|
$screenWidth === "xs" || $screenWidth === "sm" ? "vertical" : "horizontal"
|
||||||
);
|
);
|
||||||
|
|
||||||
function cycleViewMode(): void {
|
|
||||||
const modes: ViewMode[] = ["panels", "proxy", "upstream"];
|
|
||||||
const currentIndex = modes.indexOf($viewModeStore);
|
|
||||||
const nextIndex = (currentIndex + 1) % modes.length;
|
|
||||||
viewModeStore.set(modes[nextIndex]);
|
|
||||||
}
|
|
||||||
|
|
||||||
function getViewModeIcon(mode: ViewMode): string {
|
|
||||||
switch (mode) {
|
|
||||||
case "proxy":
|
|
||||||
return "P";
|
|
||||||
case "upstream":
|
|
||||||
return "U";
|
|
||||||
case "panels":
|
|
||||||
return "⊞";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function getViewModeLabel(mode: ViewMode): string {
|
|
||||||
switch (mode) {
|
|
||||||
case "proxy":
|
|
||||||
return "Proxy";
|
|
||||||
case "upstream":
|
|
||||||
return "Upstream";
|
|
||||||
case "panels":
|
|
||||||
return "Panels";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="flex flex-col h-full w-full gap-2">
|
<div class="flex flex-col h-full w-full gap-2">
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex items-center gap-1">
|
||||||
<button
|
<button
|
||||||
onclick={cycleViewMode}
|
onclick={() => viewModeStore.set("panels")}
|
||||||
class="btn flex items-center gap-2 text-sm"
|
class:btn={true}
|
||||||
title="Toggle view mode"
|
class:bg-primary={$viewModeStore === "panels"}
|
||||||
aria-label="Toggle view mode: {getViewModeLabel($viewModeStore)}"
|
class:text-btn-primary-text={$viewModeStore === "panels"}
|
||||||
>
|
>
|
||||||
<span class="font-mono font-bold">{getViewModeIcon($viewModeStore)}</span>
|
Both
|
||||||
<span>{getViewModeLabel($viewModeStore)}</span>
|
</button>
|
||||||
|
<button
|
||||||
|
onclick={() => viewModeStore.set("proxy")}
|
||||||
|
class:btn={true}
|
||||||
|
class:bg-primary={$viewModeStore === "proxy"}
|
||||||
|
class:text-btn-primary-text={$viewModeStore === "proxy"}
|
||||||
|
>
|
||||||
|
Panel
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
onclick={() => viewModeStore.set("upstream")}
|
||||||
|
class:btn={true}
|
||||||
|
class:bg-primary={$viewModeStore === "upstream"}
|
||||||
|
class:text-btn-primary-text={$viewModeStore === "upstream"}
|
||||||
|
>
|
||||||
|
Upstream
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,10 @@ export default defineConfig({
|
|||||||
assetsDir: "assets",
|
assetsDir: "assets",
|
||||||
},
|
},
|
||||||
server: {
|
server: {
|
||||||
|
// yes very insecure but who's running this thing
|
||||||
|
// on the public internet for dev?! haha.
|
||||||
|
host: "0.0.0.0",
|
||||||
|
allowedHosts: true,
|
||||||
proxy: {
|
proxy: {
|
||||||
"/api": "http://localhost:8080", // Proxy API calls to Go backend during development
|
"/api": "http://localhost:8080", // Proxy API calls to Go backend during development
|
||||||
"/logs": "http://localhost:8080",
|
"/logs": "http://localhost:8080",
|
||||||
|
|||||||
Reference in New Issue
Block a user