-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #83 from berachain/feat/remove-tally-use-our-own
feat: general proposal page
- Loading branch information
Showing
15 changed files
with
3,815 additions
and
434 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
apps/hub/src/app/governance/[genre]/components/proposal-sorting.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import * as React from "react"; | ||
import { | ||
DropdownMenu, | ||
DropdownMenuCheckboxItem, | ||
DropdownMenuContent, | ||
DropdownMenuLabel, | ||
DropdownMenuSeparator, | ||
DropdownMenuTrigger, | ||
} from "@bera/ui/dropdown-menu"; | ||
import { Icons } from "@bera/ui/icons"; | ||
|
||
import { OrderByEnum } from "../../types"; | ||
|
||
export const ProposalSorting = () => { | ||
const [sortBy, setSortBy] = React.useState(OrderByEnum.MOST_RECENT); | ||
|
||
return ( | ||
<div> | ||
<DropdownMenu> | ||
<DropdownMenuTrigger asChild> | ||
<div className="flex w-fit cursor-pointer items-center rounded-full border border-border text-sm hover:bg-muted"> | ||
<div className="flex h-10 w-[160px] items-center whitespace-nowrap border-r px-3 font-medium capitalize"> | ||
{sortBy.replace("-", " ")} | ||
</div> | ||
<Icons.chevronDown className="ml-1 mr-2 h-4 w-4 text-foreground" /> | ||
</div> | ||
</DropdownMenuTrigger> | ||
<DropdownMenuContent className="w-56 border border-border"> | ||
<DropdownMenuLabel>Proposal Status</DropdownMenuLabel> | ||
<DropdownMenuSeparator /> | ||
{Object.keys(OrderByEnum).map((order) => ( | ||
<DropdownMenuCheckboxItem | ||
className="capitalize" | ||
key={order} | ||
checked={order === sortBy} | ||
onCheckedChange={() => | ||
setSortBy(OrderByEnum[order as keyof typeof OrderByEnum]) | ||
} | ||
> | ||
{OrderByEnum[order as keyof typeof OrderByEnum].replace("-", " ")} | ||
</DropdownMenuCheckboxItem> | ||
))} | ||
</DropdownMenuContent> | ||
</DropdownMenu> | ||
</div> | ||
); | ||
}; |
57 changes: 57 additions & 0 deletions
57
apps/hub/src/app/governance/[genre]/components/proposal-status-filter.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import * as React from "react"; | ||
import { | ||
DropdownMenu, | ||
DropdownMenuCheckboxItem, | ||
DropdownMenuContent, | ||
DropdownMenuLabel, | ||
DropdownMenuSeparator, | ||
DropdownMenuTrigger, | ||
} from "@bera/ui/dropdown-menu"; | ||
import { Icons } from "@bera/ui/icons"; | ||
|
||
import { StatusEnum } from "../../types"; | ||
|
||
export const ProposalStatusFilter = () => { | ||
const config = Object.keys(StatusEnum).reduce( | ||
(acc, curr) => { | ||
acc[curr] = true; | ||
return acc; | ||
}, | ||
{} as { [key: string]: boolean }, | ||
); | ||
const [statusConfig, setStatusConfig] = React.useState(config); | ||
|
||
return ( | ||
<div> | ||
<DropdownMenu> | ||
<DropdownMenuTrigger asChild> | ||
<div className="flex w-fit cursor-pointer items-center rounded-full border border-border text-sm hover:bg-muted"> | ||
<div className="flex h-10 w-fit items-center border-r px-3 font-medium whitespace-nowrap"> | ||
Filter by Status | ||
</div> | ||
<Icons.chevronDown className="ml-1 mr-2 h-4 w-4 text-foreground" /> | ||
</div> | ||
</DropdownMenuTrigger> | ||
<DropdownMenuContent className="w-56 border border-border"> | ||
<DropdownMenuLabel>Proposal Status</DropdownMenuLabel> | ||
<DropdownMenuSeparator /> | ||
{Object.keys(StatusEnum).map((status) => ( | ||
<DropdownMenuCheckboxItem | ||
className="capitalize" | ||
key={status} | ||
checked={statusConfig[status]} | ||
onCheckedChange={() => | ||
setStatusConfig((prev) => ({ | ||
...prev, | ||
[status]: !prev[status], | ||
})) | ||
} | ||
> | ||
{StatusEnum[status as keyof typeof StatusEnum].replace("-", " ")} | ||
</DropdownMenuCheckboxItem> | ||
))} | ||
</DropdownMenuContent> | ||
</DropdownMenu> | ||
</div> | ||
); | ||
}; |
74 changes: 47 additions & 27 deletions
74
apps/hub/src/app/governance/[genre]/components/proposals-list.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import dotenv from "dotenv"; | ||
|
||
dotenv.config({ | ||
path: ["./.env", "./.env.local"], | ||
}); | ||
module.exports = { | ||
projects: { | ||
governance: { | ||
schema: "http://localhost:8000/subgraphs/name/governance-subgraph", | ||
documents: "./packages/graphql/src/modules/governance/query.ts", | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import type { CodegenConfig } from "@graphql-codegen/cli"; | ||
import dotenv from "dotenv"; | ||
|
||
dotenv.config({ | ||
path: ["../../.env", "../../.env.local"], | ||
}); | ||
|
||
const config: CodegenConfig = { | ||
overwrite: true, | ||
documents: "./lib/**/query.ts", | ||
schema: process.env.NEXT_PUBLIC_GOVERNANCE_SUBGRAPH_URL, | ||
generates: { | ||
"./src/modules/governance/codegen.ts": { | ||
documents: "./src/modules/governance/query.ts", | ||
schema: process.env.NEXT_PUBLIC_GOVERNANCE_SUBGRAPH_URL, | ||
plugins: [ | ||
"typescript", | ||
"typescript-operations", | ||
"typescript-react-apollo", | ||
{ | ||
"typescript-document-nodes": { | ||
gqlImport: "@apollo/client#gql", | ||
}, | ||
}, | ||
], | ||
}, | ||
}, | ||
}; | ||
|
||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.