Skip to content

Commit 5acd376

Browse files
committed
split sunset projects into own table
1 parent a5f6115 commit 5acd376

File tree

3 files changed

+42
-7
lines changed

3 files changed

+42
-7
lines changed

frontend/src/lib/components/staking/ProjectsTable.svelte

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@
88
import ResponsiveTable from "$lib/components/ui/ResponsiveTable.svelte";
99
import Separator from "$lib/components/ui/Separator.svelte";
1010
import UsdValueBanner from "$lib/components/ui/UsdValueBanner.svelte";
11-
import { OWN_CANISTER_ID_TEXT } from "$lib/constants/canister-ids.constants";
11+
import {
12+
abandonedProjectsCanisterId,
13+
OWN_CANISTER_ID_TEXT,
14+
} from "$lib/constants/canister-ids.constants";
1215
import { authSignedInStore } from "$lib/derived/auth.derived";
1316
import { icpSwapUsdPricesStore } from "$lib/derived/icp-swap.derived";
1417
import { selectableUniversesStore } from "$lib/derived/selectable-universes.derived";
@@ -30,13 +33,14 @@
3033
sortTableProjects,
3134
} from "$lib/utils/staking.utils";
3235
import { IconNeuronsPage } from "@dfinity/gix-components";
33-
import { TokenAmountV2, isNullish } from "@dfinity/utils";
36+
import { isNullish, TokenAmountV2 } from "@dfinity/utils";
3437
import { createEventDispatcher } from "svelte";
3538
3639
$: if ($authSignedInStore) {
3740
loadIcpSwapTickers();
3841
}
39-
const commonColumns: ProjectsTableColumn[] = [
42+
let commonColumns: ProjectsTableColumn[] = [];
43+
$: commonColumns = [
4044
{
4145
id: "stake",
4246
title: $i18n.neuron_detail.stake,
@@ -106,6 +110,22 @@
106110
...commonColumns,
107111
];
108112
113+
let sunsettedSnsColumns: ProjectsTableColumn[] = [];
114+
$: sunsettedSnsColumns = [
115+
{
116+
id: "title",
117+
title: $i18n.staking.nervous_systems_sns_sunset,
118+
cellComponent: ProjectTitleCell,
119+
alignment: "left",
120+
templateColumns: ["2fr"],
121+
},
122+
{
123+
title: "",
124+
alignment: "left",
125+
templateColumns: ["1fr"],
126+
},
127+
];
128+
109129
let tableProjects: TableProject[];
110130
$: tableProjects = getTableProjects({
111131
universes: $selectableUniversesStore,
@@ -153,8 +173,13 @@
153173
);
154174
155175
let snsNeurons: TableProject[] = [];
156-
$: snsNeurons = sortedTableProjects.filter(
157-
(project) => project.universeId !== OWN_CANISTER_ID_TEXT
176+
$: snsNeurons = sortedTableProjects
177+
.filter((p) => p.universeId !== OWN_CANISTER_ID_TEXT)
178+
.filter((p) => !abandonedProjectsCanisterId.includes(p.universeId));
179+
180+
let sunsetSns: TableProject[] = [];
181+
$: sunsetSns = sortedTableProjects.filter((p) =>
182+
abandonedProjectsCanisterId.includes(p.universeId)
158183
);
159184
160185
const dispatcher = createEventDispatcher();
@@ -192,6 +217,10 @@
192217
columns={snsColumns}
193218
on:nnsAction={handleAction}
194219
/>
220+
221+
{#if sunsetSns.length > 0}
222+
<ResponsiveTable tableData={sunsetSns} columns={sunsettedSnsColumns} />
223+
{/if}
195224
{:else}
196225
<ResponsiveTable
197226
tableData={nnsNeurons}
@@ -239,6 +268,10 @@
239268
</svelte:fragment>
240269
</ResponsiveTable>
241270
{/if}
271+
272+
{#if $hideZeroNeuronsStore !== "hide" && sunsetSns.length > 0}
273+
<ResponsiveTable tableData={sunsetSns} columns={sunsettedSnsColumns} />
274+
{/if}
242275
{/if}
243276
{:else if !$authSignedInStore}
244277
<ResponsiveTable

frontend/src/lib/i18n/en.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,8 +338,9 @@
338338
"title": "Stake and earn voting rewards",
339339
"text": "Earn voting rewards by staking your tokens in neurons. Neurons allow you to participate in governance of the Internet Computer, and DAOs deployed on the Internet Computer.",
340340
"nervous_systems": "Nervous Systems",
341-
"nervous_systems_nns": "NNS DAO",
342-
"nervous_systems_sns": "SNS DAO",
341+
"nervous_systems_nns": "NNS DAOs",
342+
"nervous_systems_sns": "SNS DAOs",
343+
"nervous_systems_sns_sunset": "Sunset SNS DAOs",
343344
"hide_no_neurons_header": "Neurons",
344345
"hide_no_neurons_toggle_label": "Hide projects with 0 neurons",
345346
"hide_no_neurons_table_hint": "Projects with 0 neurons are hidden.",

frontend/src/lib/types/i18n.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,7 @@ interface I18nStaking {
353353
nervous_systems: string;
354354
nervous_systems_nns: string;
355355
nervous_systems_sns: string;
356+
nervous_systems_sns_sunset: string;
356357
hide_no_neurons_header: string;
357358
hide_no_neurons_toggle_label: string;
358359
hide_no_neurons_table_hint: string;

0 commit comments

Comments
 (0)