From 5a2f6fc2c7d3170d19e6f896f7c432ecc048f893 Mon Sep 17 00:00:00 2001 From: Lukas Date: Fri, 27 Sep 2024 03:15:48 +0200 Subject: [PATCH] fix(ceremony): start event --- .../src/lib/components/Terminal/Timer.svelte | 3 +- .../src/lib/components/Terminal/index.svelte | 38 +++++++++---------- ceremony/src/routes/+layout.svelte | 6 ++- 3 files changed, 25 insertions(+), 22 deletions(-) diff --git a/ceremony/src/lib/components/Terminal/Timer.svelte b/ceremony/src/lib/components/Terminal/Timer.svelte index a350ed7b86..4d7227e646 100644 --- a/ceremony/src/lib/components/Terminal/Timer.svelte +++ b/ceremony/src/lib/components/Terminal/Timer.svelte @@ -15,8 +15,7 @@ async function fetchData() { try { const time = await getAverageTimes() const queueLength = contributor.queueState.count - averageTimeSeconds = Math.round((time.totalMs / 1000) * (queueLength ?? 137)) - console.log("xx Average time:", formatTime(averageTimeSeconds)) + averageTimeSeconds = Math.round((time.totalMs / 1000) * queueLength ?? 0) } catch (error) { console.error("Error fetching data:", error) } diff --git a/ceremony/src/lib/components/Terminal/index.svelte b/ceremony/src/lib/components/Terminal/index.svelte index 9ed05010a9..cee1c51246 100644 --- a/ceremony/src/lib/components/Terminal/index.svelte +++ b/ceremony/src/lib/components/Terminal/index.svelte @@ -24,25 +24,25 @@ const changeTab = async (tab: number) => { } } -const unsubscribe = terminal.keys.subscribe(event => { - if (event) { - if (event.type === "keydown" && (event.shiftKey || event.ctrlKey)) { - if (event.key === "!") { - changeTab(1) - } else if (event.key === "@") { - changeTab(2) - } else if (event.key === "#") { - changeTab(3) - } else if (event.key === "$") { - changeTab(4) - } else if (event.key === "X") { - logout(terminal) - } - } - } -}) - -onDestroy(unsubscribe) +// const unsubscribe = terminal.keys.subscribe(event => { +// if (event) { +// if (event.type === "keydown" && (event.shiftKey || event.ctrlKey)) { +// if (event.key === "!") { +// changeTab(1) +// } else if (event.key === "@") { +// changeTab(2) +// } else if (event.key === "#") { +// changeTab(3) +// } else if (event.key === "$") { +// changeTab(4) +// } else if (event.key === "X") { +// logout(terminal) +// } +// } +// } +// }) +// +// onDestroy(unsubscribe) function autoScroll(node: HTMLElement) { const scroll = () => { diff --git a/ceremony/src/routes/+layout.svelte b/ceremony/src/routes/+layout.svelte index d39dd61c96..e072dd69e0 100644 --- a/ceremony/src/routes/+layout.svelte +++ b/ceremony/src/routes/+layout.svelte @@ -27,7 +27,11 @@ $effect(() => { }) $effect(() => { - if (contributor.contributionState === "contribute" && contributor.state !== "contributing") { + if ( + contributor.contributionState === "contribute" && + contributor.state !== "contributing" && + contributor.downloadedSecret + ) { start() } })