diff --git a/CHANGELOG.md b/CHANGELOG.md index fc26cf4ef..2a91edcec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Improvements +- [#339](https://github.com/alleslabs/celatone-frontend/pull/339) Update all routes to plural form, and patch all codes - [#334](https://github.com/alleslabs/celatone-frontend/pull/334) Change `osmo-test-4` to `osmo-test-5`, fix tx service when accountId is undefined - [#311](https://github.com/alleslabs/celatone-frontend/pull/311) Refine css styling - [#328](https://github.com/alleslabs/celatone-frontend/pull/328) Add proposal and pool page in sidebar navigation diff --git a/next.config.js b/next.config.js index d3c571e65..be499fb84 100644 --- a/next.config.js +++ b/next.config.js @@ -33,6 +33,48 @@ const nextConfig = { }, ]; }, + async redirects() { + const routes = [ + "account", + "tx", + "block", + "code", + "contract", + "proposal", + "project", + "contract-list", + "past-tx", + "my-code", + ]; + + return routes.reduce((acc, route) => { + acc.push({ + source: `/:network/${route}/:id`, + destination: `/:network/${route}s/:id`, + permanent: false, + }); + + acc.push({ + source: `/${route}/:id`, + destination: `/${route}s/:id`, + permanent: false, + }); + + acc.push({ + source: `/:network/${route}`, + destination: `/:network/${route}s`, + permanent: false, + }); + + acc.push({ + source: `/${route}`, + destination: `/${route}s`, + permanent: false, + }); + + return acc; + }, []); + }, }; const moduleExports = { diff --git a/src/lib/components/ExplorerLink.tsx b/src/lib/components/ExplorerLink.tsx index d63d0c089..64064b1e4 100644 --- a/src/lib/components/ExplorerLink.tsx +++ b/src/lib/components/ExplorerLink.tsx @@ -43,22 +43,22 @@ const getNavigationUrl = ( let url = ""; switch (type) { case "tx_hash": - url = "/tx"; + url = "/txs"; break; case "contract_address": - url = "/contract"; + url = "/contracts"; break; case "user_address": - url = "/account"; + url = "/accounts"; break; case "validator_address": url = getExplorerValidatorUrl(currentChainName); break; case "code_id": - url = "/code"; + url = "/codes"; break; case "block_height": - url = "/block"; + url = "/blocks"; break; case "proposal_id": url = getExplorerProposalUrl(currentChainName); diff --git a/src/lib/components/StickySidebar.tsx b/src/lib/components/StickySidebar.tsx index 0558fe866..12cfb2c39 100644 --- a/src/lib/components/StickySidebar.tsx +++ b/src/lib/components/StickySidebar.tsx @@ -74,7 +74,9 @@ export const StickySidebar = ({ color: "lilac.light", bgColor: "lilac.background", }} - onClick={() => navigate({ pathname: "/proposal/store-code" })} + onClick={() => + navigate({ pathname: "/proposals/store-code" }) + } > Submit Proposal To Store Code diff --git a/src/lib/components/button/NewProposalButton.tsx b/src/lib/components/button/NewProposalButton.tsx index c2c3bcc65..f232db763 100644 --- a/src/lib/components/button/NewProposalButton.tsx +++ b/src/lib/components/button/NewProposalButton.tsx @@ -24,7 +24,7 @@ export const NewProposalButton = () => { icon={} onClick={() => { navigate({ - pathname: "/proposal/store-code", + pathname: "/proposals/store-code", }); }} > @@ -33,9 +33,8 @@ export const NewProposalButton = () => { {/* } onClick={() => { - // TODO - Change navigation path navigate({ - pathname: "/proposal-instantiate", + pathname: "/proposals/instantiate", }); }} > @@ -50,7 +49,7 @@ export const NewProposalButton = () => { icon={} onClick={() => { navigate({ - pathname: "/proposal/whitelist", + pathname: "/proposals/whitelist", }); }} > diff --git a/src/lib/components/modal/list/EditListName.tsx b/src/lib/components/modal/list/EditListName.tsx index 1c6be8db0..a46cdbada 100644 --- a/src/lib/components/modal/list/EditListName.tsx +++ b/src/lib/components/modal/list/EditListName.tsx @@ -69,13 +69,13 @@ export function EditListNameModal({ } + trigger={} mainBtnTitle="Save" mainAction={() => { handleSave(); if (reroute) navigate({ - pathname: "/contract-list/[slug]", + pathname: "/contract-lists/[slug]", query: { slug: formatSlugName(listName) }, replace: true, }); diff --git a/src/lib/components/modal/list/RemoveList.tsx b/src/lib/components/modal/list/RemoveList.tsx index 4a678d8f0..558fd5f02 100644 --- a/src/lib/components/modal/list/RemoveList.tsx +++ b/src/lib/components/modal/list/RemoveList.tsx @@ -24,8 +24,8 @@ export function RemoveListModal({ list, menuItemProps }: RemoveListModalProps) { const handleRemove = () => { AmpTrack(AmpEvent.LIST_REMOVE); removeList(userKey, list.value); - navigate({ pathname: "/contract-list" }); - // TODO: show toast after removed and redirect to /contract-list + navigate({ pathname: "/contract-lists" }); + // TODO: show toast after removed and redirect to /contract-lists setTimeout(() => { toast({ title: `Removed ${shortenName(list.label)}`, @@ -43,7 +43,7 @@ export function RemoveListModal({ list, menuItemProps }: RemoveListModalProps) { title={`Remove ${shortenName(list.label)}?`} icon="delete" iconColor="error.light" - trigger={} + trigger={} mainBtnTitle="Yes, Remove list" mainAction={handleRemove} otherBtnTitle="No, Keep It" diff --git a/src/lib/components/tx/modal/ButtonSection.tsx b/src/lib/components/tx/modal/ButtonSection.tsx index f68082569..16a463e97 100644 --- a/src/lib/components/tx/modal/ButtonSection.tsx +++ b/src/lib/components/tx/modal/ButtonSection.tsx @@ -50,7 +50,7 @@ export const ButtonSection = ({