Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
980a6ce
fix: typo in server `package.json` main url (mjs)
AlexRodwell Aug 24, 2024
afa6688
feat: add better type checking with netrunnerDB API response
AlexRodwell Aug 24, 2024
212d157
chore: update netrunnerdb api to use production endpoint
AlexRodwell Aug 24, 2024
da59b16
misc: formatting in `<Search />` component
AlexRodwell Aug 24, 2024
5a0fa75
misc: formatting
AlexRodwell Aug 24, 2024
2bcdd71
refactor: remove redundant `console.log`'s
AlexRodwell Aug 24, 2024
c7172fc
style: improve wording/iconography of Connection component (websocket…
AlexRodwell Aug 25, 2024
9b3d1b4
chore: remove title attribute from card component
AlexRodwell Aug 25, 2024
5bce5a5
Fix manual deployment logic
AlexRodwell Aug 25, 2024
b51d1a6
style: remove grid cols from button component, unnecessary, and cause…
AlexRodwell Aug 25, 2024
dd8db7d
fix: correct dashboad header to use reactive variable for update func…
AlexRodwell Aug 25, 2024
20c5942
misc: add i18n for 'ID' and set max character length of name and pron…
AlexRodwell Aug 25, 2024
045f0b9
chore: clean up `+layout` console logs/formatting slightly
AlexRodwell Aug 25, 2024
d876125
refactor!: dashboard `deploy_data` logic to better handle errors
AlexRodwell Aug 25, 2024
780d2f8
style: general improvements to individual overlay elements/components…
AlexRodwell Aug 25, 2024
79f42a1
refactor: remove animated svg from timer component
AlexRodwell Aug 25, 2024
623a3c1
fix: default country selection value
AlexRodwell Aug 25, 2024
21f6bd1
fix: default win counter to 0 (stored as string)
AlexRodwell Aug 25, 2024
bcfafbe
refactor: remove unused play exported property from `<SearchIdentity>…
AlexRodwell Aug 25, 2024
c7eb3f5
refactor: remove unused imports
AlexRodwell Aug 25, 2024
1d15070
refactor: move all NSG icons to `static/` directory, instead of `lib/…
AlexRodwell Aug 25, 2024
a7a7230
feat: setup basic test to increment agendas
AlexRodwell Aug 25, 2024
1b3aa3a
style: improve console log/info/warning/error styling for easier debu…
AlexRodwell Aug 25, 2024
a8b9608
feat: if primary card is disabled (toggled off), disable the secondar…
AlexRodwell Aug 25, 2024
fb05a17
refactor: remove unused types
AlexRodwell Aug 25, 2024
92c787c
style: ensure cards animate/transition as expected after previous bre…
AlexRodwell Aug 25, 2024
f6dd574
feat: disable secondary card switch/toggle if primary is not true/active
AlexRodwell Aug 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions dashboard/src/lib/components/Card.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,21 @@

$: back = side === "corp" ? BACK_CORPORATION : BACK_RUNNER;

$: url = code ? `https://card-images.netrunnerdb.com/v1/large/{code}.jpg`.replace("{code}", code) : false;
$: url = code
? `https://card-images.netrunnerdb.com/v1/large/{code}.jpg`.replace(
"{code}",
code,
)
: false;
</script>

<div
class="aspect-[64/89] [transform-style:preserve-3d] flex transition-transform [transform:var(--transform)] {glow
? 'card--glow'
: ''} {$$props['class']}"
style="transform: {flip ? 'rotateY(-180deg)' : 'rotateY(0deg)' }; transition-duration: 480ms; transition-delay: var(--transition-delay, 0ms);"
style="transform: {flip
? 'rotateY(-180deg)'
: 'rotateY(0deg)'}; transition-duration: 480ms; transition-delay: var(--transition-delay, 0ms);"
>
<div
class="face {glow
Expand Down
19 changes: 14 additions & 5 deletions dashboard/src/lib/components/dashboard/Connection.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,26 @@
import { PUBLIC_WEBSOCKET_CONNECTION } from "$env/static/public";
import { globalData } from "$lib/store";
import Loading from "$components/Loading.svelte";
import { Button } from "$lib/components/ui/button";
import { Check } from "lucide-svelte";

$: connection = $globalData.websocket.status;
</script>

{#if PUBLIC_WEBSOCKET_CONNECTION.toLowerCase() === "true"}
<p class="flex flex-row gap-2 items-center">
<Button
variant="outline"
class="flex flex-row gap-2 items-center {connection
? 'bg-green-500/10 border-green-500 hover:bg-transparent cursor-default'
: 'bg-red-500/10 border-red-500'}"
disabled={!connection}
>
{#if connection}
Connected to websocket
<Check slot="icon-before" size={16} class="mt-0.5" />
WebSocket Connected
{:else}
<Loading size={1.5} />
Connecting to websocket
<Loading slot="icon-before" size={0.75} />
Connecting
{/if}
</p>
</Button>
{/if}
1 change: 0 additions & 1 deletion dashboard/src/lib/components/dashboard/Counter.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import { createEventDispatcher } from "svelte";
import { Button } from "$lib/components/ui/button";
import { Input } from "$lib/components/ui/input";
import { Label } from "$lib/components/ui/label";

const dispatch = createEventDispatcher();

Expand Down
7 changes: 4 additions & 3 deletions dashboard/src/lib/components/dashboard/Country.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
let open = false;
let value = "";

$: selected =
JSON_COUNTRIES.find((f: any) => f.alpha2 === value) ??
"Select a country";
$: selected = JSON_COUNTRIES.find((f: any) => f.alpha2 === value) ?? {
name: "Select a country",
alpha2: "",
};

// We want to refocus the trigger button when the user selects
// an item from the list so users can continue navigating the
Expand Down
73 changes: 37 additions & 36 deletions dashboard/src/lib/components/dashboard/GlobalSettings.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,11 @@
import { createEventDispatcher } from "svelte";
import Card from "$components/dashboard/ui/Card.svelte";
import { globalData, deploy } from "$lib/store";
import Heading from "$components/dashboard/ui/Heading.svelte";
import * as Dialog from "$lib/components/ui/dialog";

// Icons
import ICON_CLICKS from "$lib/assets/icons/NSG_CLICK.svg";
import ICON_CREDITS from "$lib/assets/icons/NSG_CREDIT.svg";
import ICON_AGENDAS from "$lib/assets/icons/NSG_AGENDA.svg";
import { Settings } from "lucide-svelte";
import { Button, buttonVariants } from "$lib/components/ui/button";
import { buttonVariants } from "$lib/components/ui/button";
import Column from "./ui/Column.svelte";
import { Label } from "$lib/components/ui/label";
import { Switch } from "$lib/components/ui/switch";
Expand All @@ -19,15 +15,14 @@
import type { GlobalData as TGlobalData } from "$lib/types";
import { Slider } from "$lib/components/ui/slider";
import { Input } from "$lib/components/ui/input";
import * as Select from "$lib/components/ui/select";

let global: TGlobalData = $globalData;
let deployType: boolean = $deploy.type !== "automatic";

const icons: Record<string, string> = {
clicks: ICON_CLICKS,
credits: ICON_CREDITS,
agendas: ICON_AGENDAS,
clicks: "/NSG_CLICK.svg",
credits: "/NSG_CREDIT.svg",
agendas: "/NSG_AGENDA.svg",
};

const dispatch = createEventDispatcher();
Expand All @@ -43,32 +38,39 @@
<Dialog.Title>{$t("global_settings")}</Dialog.Title>
</Dialog.Header>
<div>
<Card title="Deploy method" outline={false} uid="display">
<Column columns={3}>
<Column span="1/-1">
<CardNew.Root>
<CardNew.Header>Deployment type</CardNew.Header>
<CardNew.Content class="switch-group">
<Switch
id="deploy-type"
bind:checked={deployType}
on:click={(event) => {
$deploy.type = deployType
? "automatic"
: "manual";
$deploy.proceed =
$deploy.type === "automatic";
}}
/>
<Label for="deploy-type">
{$deploy.type === "manual"
? "Manual"
: "Automatic (instant)"}
</Label>
</CardNew.Content>
</CardNew.Root>
</Column>
<Card outline={false} uid="display">
<Column>
<CardNew.Root>
<CardNew.Header>Deployment type</CardNew.Header>
<CardNew.Content class="switch-group">
<Switch
id="deploy-type"
bind:checked={deployType}
on:click={(event) => {
$deploy.type = deployType
? "automatic"
: "manual";
$deploy.proceed =
$deploy.type === "automatic";
}}
/>
<Label for="deploy-type">
{$deploy.type === "manual"
? "Manual"
: "Automatic (instant)"}
</Label>
</CardNew.Content>
</CardNew.Root>
</Column>
</Card>
</div>

<Dialog.Header>
<Dialog.Title>{$t("global_settings")}</Dialog.Title>
</Dialog.Header>
<div>
<Card>
<Column columns={3}>
<!-- <Column span="1/-1">
<CardNew.Root>
<CardNew.Header
Expand Down Expand Up @@ -146,7 +148,7 @@
</CardNew.Header>
</CardNew.Root>

<CardNew.Root>
<CardNew.Root class="col-[auto/span_2]">
<CardNew.Header class="switch-group justify-between">
<Label for="commentators">Commentators</Label>
</CardNew.Header>
Expand Down Expand Up @@ -188,7 +190,6 @@
</Select.Root>
</CardNew.Content>
</CardNew.Root> -->

</Column>
</Card>
</div>
Expand Down
18 changes: 10 additions & 8 deletions dashboard/src/lib/components/dashboard/Header.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<script lang="ts">
import { onMount } from "svelte";
import Preview from "$components/dashboard/Preview.svelte";
import ResetState from "$components/dashboard/ResetState.svelte";
import FlipPlayers from "$components/dashboard/FlipPlayers.svelte";
Expand All @@ -24,6 +23,7 @@
import { Button } from "$lib/components/ui/button";

export let update: Function;
export let deploy_data: Function;

let global: TGlobalData = $globalData;
let timer: TTimerData = $timerData;
Expand Down Expand Up @@ -153,30 +153,32 @@
</Actions>
<Actions>
<Connection />

{#if $deploy.type === "manual"}
<Button
variant="default"
disabled={!$deploy.proceed}
on:click={() => {
$deploy.proceed = true;
update({
type: "global",
data: global,
data: $globalData,
});
update({
type: "timer",
data: timer,
data: $timerData,
});
update({
type: "playerOne",
data: playerOneData,
data: $playerOneData,
});
update({
type: "playerTwo",
data: playerTwoData,
data: $playerTwoData,
});
}}>Deploy</Button
deploy_data();
}}
>
{$deploy.proceed ? "Deploy" : "Waiting for changes"}
</Button>
{/if}
</Actions>
</header>
Expand Down
Loading