From 9dedd5e69d3966180063accab822524af29112c3 Mon Sep 17 00:00:00 2001 From: Magic Cat <37407870+MonikaCat@users.noreply.github.com> Date: Wed, 7 Feb 2024 12:33:29 +0700 Subject: [PATCH] fix: update proposal details page [web-desmos] (#1323) ## Description Closes: #XXXX [BDU-1165](https://forbole.atlassian.net/browse/BDU-1165) --- ### Author Checklist _All items are required. Please add a note to the item if the item is not applicable and please add links to any relevant follow up issues._ I have... - [x] ran linting via `yarn lint` - [ ] wrote tests where necessary - [x] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [x] targeted the correct branch - [x] provided a link to the relevant issue or specification - [x] reviewed "Files changed" and left comments if necessary - [x] confirmed all CI checks have passed - [x] added a changeset via [`yarn && yarn changeset`](https://github.com/changesets/changesets/blob/main/docs/adding-a-changeset.md) [BDU-1165]: https://forbole.atlassian.net/browse/BDU-1165?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ --- .changeset/unlucky-knives-sing.md | 5 +++ apps/web-desmos/src/chain.json | 3 +- .../graphql/general/proposal_details.graphql | 2 +- .../src/graphql/types/general_types.ts | 37 ++++++++++--------- .../components/overview/index.tsx | 30 ++++++++++----- .../src/screens/proposal_details/hooks.ts | 2 + .../src/screens/proposal_details/types.ts | 1 + packages/ui/public/locales/en/proposals.json | 1 + packages/ui/public/locales/it/proposals.json | 1 + packages/ui/public/locales/pl/proposals.json | 1 + packages/ui/public/locales/zhs/proposals.json | 1 + packages/ui/public/locales/zht/proposals.json | 1 + 12 files changed, 56 insertions(+), 29 deletions(-) create mode 100644 .changeset/unlucky-knives-sing.md diff --git a/.changeset/unlucky-knives-sing.md b/.changeset/unlucky-knives-sing.md new file mode 100644 index 0000000000..c37ce50e01 --- /dev/null +++ b/.changeset/unlucky-knives-sing.md @@ -0,0 +1,5 @@ +--- +'web-desmos': major +--- + +update proposal details page diff --git a/apps/web-desmos/src/chain.json b/apps/web-desmos/src/chain.json index 457b6e5f04..46f25dffd5 100644 --- a/apps/web-desmos/src/chain.json +++ b/apps/web-desmos/src/chain.json @@ -3,7 +3,8 @@ "title": "Desmos Block Explorer", "extra": { "profile": true, - "graphqlWs": false + "graphqlWs": false, + "votingPowerExponent": 6 }, "previewImage": "https://s3.bigdipper.live/desmos.png", "themes": { diff --git a/apps/web-desmos/src/graphql/general/proposal_details.graphql b/apps/web-desmos/src/graphql/general/proposal_details.graphql index 708406b308..346c6cc288 100644 --- a/apps/web-desmos/src/graphql/general/proposal_details.graphql +++ b/apps/web-desmos/src/graphql/general/proposal_details.graphql @@ -7,7 +7,7 @@ query ProposalDetails($proposalId: Int) { content proposalId: id submitTime: submit_time - # proposalType: proposal_type + metadata depositEndTime: deposit_end_time votingStartTime: voting_start_time votingEndTime: voting_end_time diff --git a/apps/web-desmos/src/graphql/types/general_types.ts b/apps/web-desmos/src/graphql/types/general_types.ts index 236a972489..0f3f6dbb7b 100644 --- a/apps/web-desmos/src/graphql/types/general_types.ts +++ b/apps/web-desmos/src/graphql/types/general_types.ts @@ -3257,7 +3257,7 @@ export type Messages_By_Address_Args = { types?: InputMaybe; }; -export type Messages_By_Types_Args = { +export type Messages_By_Type_Args = { limit?: InputMaybe; offset?: InputMaybe; types?: InputMaybe; @@ -5553,10 +5553,10 @@ export type Query_Root = { messages_by_address: Array; /** execute function "messages_by_address" and query aggregates on result of table type "message" */ messages_by_address_aggregate: Message_Aggregate; - /** execute function "messages_by_types" which returns "message" */ - messages_by_types: Array; - /** execute function "messages_by_types" and query aggregates on result of table type "message" */ - messages_by_types_aggregate: Message_Aggregate; + /** execute function "messages_by_type" which returns "message" */ + messages_by_type: Array; + /** execute function "messages_by_type" and query aggregates on result of table type "message" */ + messages_by_type_aggregate: Message_Aggregate; /** execute function "messages_types_by_address" which returns "message" */ messages_types_by_address: Array; /** execute function "messages_types_by_address" and query aggregates on result of table type "message" */ @@ -6140,8 +6140,8 @@ export type Query_RootMessages_By_Address_AggregateArgs = { }; -export type Query_RootMessages_By_TypesArgs = { - args: Messages_By_Types_Args; +export type Query_RootMessages_By_TypeArgs = { + args: Messages_By_Type_Args; distinct_on?: InputMaybe>; limit?: InputMaybe; offset?: InputMaybe; @@ -6150,8 +6150,8 @@ export type Query_RootMessages_By_TypesArgs = { }; -export type Query_RootMessages_By_Types_AggregateArgs = { - args: Messages_By_Types_Args; +export type Query_RootMessages_By_Type_AggregateArgs = { + args: Messages_By_Type_Args; distinct_on?: InputMaybe>; limit?: InputMaybe; offset?: InputMaybe; @@ -7470,10 +7470,10 @@ export type Subscription_Root = { messages_by_address: Array; /** execute function "messages_by_address" and query aggregates on result of table type "message" */ messages_by_address_aggregate: Message_Aggregate; - /** execute function "messages_by_types" which returns "message" */ - messages_by_types: Array; - /** execute function "messages_by_types" and query aggregates on result of table type "message" */ - messages_by_types_aggregate: Message_Aggregate; + /** execute function "messages_by_type" which returns "message" */ + messages_by_type: Array; + /** execute function "messages_by_type" and query aggregates on result of table type "message" */ + messages_by_type_aggregate: Message_Aggregate; /** execute function "messages_types_by_address" which returns "message" */ messages_types_by_address: Array; /** execute function "messages_types_by_address" and query aggregates on result of table type "message" */ @@ -7971,8 +7971,8 @@ export type Subscription_RootMessages_By_Address_AggregateArgs = { }; -export type Subscription_RootMessages_By_TypesArgs = { - args: Messages_By_Types_Args; +export type Subscription_RootMessages_By_TypeArgs = { + args: Messages_By_Type_Args; distinct_on?: InputMaybe>; limit?: InputMaybe; offset?: InputMaybe; @@ -7981,8 +7981,8 @@ export type Subscription_RootMessages_By_TypesArgs = { }; -export type Subscription_RootMessages_By_Types_AggregateArgs = { - args: Messages_By_Types_Args; +export type Subscription_RootMessages_By_Type_AggregateArgs = { + args: Messages_By_Type_Args; distinct_on?: InputMaybe>; limit?: InputMaybe; offset?: InputMaybe; @@ -12289,7 +12289,7 @@ export type ProposalDetailsQueryVariables = Exact<{ }>; -export type ProposalDetailsQuery = { proposal: Array<{ __typename?: 'proposal', title: string, description?: string | null, status?: string | null, content: any, proposer: string, proposalId: number, submitTime: any, depositEndTime?: any | null, votingStartTime?: any | null, votingEndTime?: any | null }> }; +export type ProposalDetailsQuery = { proposal: Array<{ __typename?: 'proposal', title: string, description?: string | null, status?: string | null, content: any, metadata?: string | null, proposer: string, proposalId: number, submitTime: any, depositEndTime?: any | null, votingStartTime?: any | null, votingEndTime?: any | null }> }; export type ProposalDetailsTallyQueryVariables = Exact<{ proposalId?: InputMaybe; @@ -13361,6 +13361,7 @@ export const ProposalDetailsDocument = gql` content proposalId: id submitTime: submit_time + metadata depositEndTime: deposit_end_time votingStartTime: voting_start_time votingEndTime: voting_end_time diff --git a/apps/web-desmos/src/screens/proposal_details/components/overview/index.tsx b/apps/web-desmos/src/screens/proposal_details/components/overview/index.tsx index 5aa355329b..3179eac175 100644 --- a/apps/web-desmos/src/screens/proposal_details/components/overview/index.tsx +++ b/apps/web-desmos/src/screens/proposal_details/components/overview/index.tsx @@ -132,16 +132,20 @@ const Overview: FC<{ className?: string; overview: OverviewType }> = ({ classNam />
- - {t('type')} - - - {types.map((type: string) => ( - - {t(type)} + {types.length > 0 && ( + <> + + {t('type')} - ))} - + + {types.map((type: string) => ( + + {t(type)} + + ))} + + + )} {t('proposer')} @@ -190,6 +194,14 @@ const Overview: FC<{ className?: string; overview: OverviewType }> = ({ classNam {t('description')} + {!!overview.metadata && ( + <> + + {t('metadata')} + + + + )} {extra}
diff --git a/apps/web-desmos/src/screens/proposal_details/hooks.ts b/apps/web-desmos/src/screens/proposal_details/hooks.ts index 43de7d33f2..ef8792e5d1 100644 --- a/apps/web-desmos/src/screens/proposal_details/hooks.ts +++ b/apps/web-desmos/src/screens/proposal_details/hooks.ts @@ -20,6 +20,7 @@ const formatOverview = (data: ProposalDetailsQuery) => { title: data?.proposal?.[0]?.title ?? '', id: data?.proposal?.[0]?.proposalId ?? '', description: data?.proposal?.[0]?.description ?? '', + metadata: data?.proposal?.[0]?.metadata ?? '', status: data?.proposal?.[0]?.status ?? '', submitTime: data?.proposal?.[0]?.submitTime ?? '', depositEndTime: data?.proposal?.[0]?.depositEndTime ?? '', @@ -62,6 +63,7 @@ export const useProposalDetails = () => { title: '', id: 0, description: '', + metadata: '', status: '', submitTime: '', depositEndTime: '', diff --git a/apps/web-desmos/src/screens/proposal_details/types.ts b/apps/web-desmos/src/screens/proposal_details/types.ts index 2055522c4b..e23d117311 100644 --- a/apps/web-desmos/src/screens/proposal_details/types.ts +++ b/apps/web-desmos/src/screens/proposal_details/types.ts @@ -3,6 +3,7 @@ export interface OverviewType { id: number; proposer: string; description: string; + metadata: string; status: string; submitTime: string; depositEndTime: string; diff --git a/packages/ui/public/locales/en/proposals.json b/packages/ui/public/locales/en/proposals.json index 6cf6de25c4..d38c483383 100644 --- a/packages/ui/public/locales/en/proposals.json +++ b/packages/ui/public/locales/en/proposals.json @@ -27,6 +27,7 @@ "votingEndTime": "Voting End Time", "votingStartTime": "Voting Start Time", "content": "Content", + "metadata": "Metadata", "textProposal": "Text Proposal", "parameterChangeProposal": "Parameter Change Proposal", "communityPoolSpendProposal": "Community Pool Spend Proposal", diff --git a/packages/ui/public/locales/it/proposals.json b/packages/ui/public/locales/it/proposals.json index bfcf5d8a24..306d0db3e5 100644 --- a/packages/ui/public/locales/it/proposals.json +++ b/packages/ui/public/locales/it/proposals.json @@ -27,6 +27,7 @@ "votingEndTime": "Ora di fine della votazione", "votingStartTime": "Ora di inizio della votazione", "content": "Contenuto", + "metadata": "Metadati", "textProposal": "Proposal di testo", "parameterChangeProposal": "Proposal di modifica dei parametri", "communityPoolSpendProposal": "Proposal di spesa della community pool", diff --git a/packages/ui/public/locales/pl/proposals.json b/packages/ui/public/locales/pl/proposals.json index 0b71bdebff..7153b29f7a 100644 --- a/packages/ui/public/locales/pl/proposals.json +++ b/packages/ui/public/locales/pl/proposals.json @@ -27,6 +27,7 @@ "votingEndTime": "Czas zakończenia głosowania", "votingStartTime": "Czas rozpoczęcia głosowania", "content": "Treść", + "metadata": "Metadata", "textProposal": "Propozycja tekst", "parameterChangeProposal": "Propozycja zmiany parametru", "communityPoolSpendProposal": "Propozycja wydatkowania puli społeczności", diff --git a/packages/ui/public/locales/zhs/proposals.json b/packages/ui/public/locales/zhs/proposals.json index d3760169c6..cbce1d12d1 100644 --- a/packages/ui/public/locales/zhs/proposals.json +++ b/packages/ui/public/locales/zhs/proposals.json @@ -27,6 +27,7 @@ "votingEndTime": "投票结束时间", "votingStartTime": "投票开始时间", "content": "内容", + "metadata": "元数据", "textProposal": "文本提案", "parameterChangeProposal": "参数变更提案", "communityPoolSpendProposal": "社区资金池支出提案", diff --git a/packages/ui/public/locales/zht/proposals.json b/packages/ui/public/locales/zht/proposals.json index dcbd7d4cbe..3334371259 100644 --- a/packages/ui/public/locales/zht/proposals.json +++ b/packages/ui/public/locales/zht/proposals.json @@ -27,6 +27,7 @@ "votingEndTime": "投票結束時間", "votingStartTime": "投票開始時間", "content": "內容", + "metadata": "元資料", "textProposal": "文本議案", "parameterChangeProposal": "參數變更議案", "communityPoolSpendProposal": "社群池支出議案",