Feature - introduce ambassador Base (Members and Referenda) (#10838)

* Ambassador Base (Members and Referenda)

* Minor fixes
This commit is contained in:
Nikos Kontakis 2024-08-15 19:11:00 +03:00 committed by GitHub
parent 9804459c67
commit f387340b37
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
18 changed files with 120 additions and 4 deletions

View File

@ -22,6 +22,7 @@ export interface LinkPath {
// governance 2
fellowshipReferenda?: string;
ambassadorReferenda?: string;
rankedPolls?: string;
referenda?: string;
}

View 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
};
}

View File

@ -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),

View File

@ -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" },

View File

@ -0,0 +1 @@
{}

View File

@ -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",

View File

View File

View File

@ -0,0 +1 @@
# @polkadot/app-ambassador

View 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": "*"
}
}

View 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);

View 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);

View 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" }
]
}

View File

@ -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;

View File

@ -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;

View File

@ -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"],

View File

@ -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" },

View File

@ -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"