Skip to content

Commit

Permalink
Show proposer details in proposal details drawer (#1149)
Browse files Browse the repository at this point in the history
Co-authored-by: Dustin Brickwood <[email protected]>
  • Loading branch information
devpavan04 and dutterbutter authored Apr 27, 2023
1 parent 4adac6b commit f3d5a5e
Show file tree
Hide file tree
Showing 19 changed files with 154 additions and 109,233 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/check-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,12 @@ jobs:
echo NEXT_PUBLIC_FAUCET_BACKEND_URL=${{ secrets.NEXT_PUBLIC_FAUCET_BACKEND_URL }} >> .env
echo NEXT_PUBLIC_TWITTER_CLIENT_ID=${{ secrets.NEXT_PUBLIC_TWITTER_CLIENT_ID }} >> .env
echo TWITTER_CLIENT_SECRET=${{ secrets.TWITTER_CLIENT_SECRET }} >> .env
- name: Install deps
run: yarn install

- name: Generate stats-dapp codegen
run: yarn gql:codegen

- name: build
run: |
yarn install
yarn nx run-many --all --target=build
run: yarn nx run-many --all --target=build
2 changes: 1 addition & 1 deletion .github/workflows/deploy-stats-dapp-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
run: yarn install

- name: Build project
run: yarn nx build stats-dapp
run: yarn build:stats

- name: Deploy to Netlify
id: deploy-netlify
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,5 @@ tmp
/tools/scripts/local-webb-dapp
/tools/scripts/protocol-solidity/
/tools/scripts/relayer/
/tools/scripts/webb-dapp/
/tools/scripts/webb-dapp/
apps/stats-dapp/graphql.schema.json
10 changes: 0 additions & 10 deletions .graphqlconfig

This file was deleted.

2 changes: 2 additions & 0 deletions apps/stats-dapp/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
build/
src/generated/
./graphql.schema.json
10 changes: 10 additions & 0 deletions apps/stats-dapp/.graphqlconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extensions": {
"endpoints": {
"url": "https://standalone-subql.webb.tools/graphql",
"subscription": "https://standalone-subql.webb.tools/graphql"
},
"schemaPath": "./schema.graphql"
}
}

20 changes: 20 additions & 0 deletions apps/stats-dapp/codegen.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
overwrite: true
schema: "https://standalone-subql.webb.tools/graphql"
documents:
- "apps/stats-dapp/src/**/*.graphql"
generates:
apps/stats-dapp/src/generated/graphql.tsx:
plugins:
- "typescript"
- "typescript-operations"
- "typescript-react-apollo"

apps/stats-dapp/graphql.schema.json:
plugins:
- "introspection"
config:
withComponent: true
withHooks: true
withMutationFn: true
withRefetchFn: true
skipTypename: true
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ import {
useReactTable,
} from '@tanstack/react-table';
import { ChainConfig, chainsConfig } from '@webb-tools/dapp-config';
import {
AppEnum155D64Ff70 as ProposalStatus,
AppEnumB6165934C8 as ProposalType,
} from '../../generated/graphql';
import { ProposalStatus, ProposalType } from '../../generated/graphql';
import {
ProposalListItem,
ProposalsQuery,
Expand Down
23 changes: 11 additions & 12 deletions apps/stats-dapp/src/containers/ProposersTable/ProposersTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
Table as RTTable,
useReactTable,
} from '@tanstack/react-table';
import { AppEnumFe385C7221 as VoteStatus } from '../../generated/graphql';
import { VoteType } from '../../generated/graphql';
import { useVotes, VoteListItem, VotesQuery } from '../../provider/hooks';
import {
Avatar,
Expand Down Expand Up @@ -42,13 +42,13 @@ const columns: ColumnDef<VoteListItem, any>[] = [
columnHelper.accessor('status', {
header: 'Vote',
cell: (props) => {
const vote = props.getValue<VoteStatus | undefined>();
const vote = props.getValue<VoteType | undefined>();
switch (vote) {
case VoteStatus.Abstain:
case VoteType.Abstain:
return <Chip color="blue">Abstain</Chip>;
case VoteStatus.Against:
case VoteType.Against:
return <Chip color="red">Against</Chip>;
case VoteStatus.For:
case VoteType.For:
return <Chip color="green">For</Chip>;
default:
return '-';
Expand Down Expand Up @@ -81,9 +81,7 @@ export const ProposersTable: FC<ProposersTableProps> = ({
pageIndex: 0,
pageSize: 10,
});
const [voteStatus, setVoteStatus] = useState<VoteStatus | undefined>(
undefined
);
const [voteStatus, setVoteStatus] = useState<VoteType | undefined>(undefined);
const query = useMemo<VotesQuery>(() => {
return {
filter: {
Expand All @@ -94,14 +92,15 @@ export const ProposersTable: FC<ProposersTableProps> = ({
perPage: pagination.pageSize,
};
}, [pagination, proposalId, voteStatus]);

const votes = useVotes(query);

const tabsValue = useMemo<Array<[VoteStatus | undefined, string]>>(() => {
const tabsValue = useMemo<Array<[VoteType | undefined, string]>>(() => {
return [
[undefined, `All (${counters.all})`],
[VoteStatus.For, `For (${counters.for})`],
[VoteStatus.Against, `Against (${counters.against})`],
[VoteStatus.Abstain, `Abstain (${counters.abstain})`],
[VoteType.For, `For (${counters.for})`],
[VoteType.Against, `Against (${counters.against})`],
[VoteType.Abstain, `Abstain (${counters.abstain})`],
];
}, [counters]);

Expand Down
Loading

0 comments on commit f3d5a5e

Please sign in to comment.