diff --git a/packages/apps-config/src/links/types.ts b/packages/apps-config/src/links/types.ts index bcef3abc802a..c014dcb14e7e 100644 --- a/packages/apps-config/src/links/types.ts +++ b/packages/apps-config/src/links/types.ts @@ -22,6 +22,7 @@ export interface LinkPath { // governance 2 fellowshipReferenda?: string; + ambassadorReferenda?: string; rankedPolls?: string; referenda?: string; } diff --git a/packages/apps-routing/src/ambassador.ts b/packages/apps-routing/src/ambassador.ts new file mode 100644 index 000000000000..87739383b654 --- /dev/null +++ b/packages/apps-routing/src/ambassador.ts @@ -0,0 +1,25 @@ +// Copyright 2017-2024 @polkadot/apps-routing authors & contributors +// SPDX-License-Identifier: Apache-2.0 + +import type { Route, TFunction } from './types.js'; + +import Component, { useCounter } from '@polkadot/app-ambassador'; + +export default function create (t: TFunction): Route { + return { + Component, + display: { + needsAccounts: true, + needsApi: [ + 'tx.ambassadorCollective.vote', + 'tx.ambassadorReferenda.submit', + 'consts.ambassadorReferenda.tracks' + ] + }, + group: 'governance', + icon: 'user-friends', + name: 'ambassador', + text: t('nav.ambassador', 'Ambassador', { ns: 'apps-routing' }), + useCounter + }; +} diff --git a/packages/apps-routing/src/index.ts b/packages/apps-routing/src/index.ts index cb4f19cbac58..32ee324a5442 100644 --- a/packages/apps-routing/src/index.ts +++ b/packages/apps-routing/src/index.ts @@ -6,6 +6,7 @@ import type { Routes, TFunction } from './types.js'; import accounts from './accounts.js'; import addresses from './addresses.js'; import alliance from './alliance.js'; +import ambassador from './ambassador.js'; import assets from './assets.js'; import bounties from './bounties.js'; import calendar from './calendar.js'; @@ -64,6 +65,7 @@ export default function create (t: TFunction): Routes { referenda(t), membership(t), alliance(t), + ambassador(t), fellowship(t), ranked(t), preimages(t), diff --git a/packages/apps-routing/tsconfig.build.json b/packages/apps-routing/tsconfig.build.json index 2749aeeeca15..dae101945136 100644 --- a/packages/apps-routing/tsconfig.build.json +++ b/packages/apps-routing/tsconfig.build.json @@ -9,6 +9,7 @@ { "path": "../page-accounts/tsconfig.build.json" }, { "path": "../page-addresses/tsconfig.build.json" }, { "path": "../page-alliance/tsconfig.build.json" }, + { "path": "../page-ambassador/tsconfig.build.json" }, { "path": "../page-assets/tsconfig.build.json" }, { "path": "../page-bounties/tsconfig.build.json" }, { "path": "../page-calendar/tsconfig.build.json" }, diff --git a/packages/apps/public/locales/en/app-ambassador.json b/packages/apps/public/locales/en/app-ambassador.json new file mode 100644 index 000000000000..9e26dfeeb6e6 --- /dev/null +++ b/packages/apps/public/locales/en/app-ambassador.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/packages/apps/public/locales/en/apps-routing.json b/packages/apps/public/locales/en/apps-routing.json index de72d5df4afb..5ddb4b2031b6 100644 --- a/packages/apps/public/locales/en/apps-routing.json +++ b/packages/apps/public/locales/en/apps-routing.json @@ -2,6 +2,7 @@ "nav.accounts": "Accounts", "nav.addresses": "Address book", "nav.alliance": "Alliance", + "nav.ambassador": "Ambassador", "nav.assets": "Assets", "nav.bounties": "Bounties", "nav.calendar": "Event calendar", diff --git a/packages/page-ambassador/.skip-build b/packages/page-ambassador/.skip-build new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/page-ambassador/.skip-npm b/packages/page-ambassador/.skip-npm new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/page-ambassador/README.md b/packages/page-ambassador/README.md new file mode 100644 index 000000000000..9a6f1ae06be5 --- /dev/null +++ b/packages/page-ambassador/README.md @@ -0,0 +1 @@ +# @polkadot/app-ambassador diff --git a/packages/page-ambassador/package.json b/packages/page-ambassador/package.json new file mode 100644 index 000000000000..654aeb8b0836 --- /dev/null +++ b/packages/page-ambassador/package.json @@ -0,0 +1,23 @@ +{ + "bugs": "https://github.com/polkadot-js/apps/issues", + "engines": { + "node": ">=18" + }, + "homepage": "https://github.com/polkadot-js/apps/tree/master/packages/page-ambassador#readme", + "license": "Apache-2.0", + "name": "@polkadot/app-ambassador", + "private": true, + "repository": { + "directory": "packages/page-ambassador", + "type": "git", + "url": "https://github.com/polkadot-js/apps.git" + }, + "sideEffects": false, + "type": "module", + "version": "0.142.2-25-x", + "peerDependencies": { + "react": "*", + "react-dom": "*", + "react-is": "*" + } +} diff --git a/packages/page-ambassador/src/index.tsx b/packages/page-ambassador/src/index.tsx new file mode 100644 index 000000000000..76d664db7e44 --- /dev/null +++ b/packages/page-ambassador/src/index.tsx @@ -0,0 +1,26 @@ +// Copyright 2017-2024 @polkadot/app-fellowship authors & contributors +// SPDX-License-Identifier: Apache-2.0 + +import React from 'react'; + +import Main from '@polkadot/app-ranked/App'; + +export { default as useCounter } from './useCounter.js'; + +interface Props { + basePath: string; + className?: string; +} + +function App ({ basePath, className }: Props): React.ReactElement { + return ( +
+ ); +} + +export default React.memo(App); diff --git a/packages/page-ambassador/src/useCounter.ts b/packages/page-ambassador/src/useCounter.ts new file mode 100644 index 000000000000..a45aa6081de1 --- /dev/null +++ b/packages/page-ambassador/src/useCounter.ts @@ -0,0 +1,11 @@ +// Copyright 2017-2024 @polkadot/app-ranked authors & contributors +// SPDX-License-Identifier: Apache-2.0 + +import { useCounterNamed } from '@polkadot/app-referenda/useCounter'; +import { createNamedHook } from '@polkadot/react-hooks'; + +function useCounterImpl (): number { + return useCounterNamed('ambassadorReferenda'); +} + +export default createNamedHook('useCounter', useCounterImpl); diff --git a/packages/page-ambassador/tsconfig.build.json b/packages/page-ambassador/tsconfig.build.json new file mode 100644 index 000000000000..115b67a87971 --- /dev/null +++ b/packages/page-ambassador/tsconfig.build.json @@ -0,0 +1,12 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "baseUrl": "..", + "outDir": "./build", + "rootDir": "./src" + }, + "references": [ + { "path": "../page-ranked/tsconfig.build.json" }, + { "path": "../react-components/tsconfig.build.json" } + ] +} diff --git a/packages/page-ranked/src/types.ts b/packages/page-ranked/src/types.ts index d696df4dae05..4edd01356322 100644 --- a/packages/page-ranked/src/types.ts +++ b/packages/page-ranked/src/types.ts @@ -3,9 +3,9 @@ import type { PalletRankedCollectiveMemberRecord } from '@polkadot/types/lookup'; -export type PalletColl = 'rankedCollective' | 'fellowshipCollective'; +export type PalletColl = 'rankedCollective' | 'fellowshipCollective' | 'ambassadorCollective'; -export type PalletPoll = 'rankedPolls' | 'fellowshipReferenda'; +export type PalletPoll = 'rankedPolls' | 'fellowshipReferenda' | 'ambassadorReferenda'; export interface Member { accountId: string; diff --git a/packages/page-referenda/src/types.ts b/packages/page-referenda/src/types.ts index 7e54b4fd12e8..a453b4785941 100644 --- a/packages/page-referenda/src/types.ts +++ b/packages/page-referenda/src/types.ts @@ -4,9 +4,9 @@ import type { PalletReferendaReferendumInfoConvictionVotingTally, PalletReferendaReferendumInfoRankedCollectiveTally, PalletReferendaTrackInfo } from '@polkadot/types/lookup'; import type { BN } from '@polkadot/util'; -export type PalletReferenda = 'referenda' | 'rankedPolls' | 'fellowshipReferenda'; +export type PalletReferenda = 'referenda' | 'rankedPolls' | 'fellowshipReferenda'| 'ambassadorReferenda'; -export type PalletVote = 'convictionVoting' | 'rankedCollective' | 'fellowshipCollective'; +export type PalletVote = 'convictionVoting' | 'rankedCollective' | 'fellowshipCollective' | 'ambassadorCollective'; export interface ReferendaGroup { key: string; diff --git a/tsconfig.base.json b/tsconfig.base.json index 9d1f478b7986..18371ad57522 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -23,6 +23,7 @@ "@polkadot/app-accounts": ["page-accounts/src/index.tsx"], "@polkadot/app-addresses": ["page-addresses/src/index.tsx"], "@polkadot/app-alliance": ["page-alliance/src/index.tsx"], + "@polkadot/app-ambassador": ["page-ambassador/src/index.tsx"], "@polkadot/app-assets": ["page-assets/src/index.tsx"], "@polkadot/app-bounties": ["page-bounties/src/index.tsx"], "@polkadot/app-calendar": ["page-calendar/src/index.tsx"], diff --git a/tsconfig.build.json b/tsconfig.build.json index de6c77d05407..a8951e88c66b 100644 --- a/tsconfig.build.json +++ b/tsconfig.build.json @@ -16,6 +16,7 @@ { "path": "./packages/page-addresses/tsconfig.spec.json" }, { "path": "./packages/page-addresses/tsconfig.test.json" }, { "path": "./packages/page-alliance/tsconfig.build.json" }, + { "path": "./packages/page-ambassador/tsconfig.build.json" }, { "path": "./packages/page-assets/tsconfig.build.json" }, { "path": "./packages/page-bounties/tsconfig.build.json" }, { "path": "./packages/page-bounties/tsconfig.spec.json" }, diff --git a/yarn.lock b/yarn.lock index 146d82711086..31c89264588f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1303,6 +1303,16 @@ __metadata: languageName: unknown linkType: soft +"@polkadot/app-ambassador@workspace:packages/page-ambassador": + version: 0.0.0-use.local + resolution: "@polkadot/app-ambassador@workspace:packages/page-ambassador" + peerDependencies: + react: "*" + react-dom: "*" + react-is: "*" + languageName: unknown + linkType: soft + "@polkadot/app-assets@workspace:packages/page-assets": version: 0.0.0-use.local resolution: "@polkadot/app-assets@workspace:packages/page-assets"