Skip to content

Commit

Permalink
Merge branch 'develop' into fix/bugbash-lite-peach2
Browse files Browse the repository at this point in the history
  • Loading branch information
evilpeach committed Jun 21, 2024
2 parents 2c6aff3 + a4e5404 commit 5b9dfa0
Show file tree
Hide file tree
Showing 21 changed files with 118 additions and 84 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Bug fixes

- [#986](https://github.com/alleslabs/celatone-frontend/pull/986) Fix bugbash lite version (creator, sorting name in validator)
- [#985](https://github.com/alleslabs/celatone-frontend/pull/985) Fix proposal details lite version bugs
- [#987](https://github.com/alleslabs/celatone-frontend/pull/987) Fix bug bash (query redirection, module button color, modal open/close, migration contract radio button, txs count in account detail)
- [#989](https://github.com/alleslabs/celatone-frontend/pull/989) Change tomcat endpoints
- [#984](https://github.com/alleslabs/celatone-frontend/pull/984) Exclude non block number from searching block in lite
- [#974](https://github.com/alleslabs/celatone-frontend/pull/974) Fix tx by account addr lcd to support new cosmos sdk
- [#976](https://github.com/alleslabs/celatone-frontend/pull/976) Support save accounts in lite version
Expand Down
8 changes: 4 additions & 4 deletions src/config/chain/initia.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ export const INITIA_CHAIN_CONFIGS: ChainConfigs = {
chain: "initia",
registryChainName: "blackwingtestnet",
prettyName: "Blackwing Testnet Lite",
lcd: "https://maze-rest-18bdff44-3aa4-425e-9bc0-06a2afa40af8.ue1-prod.newmetric.xyz",
rpc: "https://maze-rpc-18bdff44-3aa4-425e-9bc0-06a2afa40af8.ue1-prod.newmetric.xyz",
lcd: "https://maze-rest-18bdff44-3aa4-425e-9bc0-06a2afa40af8.ase1-prod.newmetric.xyz",
rpc: "https://maze-rpc-18bdff44-3aa4-425e-9bc0-06a2afa40af8.ase1-prod.newmetric.xyz",
indexer: "https://tomcat-1-graphql.alleslabs.dev/v1/graphql",
wallets: [...initiaWallets, ...keplrWallets],
features: {
Expand Down Expand Up @@ -203,8 +203,8 @@ export const INITIA_CHAIN_CONFIGS: ChainConfigs = {
chain: "initia",
registryChainName: "blackwingtestnet",
prettyName: "Blackwing",
lcd: "https://maze-rest-18bdff44-3aa4-425e-9bc0-06a2afa40af8.ue1-prod.newmetric.xyz",
rpc: "https://maze-rpc-18bdff44-3aa4-425e-9bc0-06a2afa40af8.ue1-prod.newmetric.xyz",
lcd: "https://maze-rest-18bdff44-3aa4-425e-9bc0-06a2afa40af8.ase1-prod.newmetric.xyz",
rpc: "https://maze-rpc-18bdff44-3aa4-425e-9bc0-06a2afa40af8.ase1-prod.newmetric.xyz",
indexer: "https://tomcat-1-graphql.alleslabs.dev/v1/graphql",
wallets: [...initiaWallets, ...keplrWallets],
features: {
Expand Down
4 changes: 2 additions & 2 deletions src/lib/chain-registry/initiatestnet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,13 +231,13 @@ export const initiatestnet: Chain[] = [
rpc: [
{
address:
"https://maze-rpc-18bdff44-3aa4-425e-9bc0-06a2afa40af8.ue1-prod.newmetric.xyz",
"https://maze-rpc-18bdff44-3aa4-425e-9bc0-06a2afa40af8.ase1-prod.newmetric.xyz",
},
],
rest: [
{
address:
"https://maze-rest-18bdff44-3aa4-425e-9bc0-06a2afa40af8.ue1-prod.newmetric.xyz",
"https://maze-rest-18bdff44-3aa4-425e-9bc0-06a2afa40af8.ase1-prod.newmetric.xyz",
},
],
},
Expand Down
40 changes: 22 additions & 18 deletions src/lib/components/select-code/CodeSelectSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { useState } from "react";
import type { Control, FieldPath, FieldValues } from "react-hook-form";

import { AmpEvent, track } from "lib/amplitude";
import { useTierConfig } from "lib/app-provider";
import { ControllerInput } from "lib/components/forms";
import type { FormStatus } from "lib/components/forms";
import type { Code } from "lib/services/types";
Expand All @@ -29,29 +30,32 @@ export const CodeSelectSection = <T extends FieldValues>({
setCodeHash,
status,
}: CodeSelectSectionProps<T>) => {
const isFullTier = useTierConfig() === "full";
const [method, setMethod] = useState<"select-existing" | "fill-manually">(
"select-existing"
isFullTier ? "select-existing" : "fill-manually"
);

return (
<>
<RadioGroup
onChange={(nextVal: "select-existing" | "fill-manually") => {
track(
nextVal === "fill-manually"
? AmpEvent.USE_CODE_FILL
: AmpEvent.USE_CODE_SELECT
);
setMethod(nextVal);
}}
value={method}
w="100%"
>
<Flex justify="space-around">
<Radio value="select-existing">Select from your code</Radio>
<Radio value="fill-manually">Fill Code ID manually</Radio>
</Flex>
</RadioGroup>
{isFullTier && (
<RadioGroup
onChange={(nextVal: "select-existing" | "fill-manually") => {
track(
nextVal === "fill-manually"
? AmpEvent.USE_CODE_FILL
: AmpEvent.USE_CODE_SELECT
);
setMethod(nextVal);
}}
value={method}
w="100%"
>
<Flex justify="space-around">
<Radio value="select-existing">Select from your code</Radio>
<Radio value="fill-manually">Fill Code ID manually</Radio>
</Flex>
</RadioGroup>
)}
<form style={{ width: "100%" }}>
{method === "select-existing" ? (
<CodeSelect
Expand Down
1 change: 0 additions & 1 deletion src/lib/components/tx/modal/ButtonSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ export const ButtonSection = ({
.find((r) => r.title === "Tx Hash")
?.value?.toString();
openTxTab(txHash);
onClose?.();
};

const openProposalExplorer = () => {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/layout/mobile/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const getNavDrawerLite = (
},
{
name: "Query",
slug: "/query",
slug: "/interact-contract",
icon: "query" as IconKeys,
},
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export const TxsTableLite = ({
title="Transactions"
count={txsCount}
onViewMore={onViewMore}
showCount={isFullTier}
/>
) : (
<Flex direction="column" gap={6}>
Expand Down
4 changes: 2 additions & 2 deletions src/lib/pages/home/components/DevShortcut.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ export const DevShortcut = () => {
{
title: "Query",
subtitle: "Query and get contract state data",
slug: "query",
slug: "interact-contract",
icon: "query" as const,
},
{
title: "Execute",
subtitle: "Send transactions to contracts",
slug: "execute",
slug: "interact-contract?selectedType=execute",
icon: "execute" as const,
},
]
Expand Down
4 changes: 2 additions & 2 deletions src/lib/pages/home/components/QuickMenuLite.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,15 +137,15 @@ export const QuickMenuLite = () => {
{
title: "Query",
subtitle: "Query and get contract state data",
slug: "query",
slug: "interact-contract",
icon: "query" as const,
isHighlight: false,
isDocument: false,
},
{
title: "Execute",
subtitle: "Send transactions to contracts",
slug: "execute",
slug: "interact-contract?selectedType=execute",
icon: "execute" as const,
isHighlight: false,
isDocument: false,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/pages/home/components/QuickMenuMobileLite.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ export const QuickMenuMobileLite = ({ prettyName }: { prettyName: string }) => {
item={{
title: "Query",
subtitle: "Query and get contract state data",
slug: "query",
slug: "interact-contract",
icon: "query" as const,
isDocument: false,
}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Circle, Heading, Text } from "@chakra-ui/react";
import { isNull } from "lodash";

import type { Nullable, Ratio } from "lib/types";
import { formatPrettyPercent } from "lib/utils";
Expand Down Expand Up @@ -64,7 +65,7 @@ export const VoteQuorumCircle = ({
fontWeight={600}
color={totalRatio ? "text.main" : "text.dark"}
>
{totalRatio ? formatPrettyPercent(totalRatio, 1) : "N/A"}
{!isNull(totalRatio) ? formatPrettyPercent(totalRatio, 1) : "N/A"}
</Heading>
</Circle>
</Circle>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export const ProposalMessages = ({ messages }: ProposalMessagesProps) => {
>
{messages.map((item, i) => (
<ProposalMessageCard
key={`msg-${JSON.stringify(item)}`}
key={`msg-${i.toString()}-${JSON.stringify(item)}`}
header={`[${i}] ${item["@type"]}`}
jsonString={jsonPrettify(JSON.stringify(item))}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ const getResolvedPrefix = (status: ProposalStatus) => {
};

export const SummaryStatusTime = ({ proposalData }: StatusTimeProps) => {
const endTime = proposalData.resolvedTimestamp ?? proposalData.votingEndTime;

if (proposalData.status === ProposalStatus.DEPOSIT_PERIOD)
return (
<Text variant="body2">
Expand All @@ -46,9 +48,7 @@ export const SummaryStatusTime = ({ proposalData }: StatusTimeProps) => {
<Text variant="body2" color="text.dark">
{getResolvedPrefix(proposalData.status)}
{" at "}
{proposalData.resolvedTimestamp
? formatUTC(proposalData.resolvedTimestamp)
: "N/A"}
{endTime ? formatUTC(endTime) : "N/A"}
</Text>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,15 @@ export const ProposalTop = ({ proposalData }: ProposalTopProps) => {
<Flex
gap={{ base: 0, md: 2 }}
direction={{ base: "column", md: "row" }}
align={{ base: "start", md: "center" }}
align="start"
>
<Text
variant="body2"
color="text.dark"
fontWeight={500}
whiteSpace="nowrap"
lineHeight="24px"
mt="1px"
>
Proposal Messages:
</Text>
Expand Down Expand Up @@ -110,7 +111,7 @@ export const ProposalTop = ({ proposalData }: ProposalTopProps) => {
))}
</Flex>
) : (
<Text variant="body2" color="text.dark">
<Text variant="body2" color="text.dark" mt="3px">
(No Message)
</Text>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ export const DepositPeriodSection = ({
<DepositorsTable
depositors={proposalData.proposalDeposits}
isDepositsLoading={isDepositsLoading}
showTransaction={isFullTier}
isPruned={!isFullTier && !isDepositOrVoting}
/>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,21 @@ import { TableHeader } from "lib/components/table";

interface DepositorsTableHeaderProps {
templateColumns: GridProps["templateColumns"];
showTransaction: boolean;
}

export const DepositorsTableHeader = ({
templateColumns,
showTransaction,
}: DepositorsTableHeaderProps) => (
<Grid templateColumns={templateColumns} minW="min-content">
<TableHeader>Depositor</TableHeader>
<TableHeader>Transaction Hash</TableHeader>
<TableHeader>Timestamp</TableHeader>
<TableHeader textAlign="right">Deposited Amount</TableHeader>
{showTransaction && (
<>
<TableHeader>Transaction Hash</TableHeader>
<TableHeader>Timestamp</TableHeader>
</>
)}
<TableHeader>Deposited Amount</TableHeader>
</Grid>
);
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ import { dateFromNow, formatUTC } from "lib/utils";
interface DepositorsTableRowProps {
proposalDeposit: ProposalDeposit;
templateColumns: string;
showTransaction: boolean;
}

export const DepositorsTableRow = ({
proposalDeposit,
templateColumns,
showTransaction,
}: DepositorsTableRowProps) => (
<Grid
className="copier-wrapper"
Expand All @@ -27,34 +29,40 @@ export const DepositorsTableRow = ({
showCopyOnHover
/>
</TableRow>
{showTransaction && (
<>
<TableRow>
{proposalDeposit.txHash ? (
<ExplorerLink
type="tx_hash"
value={proposalDeposit.txHash.toUpperCase()}
showCopyOnHover
/>
) : (
<Text variant="body3" textColor="text.dark">
N/A
</Text>
)}
</TableRow>
<TableRow>
{proposalDeposit.timestamp ? (
<Flex direction="column">
<Text variant="body3">
{formatUTC(proposalDeposit.timestamp)}
</Text>
<Text variant="body3" color="text.dark" mt="2px">
({dateFromNow(proposalDeposit.timestamp)})
</Text>
</Flex>
) : (
<Text variant="body3" color="text.dark">
N/A
</Text>
)}
</TableRow>
</>
)}
<TableRow>
{proposalDeposit.txHash ? (
<ExplorerLink
type="tx_hash"
value={proposalDeposit.txHash.toUpperCase()}
showCopyOnHover
/>
) : (
<Text variant="body3" textColor="text.dark">
N/A
</Text>
)}
</TableRow>
<TableRow>
{proposalDeposit.timestamp ? (
<Flex direction="column">
<Text variant="body3">{formatUTC(proposalDeposit.timestamp)}</Text>
<Text variant="body3" color="text.dark" mt="2px">
({dateFromNow(proposalDeposit.timestamp)})
</Text>
</Flex>
) : (
<Text variant="body3" color="text.dark">
N/A
</Text>
)}
</TableRow>
<TableRow justifyContent="flex-end">
<DepositAmounts deposit={proposalDeposit} />
</TableRow>
</Grid>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,18 @@ import { DepositorsTableRow } from "./DepositorsTableRow";
interface DepositorsTableProps {
depositors: ProposalDeposit[];
isDepositsLoading: boolean;
showTransaction: boolean;
isPruned: boolean;
}

const templateColumns = `1.5fr 1.5fr 2fr 1fr`;

export const DepositorsTable = ({
depositors,
isDepositsLoading,
showTransaction,
isPruned,
}: DepositorsTableProps) => {
const templateColumns = showTransaction ? "1.5fr 1.5fr 2fr 1fr" : "240px 1fr";

if (isDepositsLoading) return <Loading />;

if (isPruned)
Expand All @@ -32,12 +34,16 @@ export const DepositorsTable = ({

return (
<TableContainer>
<DepositorsTableHeader templateColumns={templateColumns} />
<DepositorsTableHeader
templateColumns={templateColumns}
showTransaction={showTransaction}
/>
{depositors.map((each) => (
<DepositorsTableRow
key={each.depositor}
proposalDeposit={each}
templateColumns={templateColumns}
showTransaction={showTransaction}
/>
))}
</TableContainer>
Expand Down
Loading

0 comments on commit 5b9dfa0

Please sign in to comment.