Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CFE-418]: Proposal listing lite version #910

Merged
merged 45 commits into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from 43 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
14b2501
feat(types): move proposal service to new wasm folder structure
Poafs1 May 3, 2024
0841d4c
Merge branch 'feature/cfe-462-txs-lite' into feature/cfe-418-proposal…
Poafs1 May 3, 2024
8625224
feat(pages): update table for lite version
Poafs1 May 6, 2024
94c27f8
feat(components): update proposal table lite
Poafs1 May 7, 2024
12d53d0
feat(pages): add filter by status in proposals listing lite version
Poafs1 May 7, 2024
127d881
fix(components): filter by status max height
Poafs1 May 7, 2024
4a77754
feat(components): update proposals table lite
Poafs1 May 7, 2024
1622715
fix(utils): resolve merge conflict
Poafs1 May 8, 2024
783d5c0
feat(utils): move proposal folder structure
Poafs1 May 8, 2024
2b6c74c
Merge branch 'feature/cfe-462-txs-lite' into feature/cfe-418-proposal…
Poafs1 May 8, 2024
ea6b179
feat(components): update proposals table lite according to ac test
Poafs1 May 8, 2024
a6a1082
feat(components): update proposals table lite according to ac test
Poafs1 May 8, 2024
e636a78
Merge branch 'feature/cfe-462-txs-lite' into feature/cfe-418-proposal…
Poafs1 May 8, 2024
0a33898
fix(components): table width in proposed by col
Poafs1 May 9, 2024
5078bf9
Merge branch 'feature/cfe-462-txs-lite' into feature/cfe-418-proposal…
Poafs1 May 9, 2024
d8dc524
feat(types): move proposal type to typse folder
Poafs1 May 9, 2024
494e723
fix(utils): fix is expedited
Poafs1 May 10, 2024
22c7dfc
fix(components): fix pr comments
Poafs1 May 10, 2024
4e8351e
feat: pull latest develop
Poafs1 May 10, 2024
31b3603
feat(components): update according to pr comments
Poafs1 May 10, 2024
ddd2f12
feat(components): update filter selection to support input type string
Poafs1 May 10, 2024
00aea7e
feat(components): update proposal status filter
Poafs1 May 10, 2024
d8e25d4
feat: pull latest develop
Poafs1 May 12, 2024
134c44b
Merge branch 'feature/cfe-418-proposal-listing-lite' into feature/cfe…
Poafs1 May 12, 2024
7c642bd
docs: update changelog
Poafs1 May 12, 2024
6be8d51
feat(components): update filter input to support single input
Poafs1 May 13, 2024
d99210c
feat(components): revert filter input
Poafs1 May 14, 2024
92ed1f6
feat(utils): revert filter
Poafs1 May 14, 2024
25c57ce
feat(components): fix proposal status filter
Poafs1 May 14, 2024
add32f6
Merge pull request #917 from alleslabs/feature/cfe-418-update-status-…
evilpeach May 15, 2024
ebc6aab
feat(types): update types import
Poafs1 May 15, 2024
6b80f99
Merge branch 'feature/cfe-418-proposal-listing-lite' of https://githu…
Poafs1 May 15, 2024
2a22497
fix: resolve merge conflict
Poafs1 May 15, 2024
7c3a401
docs: update changelog
Poafs1 May 15, 2024
72ed2f1
feat: pull latest branch
Poafs1 May 15, 2024
b1d930f
docs: update changelog
Poafs1 May 15, 2024
462dace
feat: pull latest branch
Poafs1 May 17, 2024
9896895
docs: update changelog
Poafs1 May 17, 2024
cc0e29a
feat(utils): update pr comments
Poafs1 May 17, 2024
dc2bd7d
feat: pull latest branch
Poafs1 May 17, 2024
4f9d6aa
feat(types): update pr comments
Poafs1 May 17, 2024
3635a2a
feat: pull latest develop
Poafs1 May 17, 2024
9bb7e09
feat(pages): fix pr comments
Poafs1 May 17, 2024
3cd9cd0
feat(types): update types proposals
Poafs1 May 20, 2024
f1148a1
feat: pull latest develop
Poafs1 May 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Features

- [#910](https://github.com/alleslabs/celatone-frontend/pull/910) Support proposals page lite version with LCD endpoint
- [#930](https://github.com/alleslabs/celatone-frontend/pull/930) Add validator details stats to support lite version
- [#928](https://github.com/alleslabs/celatone-frontend/pull/928) Add validator details page lite version
- [#933](https://github.com/alleslabs/celatone-frontend/pull/933) Support lite version for code details contract list
Expand All @@ -60,6 +61,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Improvements

- [#917](https://github.com/alleslabs/celatone-frontend/pull/917) Update filter selection input to support multiple use case
- [#921](https://github.com/alleslabs/celatone-frontend/pull/921) Add theme
- [#922](https://github.com/alleslabs/celatone-frontend/pull/922) Adjust color for latest blocks
- [#826](https://github.com/alleslabs/celatone-frontend/pull/826) Apply dynamic component theme generation
Expand Down
2 changes: 2 additions & 0 deletions src/lib/app-provider/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,15 @@ export enum CELATONE_QUERY_KEYS {
FAUCET_INFO = "CELATONE_QUERY_FAUCET_INFO",
// X/GOV
PROPOSAL_DATA = "CELATONE_QUERY_PROPOSAL_DATA",
PROPOSAL_DATA_LCD = "CELATONE_QUERY_PROPOSAL_DATA_LCD",
PROPOSAL_VOTES_INFO = "CELATONE_QUERY_PROPOSAL_VOTES_INFO",
PROPOSAL_VOTES = "CELATONE_QUERY_PROPOSAL_VOTES",
PROPOSAL_VALIDATOR_VOTES = "CELATONE_QUERY_PROPOSAL_VALIDATOR_VOTES",
PROPOSAL_ANSWER_COUNTS = "CELATONE_QUERY_PROPOSAL_ANSWER_COUNTS",
RELATED_PROPOSALS_BY_CONTRACT_ADDRESS = "CELATONE_QUERY_RELATED_PROPOSALS_BY_CONTRACT_ADDRESS",
PROPOSALS_BY_ADDRESS = "CELATONE_QUERY_PROPOSALS_BY_ADDRESS",
PROPOSALS = "CELATONE_QUERY_PROPOSALS",
PROPOSALS_LCD = "CELATONE_QUERY_PROPOSALS_LCD",
PROPOSAL_PARAMS = "CELATONE_QUERY_PROPOSAL_PARAMS",
PROPOSAL_TYPES = "CELATONE_QUERY_PROPOSAL_TYPES",
GOV_PARAMS = "CELATONE_QUERY_GOV_PARAMS",
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/Expedited.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Flex, SkeletonText, Text } from "@chakra-ui/react";

import { useProposalParams } from "lib/services/proposalService";
import { useProposalParams } from "lib/services/proposal";
import type { Option, Ratio } from "lib/types";
import { formatPrettyPercent, formatSeconds } from "lib/utils";

Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/button/NewProposalButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const NewProposalButton = () => {
>
Create New Proposal
</MenuButton>
<MenuList display="flex" flexDirection="column">
<MenuList>
<Tooltip label="Coming soon!" hidden={!disableStoreCode}>
<MenuItem
isDisabled={disableStoreCode}
Expand Down
7 changes: 2 additions & 5 deletions src/lib/components/filter/FilterInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@ import { Flex, FormLabel, Input } from "@chakra-ui/react";
import type { Dispatch, ForwardedRef, RefObject, SetStateAction } from "react";

import { DropdownChevron } from "../DropdownChevron";
import type { ProposalStatus, ProposalType } from "lib/types";
import { mergeRefs } from "lib/utils";

type Result = ProposalType | ProposalStatus;

interface FilterInputProps {
keyword: string;
result: Result[];
result: string[];
isDropdown: boolean;
chipContainerComponent: JSX.Element;
inputRef: RefObject<HTMLInputElement>;
Expand Down Expand Up @@ -49,7 +46,7 @@ export const FilterInput = ({
autoComplete="off"
size="lg"
minW="150px"
placeholder={result.length ? "" : placeholder}
placeholder={result.length > 0 ? "" : placeholder}
ref={mergeRefs([inputRef, ref])}
maxLength={36}
style={{ border: 0, maxHeight: "54px" }}
Expand Down
8 changes: 5 additions & 3 deletions src/lib/components/table/proposals/ProposalsTable.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { MobileTableContainer, TableContainer } from "../tableComponents";
import { useMobile } from "lib/app-provider";
import { useMobile, useTierConfig } from "lib/app-provider";
import { Loading } from "lib/components/Loading";
import type { Option, Proposal } from "lib/types";

Expand All @@ -18,13 +18,15 @@ export const ProposalsTable = ({
isLoading,
emptyState,
}: ProposalsTableProps) => {
const isFullTier = useTierConfig() === "full";
const isMobile = useMobile();

if (isLoading) return <Loading />;
if (!proposals?.length) return emptyState;

const templateColumns =
"100px minmax(360px, 2fr) minmax(150px, 1fr) 330px 180px 160px";
const templateColumns = isFullTier
? "100px minmax(360px, 2fr) minmax(150px, 1fr) 330px 180px 180px"
: "100px minmax(360px, 2fr) minmax(150px, 1fr) 330px 180px";
const boxShadow = "16px 0 32px -10px";

return isMobile ? (
Expand Down
6 changes: 5 additions & 1 deletion src/lib/components/table/proposals/ProposalsTableHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { DividerProps, GridProps } from "@chakra-ui/react";
import { Grid, Text } from "@chakra-ui/react";

import { TableHeader, TableHeaderFreeze } from "../tableComponents";
import { useTierConfig } from "lib/app-provider";

interface ProposalsTableHeaderProps {
templateColumns: GridProps["templateColumns"];
Expand All @@ -12,8 +13,11 @@ export const ProposalsTableHeader = ({
templateColumns,
boxShadow,
}: ProposalsTableHeaderProps) => {
const isFullTier = useTierConfig() === "full";

// TODO - Revisit split columnsWidth
const columnsWidth = templateColumns?.toString().split(" ");

return (
<Grid templateColumns={templateColumns} minW="min-content">
<TableHeaderFreeze left="0">Proposal ID</TableHeaderFreeze>
Expand All @@ -28,7 +32,7 @@ export const ProposalsTableHeader = ({
</TableHeaderFreeze>
<TableHeader textAlign="center">Status</TableHeader>
<TableHeader>Voting ends</TableHeader>
<TableHeader>Resolved Block Height</TableHeader>
{isFullTier && <TableHeader>Resolved Block Height</TableHeader>}
<TableHeader>Proposed By</TableHeader>
</Grid>
);
Expand Down
37 changes: 23 additions & 14 deletions src/lib/components/table/proposals/ProposalsTableMobileCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Flex } from "@chakra-ui/react";

import { MobileCardTemplate } from "../MobileCardTemplate";
import { MobileLabel } from "../MobileLabel";
import { useInternalNavigate } from "lib/app-provider";
import { useInternalNavigate, useTierConfig } from "lib/app-provider";
import { ExplorerLink } from "lib/components/ExplorerLink";
import type { Proposal } from "lib/types";
import { ProposalStatus } from "lib/types";
Expand All @@ -20,6 +20,7 @@ export interface ProposalsTableMobileCardProps {
export const ProposalsTableMobileCard = ({
proposal,
}: ProposalsTableMobileCardProps) => {
const isFullTier = useTierConfig() === "full";
const navigate = useInternalNavigate();

const onCardSelect = (proposalId: number) =>
Expand Down Expand Up @@ -62,22 +63,30 @@ export const ProposalsTableMobileCard = ({
status={proposal.status}
/>
</Flex>
{!isFullTier && (
<Flex direction="column" flex="1">
<MobileLabel label="Proposed by" />
<Proposer proposer={proposal.proposer} />
</Flex>
)}
</Flex>
}
bottomContent={
<>
<Flex direction="column" flex="1">
<MobileLabel label="Resolved Block Height" />
<ResolvedHeight
resolvedHeight={proposal.resolvedHeight}
isDepositOrVoting={isDepositOrVoting}
/>
</Flex>
<Flex direction="column" flex="1">
<MobileLabel label="Proposed by" />
<Proposer proposer={proposal.proposer} />
</Flex>
</>
isFullTier && (
<>
<Flex direction="column" flex="1">
<MobileLabel label="Resolved Block Height" />
<ResolvedHeight
resolvedHeight={proposal.resolvedHeight}
isDepositOrVoting={isDepositOrVoting}
/>
</Flex>
<Flex direction="column" flex="1">
<MobileLabel label="Proposed by" />
<Proposer proposer={proposal.proposer} />
</Flex>
</>
)
}
onClick={() => onCardSelect(proposal.id)}
/>
Expand Down
23 changes: 13 additions & 10 deletions src/lib/components/table/proposals/ProposalsTableRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { DividerProps, GridProps } from "@chakra-ui/react";
import { Grid } from "@chakra-ui/react";

import { TableRow, TableRowFreeze } from "../tableComponents";
import { useInternalNavigate } from "lib/app-provider";
import { useInternalNavigate, useTierConfig } from "lib/app-provider";
import { ExplorerLink } from "lib/components/ExplorerLink";
import { StopPropagationBox } from "lib/components/StopPropagationBox";
import type { Proposal } from "lib/types";
Expand All @@ -25,6 +25,7 @@ export const ProposalsTableRow = ({
templateColumns,
boxShadow,
}: ProposalsTableRowProps) => {
const isFullTier = useTierConfig() === "full";
const navigate = useInternalNavigate();

const onRowSelect = (proposalId: number) =>
Expand Down Expand Up @@ -86,15 +87,17 @@ export const ProposalsTableRow = ({
status={proposal.status}
/>
</TableRow>
<TableRow>
<StopPropagationBox>
<ResolvedHeight
resolvedHeight={proposal.resolvedHeight}
isDepositOrVoting={isDepositOrVoting}
amptrackSection="proposal-list"
/>
</StopPropagationBox>
</TableRow>
{isFullTier && (
<TableRow>
<StopPropagationBox>
<ResolvedHeight
resolvedHeight={proposal.resolvedHeight}
isDepositOrVoting={isDepositOrVoting}
amptrackSection="proposal-list"
/>
</StopPropagationBox>
</TableRow>
)}
<TableRow>
<Proposer
proposer={proposal.proposer}
Expand Down
27 changes: 13 additions & 14 deletions src/lib/layout/mobile/NavDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import { usePublicProjectStore } from "lib/providers/store";
import { getNavDrawerFull, getNavDrawerLite } from "./utils";

export const NavDrawer = () => {
const tier = useTierConfig();
const isFullTier = useTierConfig() === "full";
const govConfig = useGovConfig({ shouldRedirect: false });
const wasmConfig = useWasmConfig({ shouldRedirect: false });
const moveConfig = useMoveConfig({ shouldRedirect: false });
Expand All @@ -43,19 +43,18 @@ export const NavDrawer = () => {
const { getSavedPublicProjects } = usePublicProjectStore();
const { isOpen, onOpen, onClose } = useDisclosure();

const navMenu =
tier === "full"
? getNavDrawerFull(
govConfig.enabled,
wasmConfig.enabled,
moveConfig.enabled,
nftConfig.enabled
)
: getNavDrawerLite(
govConfig.enabled,
wasmConfig.enabled,
moveConfig.enabled
);
const navMenu = isFullTier
? getNavDrawerFull(
govConfig.enabled,
wasmConfig.enabled,
moveConfig.enabled,
nftConfig.enabled
)
: getNavDrawerLite(
govConfig.enabled,
wasmConfig.enabled,
moveConfig.enabled
);

if (publicProject.enabled) {
navMenu.push({
Expand Down
Loading
Loading