Skip to content

Commit

Permalink
feat: Bump ic-js version and support new topics, while not showing th…
Browse files Browse the repository at this point in the history
…em when editing following (#5212)

# Motivation

2 new topics are added to NNS Governance while following on them are not
allowed yet. Before NNS Governance can start allowing following to be
set on them, we need to make sure NNS Dapp can render them correctly.
Because of the same reason, we do not show the new topics when editing
the followees.

# Changes

* Bump ic-js version
* Define en versions of the topic titles and descriptions
* Exclude the new topics when editing following

# Tests

* unit tests 
* manual tests in the local environment
  * followees on the new topics can be rendered
  * new topics do not show up on the edit followees panel
![Screenshot 2024-07-18 at 1 32
24 PM](https://github.com/user-attachments/assets/31ab6ecf-4eab-4c06-a95b-1b622f806003)
![Screenshot 2024-07-18 at 1 32
43 PM](https://github.com/user-attachments/assets/3e8d95b3-513c-41ce-8190-e0491867e3bb)


# Todos

- [x] Add entry to changelog (if necessary).

---------

Co-authored-by: gix-bot <[email protected]>
  • Loading branch information
jasonz-dfinity and gix-bot authored Jul 18, 2024
1 parent 2101912 commit 539cdac
Show file tree
Hide file tree
Showing 9 changed files with 154 additions and 77 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG-Nns-Dapp-unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ proposal is successful, the changes it released will be moved from this file to
#### Added

* A short delay before closing the mobile table sorting modal.
* Add 2 new topics `ProtocolCanisterMangement` and
`ServiceNervousSystemManagement` while not allowing following to be set.

#### Changed

Expand Down
109 changes: 60 additions & 49 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions frontend/src/lib/constants/neurons.constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ const FIRST_TOPICS = [
Topic.SnsAndCommunityFund,
];
const LAST_TOPICS = [Topic.ExchangeRate];

// Topics that neurons cannot yet set following for.
// TODO: Remove this list when the NNS Governance supports following on those topics.
export const TOPICS_WITH_FOLLOWING_DISABLED = [
Topic.ProtocolCanisterManagement,
Topic.ServiceNervousSystemManagement,
];

// This list should include ALL topics ordered as we want.
// Filtering out topics is done in the utils.
export const TOPICS_TO_FOLLOW_NNS = [
Expand Down
8 changes: 6 additions & 2 deletions frontend/src/lib/i18n/en.governance.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
"SubnetReplicaVersionManagement": "IC OS Version Deployment",
"SnsAndCommunityFund": "SNS & Neurons' Fund",
"ApiBoundaryNodeManagement": "API Boundary Node Management",
"SubnetRental": "Subnet Rental"
"SubnetRental": "Subnet Rental",
"ProtocolCanisterManagement": "Protocol Canister Management",
"ServiceNervousSystemManagement": "Service Nervous System Management"
},
"topics_description": {
"Unspecified": "",
Expand All @@ -42,7 +44,9 @@
"SubnetReplicaVersionManagement": "Proposals handling deployments of IC OS versions.",
"SnsAndCommunityFund": "Proposals relating to service nervous systems (SNS) and Neurons' Fund.",
"ApiBoundaryNodeManagement": "Proposals related to the management of API boundary nodes.",
"SubnetRental": "All proposals related to renting a subnet — for example a subnet rental request."
"SubnetRental": "Proposals related to renting a subnet — for example a subnet rental request.",
"ProtocolCanisterManagement": "Proposals related to managing canisters that are considered as part of the IC protocol.",
"ServiceNervousSystemManagement": "All proposals related to managing the canisters related to service nervous system (SNS)."
},
"rewards": {
"Unknown": "Unknown",
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/lib/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,10 @@
"topic_15_subtitle": "Proposals related to the management of API boundary nodes",
"topic_16_title": "Subnet Rental",
"topic_16_subtitle": "All proposals related to renting a subnet, for example a subnet rental request.",
"topic_17_title": "Protocol Canister Management",
"topic_17_subtitle": "Proposals related to managing canisters that are considered as part of the IC protocol.",
"topic_18_title": "Service Nervous System Management",
"topic_18_subtitle": "Proposals related to managing the canisters related to service nervous system (SNS).",
"current_followees": "Currently Following",
"add": "Add Followee"
},
Expand Down
8 changes: 8 additions & 0 deletions frontend/src/lib/types/i18n.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,10 @@ interface I18nFollow_neurons {
topic_15_subtitle: string;
topic_16_title: string;
topic_16_subtitle: string;
topic_17_title: string;
topic_17_subtitle: string;
topic_18_title: string;
topic_18_subtitle: string;
current_followees: string;
add: string;
}
Expand Down Expand Up @@ -1114,6 +1118,8 @@ interface I18nTopics {
SnsAndCommunityFund: string;
ApiBoundaryNodeManagement: string;
SubnetRental: string;
ProtocolCanisterManagement: string;
ServiceNervousSystemManagement: string;
}

interface I18nTopics_description {
Expand All @@ -1134,6 +1140,8 @@ interface I18nTopics_description {
SnsAndCommunityFund: string;
ApiBoundaryNodeManagement: string;
SubnetRental: string;
ProtocolCanisterManagement: string;
ServiceNervousSystemManagement: string;
}

interface I18nRewards {
Expand Down
12 changes: 11 additions & 1 deletion frontend/src/lib/utils/neuron.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
MAX_NEURONS_MERGED,
MIN_NEURON_STAKE,
TOPICS_TO_FOLLOW_NNS,
TOPICS_WITH_FOLLOWING_DISABLED,
} from "$lib/constants/neurons.constants";
import { DEPRECATED_TOPICS } from "$lib/constants/proposals.constants";
import type { IcpAccountsStoreData } from "$lib/derived/icp-accounts.derived";
Expand Down Expand Up @@ -814,7 +815,11 @@ export const topicsToFollow = (neuron: NeuronInfo): Topic[] =>
(followeesByTopic({ neuron, topic: Topic.ManageNeuron }) === undefined
? TOPICS_TO_FOLLOW_NNS.filter((topic) => topic !== Topic.ManageNeuron)
: TOPICS_TO_FOLLOW_NNS
).filter((topic) => !DEPRECATED_TOPICS.includes(topic));
).filter(
(topic) =>
!DEPRECATED_TOPICS.includes(topic) &&
!TOPICS_WITH_FOLLOWING_DISABLED.includes(topic)
);

// NeuronInfo is public info.
// fullNeuron is only for users with access.
Expand Down Expand Up @@ -1004,6 +1009,8 @@ export const getTopicTitle = ({
[Topic.SnsAndCommunityFund]: i18n.follow_neurons.topic_14_title,
[Topic.ApiBoundaryNodeManagement]: i18n.follow_neurons.topic_15_title,
[Topic.SubnetRental]: i18n.follow_neurons.topic_16_title,
[Topic.ProtocolCanisterManagement]: i18n.follow_neurons.topic_17_title,
[Topic.ServiceNervousSystemManagement]: i18n.follow_neurons.topic_18_title,
};
return mapper[topic];
};
Expand Down Expand Up @@ -1034,6 +1041,9 @@ export const getTopicSubtitle = ({
[Topic.SnsAndCommunityFund]: i18n.follow_neurons.topic_14_subtitle,
[Topic.ApiBoundaryNodeManagement]: i18n.follow_neurons.topic_15_subtitle,
[Topic.SubnetRental]: i18n.follow_neurons.topic_16_subtitle,
[Topic.ProtocolCanisterManagement]: i18n.follow_neurons.topic_17_subtitle,
[Topic.ServiceNervousSystemManagement]:
i18n.follow_neurons.topic_18_subtitle,
};
return mapper[topic];
};
2 changes: 2 additions & 0 deletions frontend/src/tests/lib/utils/enum.utils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ describe("enum-utils", () => {
Topic.SnsAndCommunityFund,
Topic.ApiBoundaryNodeManagement,
Topic.SubnetRental,
Topic.ProtocolCanisterManagement,
Topic.ServiceNervousSystemManagement,
];

expect(
Expand Down
Loading

0 comments on commit 539cdac

Please sign in to comment.