Feature - introduce ambassador Base (Members and Referenda) (#10838)
* Ambassador Base (Members and Referenda) * Minor fixes
This commit is contained in:
parent
9804459c67
commit
f387340b37
@ -22,6 +22,7 @@ export interface LinkPath {
|
||||
|
||||
// governance 2
|
||||
fellowshipReferenda?: string;
|
||||
ambassadorReferenda?: string;
|
||||
rankedPolls?: string;
|
||||
referenda?: string;
|
||||
}
|
||||
|
||||
25
packages/apps-routing/src/ambassador.ts
Normal file
25
packages/apps-routing/src/ambassador.ts
Normal file
@ -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
|
||||
};
|
||||
}
|
||||
@ -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),
|
||||
|
||||
@ -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" },
|
||||
|
||||
1
packages/apps/public/locales/en/app-ambassador.json
Normal file
1
packages/apps/public/locales/en/app-ambassador.json
Normal file
@ -0,0 +1 @@
|
||||
{}
|
||||
@ -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",
|
||||
|
||||
0
packages/page-ambassador/.skip-build
Normal file
0
packages/page-ambassador/.skip-build
Normal file
0
packages/page-ambassador/.skip-npm
Normal file
0
packages/page-ambassador/.skip-npm
Normal file
1
packages/page-ambassador/README.md
Normal file
1
packages/page-ambassador/README.md
Normal file
@ -0,0 +1 @@
|
||||
# @polkadot/app-ambassador
|
||||
23
packages/page-ambassador/package.json
Normal file
23
packages/page-ambassador/package.json
Normal file
@ -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": "*"
|
||||
}
|
||||
}
|
||||
26
packages/page-ambassador/src/index.tsx
Normal file
26
packages/page-ambassador/src/index.tsx
Normal file
@ -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<Props> {
|
||||
return (
|
||||
<Main
|
||||
basePath={basePath}
|
||||
className={className}
|
||||
palletColl='ambassadorCollective'
|
||||
palletPoll='ambassadorReferenda'
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export default React.memo(App);
|
||||
11
packages/page-ambassador/src/useCounter.ts
Normal file
11
packages/page-ambassador/src/useCounter.ts
Normal file
@ -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);
|
||||
12
packages/page-ambassador/tsconfig.build.json
Normal file
12
packages/page-ambassador/tsconfig.build.json
Normal file
@ -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" }
|
||||
]
|
||||
}
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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"],
|
||||
|
||||
@ -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" },
|
||||
|
||||
10
yarn.lock
10
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"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user