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

Feat/overview new action #102

Merged
merged 13 commits into from
Jan 25, 2023
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
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
1 change: 1 addition & 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

- [#102](https://github.com/alleslabs/celatone-frontend/pull/102) Add quick menu in overview and add highlighted in left sidebar
- [#92](https://github.com/alleslabs/celatone-frontend/pull/92) Create select contract component for admin and migrate pages
- [#101](https://github.com/alleslabs/celatone-frontend/pull/101) Fix incorrect truncating of proposal id in contract detail's migration table
- [#100](https://github.com/alleslabs/celatone-frontend/pull/100) Fix contract instantiated time parsing
Expand Down
2 changes: 1 addition & 1 deletion src/lib/data/constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { MdBookmark, MdInbox, MdLibraryBooks } from "react-icons/md";

import { MsgType } from "lib/types";

export const INSTANTIATED_LIST_NAME = "Instantiated by me";
export const INSTANTIATED_LIST_NAME = "Instantiated Contracts";
jennieramida marked this conversation as resolved.
Show resolved Hide resolved

export const SAVED_LIST_NAME = "Saved Contracts";

Expand Down
34 changes: 27 additions & 7 deletions src/lib/layout/Navbar.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Flex, Box, Text, Icon, Button, Spacer } from "@chakra-ui/react";
import { Flex, Box, Text, Icon } from "@chakra-ui/react";
import { useWallet } from "@cosmos-kit/react";
import { observer } from "mobx-react-lite";
import { useRouter } from "next/router";
import {
MdHome,
MdCode,
Expand Down Expand Up @@ -48,6 +49,11 @@ const Navbar = observer(() => {
{
category: "Quick Actions",
submenu: [
{
name: "Deploy contract",
slug: "/deploy",
icon: MdOutlineAdd,
},
{
name: "Query",
slug: "/query",
Expand Down Expand Up @@ -111,10 +117,20 @@ const Navbar = observer(() => {
// ],
// },
];

const router = useRouter();
const isCurrentPage = (slug: string) => {
const { network } = router.query;
const pathName = router.asPath;
if (network) {
return slug === "/"
? pathName === `/${network}`
: pathName === `/${network}${slug}`;
}
return pathName === `${slug}`;
};
return (
<Flex direction="column" h="full" overflow="hidden" position="relative">
<Box p={4} overflowY="scroll" pb={12}>
<Box p={3} overflowY="scroll">
{navMenu.map((item) => (
<Box
pb="4"
Expand Down Expand Up @@ -146,12 +162,16 @@ const Navbar = observer(() => {
{item.submenu.map((submenu) => (
<AppLink href={submenu.slug} key={submenu.slug}>
<Flex
gap="3"
gap="2"
p={2}
cursor="pointer"
_hover={{ bg: "gray.800", borderRadius: "4px" }}
transition="all .25s ease-in-out"
alignItems="center"
bgColor={
isCurrentPage(submenu.slug) ? "gray.800" : "transparent"
}
borderRadius={isCurrentPage(submenu.slug) ? "4px" : "0px"}
>
<Icon as={submenu.icon} color="gray.600" boxSize="4" />
<Text variant="body2" className="ellipsis">
Expand All @@ -163,8 +183,8 @@ const Navbar = observer(() => {
</Box>
))}
</Box>
<Spacer />
<Flex
{/* Hide deploy new contract button for now */}
{/* <Flex
position="fixed"
bottom="0"
py={3}
Expand All @@ -181,7 +201,7 @@ const Navbar = observer(() => {
Deploy new contract
</Button>
</AppLink>
</Flex>
</Flex> */}
</Flex>
);
});
Expand Down
35 changes: 27 additions & 8 deletions src/lib/pages/home/components/QuickMenu.tsx
Original file line number Diff line number Diff line change
@@ -1,30 +1,48 @@
import { Flex, Heading, Box, Text, Icon } from "@chakra-ui/react";
import { MdChevronRight, MdSearch, MdInput } from "react-icons/md";
import { Flex, Heading, Box, Text, Icon, SimpleGrid } from "@chakra-ui/react";
import {
MdChevronRight,
MdSearch,
MdInput,
MdReadMore,
MdPerson,
} from "react-icons/md";

import { AppLink } from "lib/components/AppLink";
import { ConnectWalletAlert } from "lib/components/ConnectWalletAlert";

// TODO remove link text-decoration underline
const cardProps = {
width: "100%",
padding: "16px",
borderRadius: "4px",
justifyContent: "space-between",
height: "100%",
};

const secondaryMenu = [
{
title: "Query",
subtitle: "Query and get response from smart contract",
subtitle: "Query and get state data",
slug: "query",
icon: MdSearch,
},
{
title: "Execute",
subtitle: "Send execute messages to smart contract",
subtitle: "Send transactions to contracts",
slug: "execute",
icon: MdInput,
},
{
title: "Migrate",
subtitle: "Migrate to other Code ID",
slug: "migrate",
icon: MdReadMore,
},
{
title: "Update Admin",
subtitle: "Change contract admin",
slug: "admin",
icon: MdPerson,
},
];

export const QuickMenu = () => {
Expand All @@ -38,7 +56,7 @@ export const QuickMenu = () => {
subtitle="Actions such as deploying new contracts or sending execute messages require a wallet connection."
/>
<Flex gap={4}>
<AppLink href="/deploy" style={{ width: "100%" }}>
<AppLink href="/deploy" style={{ width: "55%" }}>
<Flex
bg="primary.main"
_hover={{ bg: "primary.light" }}
Expand All @@ -58,7 +76,8 @@ export const QuickMenu = () => {
<Icon as={MdChevronRight} color="gray.900" boxSize={9} />
</Flex>
</AppLink>
<Flex direction="column" gap={4} w="full">

<SimpleGrid columns={2} spacing={3} w="full">
{secondaryMenu.map((item) => (
<AppLink href={`/${item.slug}`} key={item.slug}>
<Flex
Expand Down Expand Up @@ -87,7 +106,7 @@ export const QuickMenu = () => {
</Flex>
</AppLink>
))}
</Flex>
</SimpleGrid>
</Flex>
</Flex>
);
Expand Down