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(components): adjust navigation and overview page for lite version #898

Merged
merged 21 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
52a148f
feat(components): adjust navigation and overview page for lite version
jennieramida Apr 26, 2024
9180fc2
fix(components): fix userdoc link
jennieramida Apr 26, 2024
35089ef
fix(components): fix mobile nav
jennieramida Apr 26, 2024
904f6b8
fix(components): fix layout and restructure
jennieramida Apr 26, 2024
8e70770
fix(components): fix menu order and add gov config
jennieramida Apr 26, 2024
3bc6da3
fix(components): fix as comment
jennieramida Apr 29, 2024
6b74456
fix(components): adjust submenu and nav bar order
jennieramida Apr 29, 2024
561149b
fix(components): adjust layout overview
jennieramida Apr 30, 2024
12b5d5f
fix: misc
songwongtp Apr 30, 2024
8bad166
Merge branch 'develop' into feat/cfe-409-navbar-tier
jennieramida Apr 30, 2024
40f345a
fix(components): move page container back to separate file
jennieramida Apr 30, 2024
546e626
fix: as comments
evilpeach Apr 30, 2024
2754695
fix(components): refactor subheadermenu and navdrawer
jennieramida May 8, 2024
608acb5
feat: refactor
evilpeach May 9, 2024
5ed3178
Merge branch 'develop' into feat/cfe-409-navbar-tier
evilpeach May 9, 2024
f7a62f2
fix: remove CURR_THEME color
evilpeach May 9, 2024
658609a
fix(components): fix gradient color for overview card
jennieramida May 9, 2024
591a42b
fix(components): fix color
jennieramida May 9, 2024
3b2082b
fix(components): make network seletor scrollable
jennieramida May 9, 2024
0a0cf96
fix(components): adjust gradient color
jennieramida May 9, 2024
b75f346
fix(components): fix network selector mobile max height
jennieramida May 9, 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
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

- [#898](https://github.com/alleslabs/celatone-frontend/pull/898) Adjust navigation and overview page for lite version
- [#897](https://github.com/alleslabs/celatone-frontend/pull/897) Add config for lite version support

### Improvements
Expand Down
2 changes: 1 addition & 1 deletion src/lib/layout/NetworkMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export const NetworkMenu = () => {
<CustomIcon name="chevron-down" color="gray.600" />
</Flex>
</MenuButton>
<MenuList zIndex="dropdown">
<MenuList zIndex="dropdown" maxH="70vh" overflow="scroll">
{availableChainIds.map((chainId) => (
<MenuItem
key={chainId}
Expand Down
140 changes: 92 additions & 48 deletions src/lib/layout/SubHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,106 +6,150 @@ import {
useMoveConfig,
useNftConfig,
usePoolConfig,
useTierConfig,
useWasmConfig,
} from "lib/app-provider";
import { AppLink } from "lib/components/AppLink";
import type { IconKeys } from "lib/components/icon";
import { CustomIcon } from "lib/components/icon";
import { useIsCurrentPage } from "lib/hooks";

const ACTIVE_COLOR = "primary.light";

interface SubHeaderMenuInfo {
name: string;
slug: string;
icon: IconKeys;
}

const SubHeader = () => {
const tier = useTierConfig();
const govConfig = useGovConfig({ shouldRedirect: false });
const wasmConfig = useWasmConfig({ shouldRedirect: false });
const moveConfig = useMoveConfig({ shouldRedirect: false });
const nftConfig = useNftConfig({ shouldRedirect: false });
const poolConfig = usePoolConfig({ shouldRedirect: false });

const subHeaderMenu: SubHeaderMenuInfo[] = [
{ name: "Overview", slug: "/", icon: "home" },
{ name: "Transactions", slug: "/txs", icon: "file" },
{ name: "Blocks", slug: "/blocks", icon: "block" },
];

if (govConfig.enabled)
subHeaderMenu.push(
{ name: "Validators", slug: "/validators", icon: "validator" },
{ name: "Proposals", slug: "/proposals", icon: "proposal" }
);

if (wasmConfig.enabled)
subHeaderMenu.push(
{ name: "Codes", slug: "/codes", icon: "code" },
{ name: "Contracts", slug: "/contracts", icon: "contract-address" }
);

if (moveConfig.enabled)
subHeaderMenu.push({
name: "Modules",
slug: "/modules",
icon: "contract-address",
});

if (nftConfig.enabled)
subHeaderMenu.push({
name: "NFTs",
slug: "/nft-collections",
icon: "group",
});

if (poolConfig.enabled)
subHeaderMenu.push({ name: "Osmosis Pools", slug: "/pools", icon: "pool" });

const isCurrentPage = useIsCurrentPage();

const activeColor = "primary.light";

const trackOnClick = (tab: string) => {
track(AmpEvent.USE_TOPBAR, { tab });
};
const subMenu: SubHeaderMenuInfo[] =
jennieramida marked this conversation as resolved.
Show resolved Hide resolved
tier === "full"
? [
{ name: "Overview", slug: "/", icon: "home" },
{ name: "Transactions", slug: "/txs", icon: "file" },
{ name: "Blocks", slug: "/blocks", icon: "block" },
...(govConfig.enabled
? [
{
name: "Validators",
slug: "/validators",
icon: "validator" as IconKeys,
},
{
name: "Proposals",
slug: "/proposals",
icon: "proposal" as IconKeys,
},
]
: []),
jennieramida marked this conversation as resolved.
Show resolved Hide resolved
...(wasmConfig.enabled
? [
{ name: "Codes", slug: "/codes", icon: "code" as IconKeys },
{
name: "Contracts",
slug: "/contracts",
icon: "contract-address" as IconKeys,
},
]
: []),
...(moveConfig.enabled
? [
{
name: "Modules",
slug: "/modules",
icon: "contract-address" as IconKeys,
},
]
: []),
...(nftConfig.enabled
? [
{
name: "NFTs",
slug: "/nft-collections",
icon: "group" as IconKeys,
},
]
: []),
...(poolConfig.enabled
? [
{
name: "Osmosis Pools",
slug: "/pools",
icon: "pool" as IconKeys,
},
]
: []),
]
jennieramida marked this conversation as resolved.
Show resolved Hide resolved
: [
{ name: "Overview", slug: "/", icon: "home" },
...(govConfig.enabled
? [
{
name: "Validators",
slug: "/validators",
icon: "validator" as IconKeys,
},
{
name: "Proposals",
slug: "/proposals",
icon: "proposal" as IconKeys,
},
]
: []),
...(wasmConfig.enabled
? [{ name: "Codes", slug: "/codes", icon: "code" as IconKeys }]
: []),
];

return (
<Flex px={6} h="full">
{subHeaderMenu.map((item) => (
{subMenu.map((item) => (
<AppLink
href={item.slug}
key={item.slug}
onClick={() => trackOnClick(item.name)}
onClick={() => track(AmpEvent.USE_TOPBAR, { tab: item.name })}
>
<Flex
alignItems="center"
px={4}
gap={2}
h="full"
borderBottomWidth={2}
borderColor={isCurrentPage(item.slug) ? activeColor : "transparent"}
borderColor={
isCurrentPage(item.slug) ? ACTIVE_COLOR : "transparent"
}
transition="all 0.25s ease-in-out"
_hover={{ borderColor: activeColor }}
_hover={{ borderColor: ACTIVE_COLOR }}
sx={{
_hover: {
"> svg, > p": {
color: activeColor,
color: ACTIVE_COLOR,
transition: "all .25s ease-in-out",
},
borderBottomWidth: 2,
borderColor: activeColor,
borderColor: ACTIVE_COLOR,
},
}}
>
<CustomIcon
boxSize={3}
name={item.icon}
color={isCurrentPage(item.slug) ? activeColor : "gray.600"}
color={isCurrentPage(item.slug) ? ACTIVE_COLOR : "gray.600"}
/>
<Text
variant="body2"
fontWeight={700}
color={isCurrentPage(item.slug) ? activeColor : "text.dark"}
color={isCurrentPage(item.slug) ? ACTIVE_COLOR : "text.dark"}
>
{item.name}
</Text>
Expand Down
Loading
Loading