<script lang="ts">
  import { goto } from "$app/navigation";
  import Button from "$lib/components/Button.svelte";
  import LightningSettings from "$lib/components/LightningSettings.svelte";
  import NostrWalletConnect from "$lib/components/NostrWalletConnect.svelte";
  import DangerZone from "$lib/components/DangerZone.svelte";
  import { shaderEnabled } from "$lib/settings.svelte";
  import ToggleSwitch from "$lib/components/ToggleSwitch.svelte";

  function goBack() {
    goto("/");
  }
</script>

<div class="container">
  <div class="retro-card">
    <div class="header">
      <h1>Settings</h1>
      <Button onclick={goBack}>Back</Button>
    </div>
  </div>

  <LightningSettings />

  <NostrWalletConnect />

  <details class="retro-card" open>
    <summary class="header">
      <h2>Design</h2>
    </summary>
    <ToggleSwitch label="Shader" bind:checked={$shaderEnabled} />
  </details>

  <div class="retro-card">
    <h2>Source Code</h2>
    <Button
      variant="secondary"
      onclick={() => {
        window.open("https://git.arx-ccn.com/Arx/PortalBTC", "_blank");
      }}
    >
      View on Git
    </Button>
  </div>

  <DangerZone />
</div>

<style>
  .container {
    width: 100%;
    max-width: 32rem;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 1.5rem;
  }

  .header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
  }

  h1 {
    margin: 0;
    font-size: 1.2rem;
  }
</style>
