Skip to content

Commit

Permalink
fix(ceremony): dont sub to contributions in layout
Browse files Browse the repository at this point in the history
  • Loading branch information
Swepool committed Oct 30, 2024
1 parent 0b38c5c commit 47c12e6
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 30 deletions.
58 changes: 31 additions & 27 deletions ceremony/src/lib/components/Terminal/Contributors.svelte
Original file line number Diff line number Diff line change
@@ -1,34 +1,38 @@
<script lang="ts">
import { getState } from "$lib/state/index.svelte.ts"
import { goto } from "$app/navigation"
import { onMount } from "svelte"
import Buttons from "$lib/components/Terminal/Install/Buttons.svelte"
import type { Contributions } from "$lib/state/contributions.svelte.ts"
import type { Terminal } from "$lib/state/terminal.svelte.ts"
import {goto} from "$app/navigation"
import {onMount, onDestroy} from "svelte"
import Buttons from "$lib/components/Terminal/Install/Buttons.svelte"
import {Contributions} from "$lib/state/contributions.svelte.ts"
import {getState} from "$lib/state/index.svelte.ts";
type State = {
contributions: Contributions
terminal: Terminal
}
const { terminal } = getState()
const { contributions, terminal }: State = getState()
let contributions: Contributions | null = null;
let data: Array<{ text: string; action: string }> = $state([]);
let focusedIndex = $state(0)
let buttons: Array<HTMLButtonElement> = []
let data = $state([])
onMount(() => {
contributions.data.map(contribution => {
data.push({ text: contribution.payload_id, action: contribution.public_key_hash })
onMount(async () => {
contributions = new Contributions();
});
onDestroy(() => {
if (contributions) {
contributions = null;
}
});
$effect(() => {
if (contributions) {
data = contributions.data.map(contribution => ({
text: contribution.payload_id,
action: contribution.public_key_hash
}));
}
})
})
function trigger(value: any) {
goto(`/contributions/${value}`)
terminal.setTab(4)
terminal.setHash(value)
}
function trigger(value: string) {
goto(`/contributions/${value}`);
terminal.setTab(4);
terminal.setHash(value);
}
</script>
<Buttons
{data}
trigger={(value) => trigger(value)}
/>
<Buttons {data} trigger={(value) => trigger(value)}/>
3 changes: 0 additions & 3 deletions ceremony/src/lib/state/index.svelte.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@ import { getContext, setContext } from "svelte"
import { Contributor } from "./contributor.svelte.ts"
import { Terminal } from "./terminal.svelte.ts"
import { user, type UserSession } from "$lib/state/session.svelte.ts"
import { Contributions } from "$lib/state/contributions.svelte.ts"

export interface AppState {
contributor: Contributor
terminal: Terminal
contributions: Contributions
user: UserSession
}

Expand All @@ -18,7 +16,6 @@ export function createState() {
const state: AppState = {
contributor: new Contributor(),
terminal: new Terminal(),
contributions: new Contributions(),
user: user
}

Expand Down

0 comments on commit 47c12e6

Please sign in to comment.