From 48bfe0aa44c391f267a5019478bbfa0924190af9 Mon Sep 17 00:00:00 2001 From: poomthiti Date: Mon, 23 Jan 2023 15:19:03 +0700 Subject: [PATCH 01/10] fix(components): fix floating tooltip when scrolling out of copy button --- src/lib/components/Copier.tsx | 35 +++++++++++++++++++---------- src/lib/components/ExplorerLink.tsx | 17 +++++++------- 2 files changed, 32 insertions(+), 20 deletions(-) diff --git a/src/lib/components/Copier.tsx b/src/lib/components/Copier.tsx index a032f66d1..424c6fe96 100644 --- a/src/lib/components/Copier.tsx +++ b/src/lib/components/Copier.tsx @@ -1,13 +1,21 @@ import { CopyIcon } from "@chakra-ui/icons"; +import type { LayoutProps } from "@chakra-ui/react"; import { Tooltip, useClipboard } from "@chakra-ui/react"; import { useEffect } from "react"; interface CopierProps { value: string; ml?: string; + className?: string; + display?: LayoutProps["display"]; } -export const Copier = ({ value, ml = "8px" }: CopierProps) => { +export const Copier = ({ + value, + ml = "8px", + className, + display = "flex", +}: CopierProps) => { const { onCopy, hasCopied, setValue } = useClipboard(value); useEffect(() => setValue(value), [value, setValue]); @@ -21,17 +29,20 @@ export const Copier = ({ value, ml = "8px" }: CopierProps) => { arrowSize={8} bg="primary.dark" > - { - e.stopPropagation(); - onCopy(); - }} - /> +
+ { + e.stopPropagation(); + onCopy(); + }} + /> +
); }; diff --git a/src/lib/components/ExplorerLink.tsx b/src/lib/components/ExplorerLink.tsx index 866cacf48..f41d07091 100644 --- a/src/lib/components/ExplorerLink.tsx +++ b/src/lib/components/ExplorerLink.tsx @@ -139,7 +139,6 @@ export const ExplorerLink = ({ return ( @@ -161,13 +163,12 @@ export const ExplorerLink = ({ isEllipsis={textFormat === "ellipsis"} maxWidth={maxWidth} /> - - - + )} From aa972d85639750ed15f1b20f2231c013ea71984b Mon Sep 17 00:00:00 2001 From: poomthiti Date: Mon, 23 Jan 2023 15:20:27 +0700 Subject: [PATCH 02/10] chore: changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2995798ba..32959f1ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -107,6 +107,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Bug fixes +- [#118](https://github.com/alleslabs/celatone-frontend/pull/118) Fix floating tooltip when scrolling out of copy button - [#111](https://github.com/alleslabs/celatone-frontend/pull/111) Fix recent activities navigation and instantiate encode/decode - [#105](https://github.com/alleslabs/celatone-frontend/pull/105) Propoerly show instantiator of code contracts and contract in the instantiated list - [#42](https://github.com/alleslabs/celatone-frontend/pull/42) Properly show CTAs on contract-list page and edit zero/disconnected state From 385b6e78f80dea3937f2c095c76ea82617bd4fcf Mon Sep 17 00:00:00 2001 From: bkioshn Date: Mon, 23 Jan 2023 15:45:41 +0700 Subject: [PATCH 03/10] fix: searching, projects ordering, wording, contract render condition in overview --- .../public-project/components/AllProject.tsx | 40 +++++++++++-------- .../public-project/components/CodesTable.tsx | 2 +- .../components/ContractsTable.tsx | 4 +- 3 files changed, 27 insertions(+), 19 deletions(-) diff --git a/src/lib/pages/public-project/components/AllProject.tsx b/src/lib/pages/public-project/components/AllProject.tsx index 70a999557..a2155688e 100644 --- a/src/lib/pages/public-project/components/AllProject.tsx +++ b/src/lib/pages/public-project/components/AllProject.tsx @@ -1,5 +1,6 @@ import { Box, SimpleGrid, Flex, Button, Icon } from "@chakra-ui/react"; import { matchSorter } from "match-sorter"; +import { observer } from "mobx-react-lite"; import { useMemo, useState } from "react"; import { BsGithub } from "react-icons/bs"; import { MdOutlineManageSearch, MdSearchOff } from "react-icons/md"; @@ -8,36 +9,43 @@ import { TextInput } from "lib/components/forms"; import { EmptyState } from "lib/components/state/EmptyState"; import { usePublicProjectStore } from "lib/hooks"; import { usePublicProjectsQuery } from "lib/services/publicProject"; +import type { PublicProjectInfo } from "lib/types"; import { PublicProjectCard } from "./PublicProjectCard"; -export const AllProject = () => { +const orderProjectAlphabetically = (projects: PublicProjectInfo[]) => + projects.sort((a, b) => { + if (a.details.name && b.details.name) { + return a.details.name.localeCompare(b.details.name); + } + return -1; + }); + +export const AllProject = observer(() => { const { data: publicProjectInfo } = usePublicProjectsQuery(); const [searchKeyword, setSearchKeyword] = useState(""); const { getSavedPublicProjects } = usePublicProjectStore(); + const savedProjects = getSavedPublicProjects(); const filteredPublicProjects = useMemo(() => { if (publicProjectInfo) { - const savedProjects = getSavedPublicProjects(); - // HACKED - // TODO Sort saved project - const orderedProjects = publicProjectInfo.map((project) => { - const foundIndex = savedProjects.findIndex( - (each) => each.slug === project.slug - ); + const orderProjects = orderProjectAlphabetically(publicProjectInfo); + const orderSavedProjects = orderProjectAlphabetically( + publicProjectInfo.filter((project) => + savedProjects.some((save) => save.name === project.details.name) + ) + ); - return { - ...project, - order: foundIndex === -1 ? 9999 : foundIndex, - }; - }); + const order = new Set([...orderSavedProjects, ...orderProjects]); - return matchSorter(orderedProjects, searchKeyword, { + return matchSorter([...Array.from(order)], searchKeyword, { keys: ["details.name"], + sorter: (rankedItems) => rankedItems, + threshold: matchSorter.rankings.CONTAINS, }); } return []; - }, [getSavedPublicProjects, publicProjectInfo, searchKeyword]); + }, [publicProjectInfo, savedProjects, searchKeyword]); if (!publicProjectInfo) return ( @@ -81,4 +89,4 @@ export const AllProject = () => { )} ); -}; +}); diff --git a/src/lib/pages/public-project/components/CodesTable.tsx b/src/lib/pages/public-project/components/CodesTable.tsx index ffa3a4955..258032a2a 100644 --- a/src/lib/pages/public-project/components/CodesTable.tsx +++ b/src/lib/pages/public-project/components/CodesTable.tsx @@ -55,7 +55,7 @@ export const CodesTable = ({ )} {!filteredCodes.length ? ( - + ) : ( diff --git a/src/lib/pages/public-project/components/ContractsTable.tsx b/src/lib/pages/public-project/components/ContractsTable.tsx index 663df08cb..5009b4440 100644 --- a/src/lib/pages/public-project/components/ContractsTable.tsx +++ b/src/lib/pages/public-project/components/ContractsTable.tsx @@ -55,9 +55,9 @@ export const ContractsTable = ({ /> )} - {filteredContracts.length ? ( + {!filteredContracts.length ? ( - + ) : ( From a56edba1db9c0f8ded2299fa6999efe50f1fc328 Mon Sep 17 00:00:00 2001 From: bkioshn Date: Tue, 24 Jan 2023 14:28:23 +0700 Subject: [PATCH 04/10] chore: change name, remove unnecessary logic --- .../public-project/components/AllProject.tsx | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/lib/pages/public-project/components/AllProject.tsx b/src/lib/pages/public-project/components/AllProject.tsx index a2155688e..f78a5f43a 100644 --- a/src/lib/pages/public-project/components/AllProject.tsx +++ b/src/lib/pages/public-project/components/AllProject.tsx @@ -13,13 +13,8 @@ import type { PublicProjectInfo } from "lib/types"; import { PublicProjectCard } from "./PublicProjectCard"; -const orderProjectAlphabetically = (projects: PublicProjectInfo[]) => - projects.sort((a, b) => { - if (a.details.name && b.details.name) { - return a.details.name.localeCompare(b.details.name); - } - return -1; - }); +const sortByAtoZ = (projects: PublicProjectInfo[]) => + projects.sort((a, b) => a.details.name.localeCompare(b.details.name)); export const AllProject = observer(() => { const { data: publicProjectInfo } = usePublicProjectsQuery(); @@ -29,14 +24,14 @@ export const AllProject = observer(() => { const filteredPublicProjects = useMemo(() => { if (publicProjectInfo) { - const orderProjects = orderProjectAlphabetically(publicProjectInfo); - const orderSavedProjects = orderProjectAlphabetically( + const orderedProjects = sortByAtoZ(publicProjectInfo); + const orderSavedProjects = sortByAtoZ( publicProjectInfo.filter((project) => savedProjects.some((save) => save.name === project.details.name) ) ); - const order = new Set([...orderSavedProjects, ...orderProjects]); + const order = new Set([...orderSavedProjects, ...orderedProjects]); return matchSorter([...Array.from(order)], searchKeyword, { keys: ["details.name"], From 4d0165b8dd2e8c8f27f59630213262dedb19e751 Mon Sep 17 00:00:00 2001 From: bkioshn Date: Tue, 24 Jan 2023 14:31:33 +0700 Subject: [PATCH 05/10] chore: add changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b28d3a3e7..d65f1f962 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -109,6 +109,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Bug fixes +- [#119](https://github.com/alleslabs/celatone-frontend/pull/119) Fix searching and project ordering in public projects page - [#111](https://github.com/alleslabs/celatone-frontend/pull/111) Fix recent activities navigation and instantiate encode/decode - [#105](https://github.com/alleslabs/celatone-frontend/pull/105) Propoerly show instantiator of code contracts and contract in the instantiated list - [#42](https://github.com/alleslabs/celatone-frontend/pull/42) Properly show CTAs on contract-list page and edit zero/disconnected state From a1615f727d6d20921c324b42f80e2780475262ef Mon Sep 17 00:00:00 2001 From: bkioshn Date: Tue, 24 Jan 2023 15:08:34 +0700 Subject: [PATCH 06/10] fix: check slug instead of name --- src/lib/pages/public-project/components/AllProject.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/pages/public-project/components/AllProject.tsx b/src/lib/pages/public-project/components/AllProject.tsx index f78a5f43a..ddef13ba5 100644 --- a/src/lib/pages/public-project/components/AllProject.tsx +++ b/src/lib/pages/public-project/components/AllProject.tsx @@ -27,7 +27,7 @@ export const AllProject = observer(() => { const orderedProjects = sortByAtoZ(publicProjectInfo); const orderSavedProjects = sortByAtoZ( publicProjectInfo.filter((project) => - savedProjects.some((save) => save.name === project.details.name) + savedProjects.some((save) => save.slug === project.slug) ) ); From d89f4181086c050845bb2f10eeaacf9eca58c2b5 Mon Sep 17 00:00:00 2001 From: poomthiti Date: Tue, 24 Jan 2023 15:58:14 +0700 Subject: [PATCH 07/10] feat: add connect wallet alert in instantiate page --- src/lib/pages/instantiate/instantiate.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/lib/pages/instantiate/instantiate.tsx b/src/lib/pages/instantiate/instantiate.tsx index 466e9a4ea..f4fbeb4e4 100644 --- a/src/lib/pages/instantiate/instantiate.tsx +++ b/src/lib/pages/instantiate/instantiate.tsx @@ -19,6 +19,7 @@ import { useSimulateFee, } from "lib/app-provider"; import { useInstantiateTx } from "lib/app-provider/tx/instantiate"; +import { ConnectWalletAlert } from "lib/components/ConnectWalletAlert"; import { ControllerInput } from "lib/components/forms"; import { AssetInput } from "lib/components/forms/AssetInput"; import JsonInput from "lib/components/json/JsonInput"; @@ -204,6 +205,10 @@ const Instantiate = ({ onComplete }: InstantiatePageProps) => { Instantiate new contract + setMethod(nextVal) @@ -223,7 +228,7 @@ const Instantiate = ({ onComplete }: InstantiatePageProps) => {
{method === "select-existing" ? ( setValue("codeId", code)} codeId={codeId} From 91e3e418b7bc14348e7fc0c1b317566b2f930c33 Mon Sep 17 00:00:00 2001 From: poomthiti Date: Tue, 24 Jan 2023 16:00:35 +0700 Subject: [PATCH 08/10] chore: changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index aa577e89a..0ebf6f118 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased ### Features + +- [#125](https://github.com/alleslabs/celatone-frontend/pull/125) Add connect wallet alert in instantiate page - [#121](https://github.com/alleslabs/celatone-frontend/pull/121) Fix code snippet for query axios - [#76](https://github.com/alleslabs/celatone-frontend/pull/76) Add Public projects page - [#116](https://github.com/alleslabs/celatone-frontend/pull/116) Support Terra2.0 mainnet and testnet From 4cf45766a2c78463a364379223045ceea8de606d Mon Sep 17 00:00:00 2001 From: poomthiti Date: Tue, 24 Jan 2023 17:27:27 +0700 Subject: [PATCH 09/10] feat: add port id copier for IBC Port Id --- .../components/InstantiateInfo.tsx | 33 +++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/src/lib/pages/contract-details/components/InstantiateInfo.tsx b/src/lib/pages/contract-details/components/InstantiateInfo.tsx index 364a8f461..1bf24d52c 100644 --- a/src/lib/pages/contract-details/components/InstantiateInfo.tsx +++ b/src/lib/pages/contract-details/components/InstantiateInfo.tsx @@ -1,5 +1,6 @@ -import { chakra, Divider, Flex, Text } from "@chakra-ui/react"; +import { Box, chakra, Divider, Flex, Text } from "@chakra-ui/react"; +import { Copier } from "lib/components/Copier"; import { ExplorerLink } from "lib/components/ExplorerLink"; import { LabelText } from "lib/components/LabelText"; import { useGetAddressType } from "lib/hooks"; @@ -19,6 +20,32 @@ const Container = chakra(Flex, { }, }); +const RenderPortId = ({ portId }: { portId: string }) => { + const charArray = portId.match(/.{1,28}/g); + + return ( + + {charArray?.map((line, idx) => + idx === charArray.length - 1 ? ( + + {line} + + + ) : ( + line + ) + )} + + ); +}; + export const InstantiateInfo = ({ contractData: { instantiateInfo, @@ -136,7 +163,9 @@ export const InstantiateInfo = ({ )} {instantiateInfo.ibcPortId && ( - {instantiateInfo.ibcPortId} + + + )} ); From a3ec953ae4edfe4dade654b1c3b9bb2fda5660bc Mon Sep 17 00:00:00 2001 From: poomthiti Date: Tue, 24 Jan 2023 17:32:49 +0700 Subject: [PATCH 10/10] chore: add changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index aa577e89a..d9cc0e4cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased ### Features + +- [#126](https://github.com/alleslabs/celatone-frontend/pull/126) Add port id copier for IBC port id - [#121](https://github.com/alleslabs/celatone-frontend/pull/121) Fix code snippet for query axios - [#76](https://github.com/alleslabs/celatone-frontend/pull/76) Add Public projects page - [#116](https://github.com/alleslabs/celatone-frontend/pull/116) Support Terra2.0 mainnet and testnet