-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #843 from alleslabs/feat/add-user-docs-navigation
- Loading branch information
Showing
35 changed files
with
622 additions
and
204 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { Flex, Heading, Text } from "@chakra-ui/react"; | ||
|
||
import { useMobile } from "lib/app-provider"; | ||
|
||
import { UserDocsLink } from "./UserDocsLink"; | ||
|
||
interface PageHeaderProps { | ||
title: string; | ||
subtitle: string; | ||
docHref: string; | ||
} | ||
|
||
export const PageHeader = ({ title, subtitle, docHref }: PageHeaderProps) => { | ||
const isMobile = useMobile(); | ||
return ( | ||
<Flex w="full" justifyContent="space-between" alignItems="center" mb={8}> | ||
<div> | ||
<Flex justifyContent="space-between"> | ||
<Heading | ||
as="h5" | ||
variant="h5" | ||
color="text.main" | ||
fontWeight={600} | ||
minH="36px" | ||
> | ||
{title} | ||
</Heading> | ||
{isMobile && <UserDocsLink href={docHref} isButton />} | ||
</Flex> | ||
<Text variant="body2" color="text.dark" fontWeight={500}> | ||
{subtitle} | ||
</Text> | ||
</div> | ||
{!isMobile && <UserDocsLink href={docHref} isButton />} | ||
</Flex> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
import { Button, Flex, Text } from "@chakra-ui/react"; | ||
import Link from "next/link"; | ||
|
||
import { trackWebsite } from "lib/amplitude"; | ||
import { DOCS_LINK } from "lib/data"; | ||
|
||
import { CustomIcon } from "./icon"; | ||
|
||
interface UserDocsLinkProps { | ||
href?: string; | ||
title?: string; | ||
cta?: string; | ||
isButton?: boolean; | ||
isSmall?: boolean; | ||
mt?: number; | ||
} | ||
|
||
export const UserDocsLink = ({ | ||
title, | ||
cta, | ||
href, | ||
isButton = false, | ||
isSmall = true, | ||
mt = 8, | ||
}: UserDocsLinkProps) => | ||
isButton ? ( | ||
<Link | ||
href={`${DOCS_LINK}/${href}`} | ||
onClick={(e) => { | ||
trackWebsite(`${DOCS_LINK}/${href}`); | ||
e.stopPropagation(); | ||
}} | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
> | ||
<Button | ||
variant={{ | ||
base: "ghost-primary", | ||
md: isSmall ? "ghost-primary" : "outline-primary", | ||
}} | ||
size={isSmall ? "sm" : "md"} | ||
leftIcon={<CustomIcon name="document" boxSize={3} />} | ||
> | ||
View Doc | ||
</Button> | ||
</Link> | ||
) : ( | ||
<Flex | ||
gap={{ base: 1, md: 2 }} | ||
alignItems="center" | ||
mt={mt} | ||
direction={{ base: "column", md: "row" }} | ||
> | ||
{title && ( | ||
<Text color="text.main" variant="body2"> | ||
{title} | ||
</Text> | ||
)} | ||
<Link | ||
href={`${DOCS_LINK}/${href}`} | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
> | ||
<Flex | ||
gap={1} | ||
alignItems="center" | ||
sx={{ | ||
cursor: "pointer", | ||
"&:hover": { | ||
"> *": { | ||
color: "secondary.light", | ||
textDecoration: "underline", | ||
transition: "all", | ||
transitionDuration: "0.25s", | ||
transitionTimingFunction: "ease-in-out", | ||
}, | ||
}, | ||
}} | ||
> | ||
<CustomIcon name="document" color="secondary.main" boxSize={3} /> | ||
<Text color="secondary.main" variant="body2"> | ||
{cta} | ||
</Text> | ||
</Flex> | ||
</Link> | ||
</Flex> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
import { track } from "@amplitude/analytics-browser"; | ||
import { Flex, Skeleton, Text } from "@chakra-ui/react"; | ||
import Link from "next/link"; | ||
|
||
import { AmpEvent, trackWebsite } from "lib/amplitude"; | ||
import type { IconKeys } from "lib/components/icon"; | ||
import { CustomIcon } from "lib/components/icon"; | ||
import { DOCS_LINK } from "lib/data"; | ||
import { useOverviewsStats } from "lib/services/overviewService"; | ||
|
||
const FOOTER_BUTTONS = [ | ||
{ | ||
href: `${DOCS_LINK}/introduction/user-introduction`, | ||
icon: "document" as IconKeys, | ||
text: "View Doc", | ||
onClick: () => trackWebsite(`${DOCS_LINK}/introduction/user-introduction`), | ||
}, | ||
{ | ||
href: "https://feedback.alleslabs.com", | ||
icon: "feedback" as IconKeys, | ||
text: "Feedback", | ||
onClick: () => track(AmpEvent.FEEDBACK), | ||
}, | ||
]; | ||
|
||
export const InformationFooter = () => { | ||
const { data: overviewsStats, isLoading } = useOverviewsStats(); | ||
|
||
return ( | ||
<Flex direction={{ base: "row", md: "column" }} mt={8} mb={2}> | ||
{isLoading ? ( | ||
<Skeleton | ||
ml={2} | ||
h={4} | ||
w={24} | ||
borderRadius={8} | ||
startColor="gray.500" | ||
endColor="gray.700" | ||
/> | ||
) : ( | ||
<Flex gap={1} py={1} px={2} align="center"> | ||
<CustomIcon name="block" color="gray.600" boxSize={3} /> | ||
<Text variant="body3" color="text.dark"> | ||
{overviewsStats?.latestBlock ?? "N/A"} | ||
</Text> | ||
{overviewsStats && ( | ||
<Flex | ||
w={2} | ||
h={2} | ||
bgColor="success.main" | ||
borderRadius="16px" | ||
sx={{ | ||
animation: `pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite`, | ||
"@keyframes pulse": { | ||
"0%, 100%": { opacity: 1 }, | ||
"50%": { opacity: 0.5 }, | ||
}, | ||
}} | ||
/> | ||
)} | ||
</Flex> | ||
)} | ||
<Flex> | ||
{FOOTER_BUTTONS.map(({ href, icon, text, onClick }) => ( | ||
<Link | ||
key={text} | ||
href={href} | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
onClick={onClick} | ||
> | ||
<Flex | ||
gap={1} | ||
py={1} | ||
px={2} | ||
borderRadius={4} | ||
align="center" | ||
cursor="pointer" | ||
_hover={{ background: "gray.800" }} | ||
transition="all 0.25s ease-in-out" | ||
> | ||
<CustomIcon name={icon} color="gray.600" boxSize={3} /> | ||
<Text variant="body3" color="text.dark"> | ||
{text} | ||
</Text> | ||
</Flex> | ||
</Link> | ||
))} | ||
</Flex> | ||
</Flex> | ||
); | ||
}; |
Oops, something went wrong.