diff --git a/frontend/src/lib/components/launchpad/ProjectCardSwapInfo.svelte b/frontend/src/lib/components/launchpad/ProjectCardSwapInfo.svelte index ac527742e27..8d0a7f0d54a 100644 --- a/frontend/src/lib/components/launchpad/ProjectCardSwapInfo.svelte +++ b/frontend/src/lib/components/launchpad/ProjectCardSwapInfo.svelte @@ -3,11 +3,8 @@ import ProjectUserCommitmentLabel from "$lib/components/project-detail/ProjectUserCommitmentLabel.svelte"; import type { SnsFullProject } from "$lib/derived/sns/sns-projects.derived"; import { i18n } from "$lib/stores/i18n"; - import type { - SnsSummary, - SnsSwapCommitment, - SnsSummarySwap, - } from "$lib/types/sns"; + import type { SnsSummarySwap, SnsSwapCommitment } from "$lib/types/sns"; + import type { SnsSummaryWrapper } from "$lib/types/sns-summary-wrapper"; import { durationTillSwapDeadline, durationTillSwapStart, @@ -23,7 +20,7 @@ // The data to know whether it's finalizing or not is not in the SnsFullProject. export let isFinalizing: boolean; - let summary: SnsSummary; + let summary: SnsSummaryWrapper; let swapCommitment: SnsSwapCommitment | undefined; $: ({ summary, swapCommitment } = project); @@ -31,9 +28,7 @@ $: ({ swap } = summary); let lifecycle: number; - $: ({ - swap: { lifecycle }, - } = summary); + $: lifecycle = summary.getLifecycle(); let durationTillDeadline: bigint | undefined; $: durationTillDeadline = durationTillSwapDeadline(swap); diff --git a/frontend/src/lib/components/project-detail/ParticipateButton.svelte b/frontend/src/lib/components/project-detail/ParticipateButton.svelte index afd552b0044..b433c993178 100644 --- a/frontend/src/lib/components/project-detail/ParticipateButton.svelte +++ b/frontend/src/lib/components/project-detail/ParticipateButton.svelte @@ -11,11 +11,10 @@ PROJECT_DETAIL_CONTEXT_KEY, type ProjectDetailContext, } from "$lib/types/project-detail.context"; - import type { SnsSummary } from "$lib/types/sns"; import { hasUserParticipatedToSwap, - type ParticipationButtonStatus, participateButtonStatus, + type ParticipationButtonStatus, } from "$lib/utils/projects.utils"; import { BottomSheet } from "@dfinity/gix-components"; import { Tooltip } from "@dfinity/gix-components"; @@ -29,13 +28,8 @@ ); let lifecycle: number; - $: ({ - swap: { lifecycle }, - } = - $projectDetailStore.summary ?? - ({ - swap: { state: { lifecycle: SnsSwapLifecycle.Unspecified } }, - } as unknown as SnsSummary)); + $: lifecycle = + $projectDetailStore.summary?.getLifecycle() ?? SnsSwapLifecycle.Unspecified; let showModal = false; const openModal = () => (showModal = true); diff --git a/frontend/src/lib/components/project-detail/ProjectMetadataSection.svelte b/frontend/src/lib/components/project-detail/ProjectMetadataSection.svelte index f936addd89d..9c734f942a3 100644 --- a/frontend/src/lib/components/project-detail/ProjectMetadataSection.svelte +++ b/frontend/src/lib/components/project-detail/ProjectMetadataSection.svelte @@ -8,7 +8,8 @@ PROJECT_DETAIL_CONTEXT_KEY, type ProjectDetailContext, } from "$lib/types/project-detail.context"; - import type { SnsSummary, SnsSummaryMetadata } from "$lib/types/sns"; + import type { SnsSummaryMetadata } from "$lib/types/sns"; + import type { SnsSummaryWrapper } from "$lib/types/sns-summary-wrapper"; import { snsProjectDashboardUrl } from "$lib/utils/projects.utils"; import type { Principal } from "@dfinity/principal"; import { SnsSwapLifecycle } from "@dfinity/sns"; @@ -19,14 +20,14 @@ PROJECT_DETAIL_CONTEXT_KEY ); - let summary: SnsSummary | undefined | null; + let summary: SnsSummaryWrapper | undefined | null; $: summary = $projectDetailStore.summary; let rootCanisterId: Principal | undefined; $: rootCanisterId = summary?.rootCanisterId; let lifecycle: SnsSwapLifecycle | undefined; - $: lifecycle = summary?.swap.lifecycle; + $: lifecycle = summary?.getLifecycle(); let metadata: SnsSummaryMetadata | undefined; let token: IcrcTokenMetadata | undefined; diff --git a/frontend/src/lib/components/project-detail/ProjectStatusSection.svelte b/frontend/src/lib/components/project-detail/ProjectStatusSection.svelte index f346301cbe4..da0948e1812 100644 --- a/frontend/src/lib/components/project-detail/ProjectStatusSection.svelte +++ b/frontend/src/lib/components/project-detail/ProjectStatusSection.svelte @@ -3,14 +3,14 @@ PROJECT_DETAIL_CONTEXT_KEY, type ProjectDetailContext, } from "$lib/types/project-detail.context"; - import type { SnsSwapCommitment, SnsSummary } from "$lib/types/sns"; + import type { SnsSwapCommitment } from "$lib/types/sns"; import { getCommitmentE8s } from "$lib/utils/sns.utils"; import ParticipateButton from "./ParticipateButton.svelte"; import ProjectCommitment from "./ProjectCommitment.svelte"; import ProjectStatus from "./ProjectStatus.svelte"; import ProjectTimelineUserCommitment from "./ProjectTimelineUserCommitment.svelte"; import { SnsSwapLifecycle } from "@dfinity/sns"; - import { TokenAmount, ICPToken, nonNullish } from "@dfinity/utils"; + import { ICPToken, TokenAmount, nonNullish } from "@dfinity/utils"; import { isNullish } from "@dfinity/utils"; import { getContext } from "svelte"; @@ -34,13 +34,8 @@ $: loadingSummary = isNullish($projectDetailStore.summary); let lifecycle: number; - $: ({ - swap: { lifecycle }, - } = - $projectDetailStore.summary ?? - ({ - swap: { state: { lifecycle: SnsSwapLifecycle.Unspecified } }, - } as unknown as SnsSummary)); + $: lifecycle = + $projectDetailStore.summary?.getLifecycle() ?? SnsSwapLifecycle.Unspecified; let displayStatusSection = false; $: displayStatusSection = diff --git a/frontend/src/lib/components/project-detail/ProjectTimelineUserCommitment.svelte b/frontend/src/lib/components/project-detail/ProjectTimelineUserCommitment.svelte index f63a37a263d..b065a291826 100644 --- a/frontend/src/lib/components/project-detail/ProjectTimelineUserCommitment.svelte +++ b/frontend/src/lib/components/project-detail/ProjectTimelineUserCommitment.svelte @@ -1,10 +1,7 @@