Add experimental switch in settings

Hide all read/write functionality behind this setting.
This commit is contained in:
Sebastian Martinez
2024-03-07 10:35:21 +01:00
parent 273dff2da4
commit 192524fe90
19 changed files with 296 additions and 137 deletions
+21 -18
View File
@@ -11,6 +11,7 @@
import NodeInfo from "@app/App/Header/NodeInfo.svelte";
import Popover from "@app/components/Popover.svelte";
import ConnectInstructions from "@app/components/ConnectInstructions.svelte";
import { experimental } from "@app/lib/appearance";
const buttonTitle: Record<HttpdState["state"], string> = {
stopped: "radicle-httpd is stopped",
@@ -60,24 +61,26 @@
</div>
<div class="right">
{#if $httpdStore.state === "stopped"}
<Popover popoverPositionTop="3rem" popoverPositionRight="0">
<Button
slot="toggle"
let:toggle
on:click={toggle}
title={buttonTitle[$httpdStore.state]}
variant="naked-toggle">
<IconSmall name="device" />
Connect
</Button>
<div slot="popover" class="connect-popover">
<ConnectInstructions />
</div>
</Popover>
{:else}
<NodeInfo node={$httpdStore.node} />
<Authenticate />
{#if $experimental}
{#if $httpdStore.state === "stopped"}
<Popover popoverPositionTop="3rem" popoverPositionRight="0">
<Button
slot="toggle"
let:toggle
on:click={toggle}
title={buttonTitle[$httpdStore.state]}
variant="naked-toggle">
<IconSmall name="device" />
Connect
</Button>
<div slot="popover" class="connect-popover">
<ConnectInstructions />
</div>
</Popover>
{:else}
<NodeInfo node={$httpdStore.node} />
<Authenticate />
{/if}
{/if}
</div>
</header>
+28 -1
View File
@@ -2,7 +2,9 @@
import {
codeFont,
codeFonts,
experimental,
storeCodeFont,
storeExperimental,
storeTheme,
theme,
} from "@app/lib/appearance";
@@ -14,7 +16,7 @@
<style>
.settings {
width: 18.5rem;
width: 24rem;
display: flex;
flex-direction: column;
align-items: center;
@@ -76,4 +78,29 @@
</Radio>
</div>
</div>
<div class="item">
<div
style="display: flex; flex-direction: row; align-items: center; gap: 0.5rem;">
Make changes on the web (experimental)
</div>
<div class="right">
<Radio>
<Button
styleBorderRadius="0"
on:click={() => storeExperimental(true)}
variant={$experimental ? "selected" : "not-selected"}>
On
</Button>
<div class="global-spacer" />
<Radio>
<Button
styleBorderRadius="0"
on:click={() => storeExperimental(undefined)}
variant={$experimental ? "not-selected" : "selected"}>
Off
</Button>
</Radio>
</Radio>
</div>
</div>
</div>