Skip to content

Commit

Permalink
fix(ceremony): start event (#3031)
Browse files Browse the repository at this point in the history
  • Loading branch information
cor authored Sep 27, 2024
2 parents 5278188 + 5a2f6fc commit 3e6ccaa
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 22 deletions.
3 changes: 1 addition & 2 deletions ceremony/src/lib/components/Terminal/Timer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
38 changes: 19 additions & 19 deletions ceremony/src/lib/components/Terminal/index.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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 = () => {
Expand Down
6 changes: 5 additions & 1 deletion ceremony/src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ $effect(() => {
})
$effect(() => {
if (contributor.contributionState === "contribute" && contributor.state !== "contributing") {
if (
contributor.contributionState === "contribute" &&
contributor.state !== "contributing" &&
contributor.downloadedSecret
) {
start()
}
})
Expand Down

0 comments on commit 3e6ccaa

Please sign in to comment.