Skip to content

Commit

Permalink
Merge branch 'dev' into cleanPublicFolder
Browse files Browse the repository at this point in the history
  • Loading branch information
corwintines authored Jun 13, 2024
2 parents 7c16f3c + 4560e3a commit 42ab0e8
Show file tree
Hide file tree
Showing 41 changed files with 268 additions and 128 deletions.
7 changes: 7 additions & 0 deletions .github/ISSUE_TEMPLATE/suggest_dapp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ body:
description: Please provide the official name of the dapp
validations:
required: true
- type: input
id: dapp_url
attributes:
label: Dapp URL
description: Please provide a URL to the dapp
validations:
required: true
- type: textarea
id: dapp_description
attributes:
Expand Down
2 changes: 1 addition & 1 deletion public/content/developers/docs/accounts/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ There is also another type of key in Ethereum, introduced when Ethereum switched

## A note on wallets {#a-note-on-wallets}

An account is not a wallet. An account is the keypair for a user-owned Ethereum account. A wallet is an interface or application that lets you interact with your Ethereum account.
An account is not a wallet. A wallet is an interface or application that lets you interact with your Ethereum account, either an externally-owned account or a contract account.

## A visual demo {#a-visual-demo}

Expand Down
11 changes: 4 additions & 7 deletions src/components/FileContributors.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { useState } from "react"
import { useRouter } from "next/router"
import {
Avatar,
Flex,
Expand All @@ -9,7 +8,7 @@ import {
VStack,
} from "@chakra-ui/react"

import type { ChildOnlyProp, FileContributor, Lang } from "@/lib/types"
import type { ChildOnlyProp, FileContributor } from "@/lib/types"

import { Button } from "@/components/Buttons"
import InlineLink from "@/components/Link"
Expand All @@ -18,7 +17,6 @@ import Text from "@/components/OldText"
import Translation from "@/components/Translation"

import { trackCustomEvent } from "@/lib/utils/matomo"
import { getLocaleTimestamp } from "@/lib/utils/time"

const ContributorList = ({ children }: Required<ChildOnlyProp>) => (
<UnorderedList maxH="2xs" m={0} mt={6} overflowY="scroll">
Expand All @@ -44,16 +42,15 @@ const Contributor = ({ contributor }: ContributorProps) => (

export type FileContributorsProps = FlexProps & {
contributors: FileContributor[]
lastEdit: string
lastEditLocaleTimestamp: string
}

const FileContributors = ({
contributors,
lastEdit,
lastEditLocaleTimestamp,
...props
}: FileContributorsProps) => {
const [isModalOpen, setModalOpen] = useState(false)
const { locale } = useRouter()

const lastContributor: FileContributor = contributors.length
? contributors[0]
Expand Down Expand Up @@ -102,7 +99,7 @@ const FileContributors = ({
<InlineLink href={"https://github.com/" + lastContributor.login}>
@{lastContributor.login}
</InlineLink>
, {getLocaleTimestamp(locale as Lang, lastEdit)}
, {lastEditLocaleTimestamp}
</Text>
</Flex>

Expand Down
27 changes: 9 additions & 18 deletions src/components/Footer.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { useRouter } from "next/router"
import { useTranslation } from "next-i18next"
import { FaDiscord, FaGithub, FaTwitter } from "react-icons/fa"
import { IoChevronUpSharp } from "react-icons/io5"
Expand All @@ -13,13 +12,12 @@ import {
Text,
} from "@chakra-ui/react"

import type { FooterLink, FooterLinkSection, Lang } from "@/lib/types"
import type { FooterLink, FooterLinkSection } from "@/lib/types"

import { BaseLink } from "@/components/Link"
import Translation from "@/components/Translation"

import { scrollIntoView } from "@/lib/utils/scrollIntoView"
import { getLocaleTimestamp } from "@/lib/utils/time"

import { Button } from "./Buttons"

Expand All @@ -42,11 +40,10 @@ const socialLinks = [
]

type FooterProps = {
lastDeployDate: string
lastDeployLocaleTimestamp: string
}

const Footer = ({ lastDeployDate }: FooterProps) => {
const { locale } = useRouter()
const Footer = ({ lastDeployLocaleTimestamp }: FooterProps) => {
const { t } = useTranslation("common")

const linkSections: FooterLinkSection[] = [
Expand Down Expand Up @@ -319,6 +316,7 @@ const Footer = ({ lastDeployDate }: FooterProps) => {
fill: "primary.base",
},
}

const linkProps = {
isPartiallyActive: false,
textDecor: "none",
Expand All @@ -335,7 +333,7 @@ const Footer = ({ lastDeployDate }: FooterProps) => {
return (
<Box as="footer" py="4" px="8">
<Flex
justify={{ base: "center", md: 'space-between'}}
justify={{ base: "center", md: "space-between" }}
alignItems="center"
flexWrap="wrap"
gap={8}
Expand All @@ -344,12 +342,9 @@ const Footer = ({ lastDeployDate }: FooterProps) => {
borderTop={"1px solid"}
borderColor={"body.light"}
>
{lastDeployDate && (
<Text fontSize={"sm"} fontStyle={"italic"} color={"body.medium"}>
<Translation id="website-last-updated" />:{" "}
{getLocaleTimestamp(locale as Lang, lastDeployDate)}
</Text>
)}
<Text fontSize={"sm"} fontStyle={"italic"} color={"body.medium"}>
<Translation id="website-last-updated" />: {lastDeployLocaleTimestamp}
</Text>

<Button
leftIcon={<IoChevronUpSharp />}
Expand Down Expand Up @@ -428,11 +423,7 @@ const Footer = ({ lastDeployDate }: FooterProps) => {
m={0}
>
{dipperLinks.map(({ to, text }) => (
<ListItem
key={text}
textAlign="center"
px="2"
>
<ListItem key={text} textAlign="center" px="2">
<BaseLink href={to} w={["100%", null]} {...linkProps}>
{text}
</BaseLink>
Expand Down
8 changes: 4 additions & 4 deletions src/layouts/Docs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,11 @@ type DocsLayoutProps = Pick<
MdPageContent,
| "slug"
| "tocItems"
| "lastUpdatedDate"
| "lastEditLocaleTimestamp"
| "contributors"
| "contentNotTranslated"
> &
Required<Pick<MdPageContent, "lastUpdatedDate">> &
Required<Pick<MdPageContent, "lastEditLocaleTimestamp">> &
ChildOnlyProp & {
frontmatter: DocsFrontmatter
}
Expand All @@ -211,7 +211,7 @@ export const DocsLayout = ({
frontmatter,
slug,
tocItems,
lastUpdatedDate,
lastEditLocaleTimestamp,
contributors,
contentNotTranslated,
}: DocsLayoutProps) => {
Expand All @@ -233,7 +233,7 @@ export const DocsLayout = ({
<H1 id="top">{frontmatter.title}</H1>
<FileContributors
contributors={contributors}
lastEdit={lastUpdatedDate}
lastEditLocaleTimestamp={lastEditLocaleTimestamp}
/>
<TableOfContents
slug={slug}
Expand Down
2 changes: 1 addition & 1 deletion src/layouts/Roadmap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
WrapItem,
} from "@chakra-ui/react"

import type { ChildOnlyProp, TranslationKey } from "@/lib/types"
import type { ChildOnlyProp } from "@/lib/types"
import type { MdPageContent, RoadmapFrontmatter } from "@/lib/interfaces"

import Breadcrumbs from "@/components/Breadcrumbs"
Expand Down
4 changes: 2 additions & 2 deletions src/layouts/RootLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const RootLayout = ({
children,
// contentIsOutdated,
// contentNotTranslated,
lastDeployDate,
lastDeployLocaleTimestamp,
}: Root) => {
// const { locale, asPath } = useRouter()

Expand Down Expand Up @@ -68,7 +68,7 @@ export const RootLayout = ({

{children}

<Footer lastDeployDate={lastDeployDate} />
<Footer lastDeployLocaleTimestamp={lastDeployLocaleTimestamp} />
<FeedbackWidget />
</Container>
)
Expand Down
22 changes: 10 additions & 12 deletions src/layouts/Static.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import TranslationChartImage from "@/components/TranslationChartImage"
import UpcomingEventsList from "@/components/UpcomingEventsList"

import { getEditPath } from "@/lib/utils/editPath"
import { getLocaleTimestamp } from "@/lib/utils/time"
import { isLangRightToLeft } from "@/lib/utils/translations"

import GuideHeroImage from "@/public/images/heroes/guides-hub-hero.jpg"
Expand Down Expand Up @@ -76,7 +75,7 @@ export const staticComponents = {
type StaticLayoutProps = ChildOnlyProp &
Pick<
MdPageContent,
"slug" | "tocItems" | "lastUpdatedDate" | "contentNotTranslated"
"slug" | "tocItems" | "lastEditLocaleTimestamp" | "contentNotTranslated"
> & {
frontmatter: StaticFrontmatter
}
Expand All @@ -85,7 +84,7 @@ export const StaticLayout = ({
frontmatter,
slug,
tocItems,
lastUpdatedDate,
lastEditLocaleTimestamp,
contentNotTranslated,
}: StaticLayoutProps) => {
const { locale, asPath } = useRouter()
Expand Down Expand Up @@ -115,15 +114,14 @@ export const StaticLayout = ({
) : (
<>
<Breadcrumbs slug={slug} mb="8" />
{lastUpdatedDate && (
<Text
color="text200"
dir={isLangRightToLeft(locale as Lang) ? "rtl" : "ltr"}
>
<Translation id="page-last-updated" />:{" "}
{getLocaleTimestamp(locale as Lang, lastUpdatedDate)}
</Text>
)}

<Text
color="text200"
dir={isLangRightToLeft(locale as Lang) ? "rtl" : "ltr"}
>
<Translation id="page-last-updated" />:{" "}
{lastEditLocaleTimestamp}
</Text>
</>
)}

Expand Down
6 changes: 3 additions & 3 deletions src/layouts/Tutorial.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export const tutorialsComponents = {
}
type TutorialLayoutProps = ChildOnlyProp &
Pick<MdPageContent, "tocItems" | "contributors" | "contentNotTranslated"> &
Required<Pick<MdPageContent, "lastUpdatedDate">> & {
Required<Pick<MdPageContent, "lastEditLocaleTimestamp">> & {
frontmatter: TutorialFrontmatter
timeToRead: number
}
Expand All @@ -165,7 +165,7 @@ export const TutorialLayout = ({
frontmatter,
tocItems,
timeToRead,
lastUpdatedDate,
lastEditLocaleTimestamp,
contributors,
contentNotTranslated,
}: TutorialLayoutProps) => {
Expand Down Expand Up @@ -196,7 +196,7 @@ export const TutorialLayout = ({
{children}
<FileContributors
contributors={contributors}
lastEdit={lastUpdatedDate}
lastEditLocaleTimestamp={lastEditLocaleTimestamp}
/>
<FeedbackCard />
</ContentContainer>
Expand Down
19 changes: 7 additions & 12 deletions src/layouts/Upgrade.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { useRouter } from "next/router"
import { useTranslation } from "next-i18next"
import {
Box,
Expand All @@ -10,7 +9,7 @@ import {
useToken,
} from "@chakra-ui/react"

import type { ChildOnlyProp, Lang } from "@/lib/types"
import type { ChildOnlyProp } from "@/lib/types"
import type { MdPageContent, UpgradeFrontmatter } from "@/lib/interfaces"

import BeaconChainActions from "@/components/BeaconChainActions"
Expand All @@ -29,7 +28,6 @@ import MergeInfographic from "@/components/MergeInfographic"
import UpgradeStatus from "@/components/UpgradeStatus"

import { getSummaryPoints } from "@/lib/utils/getSummaryPoints"
import { getLocaleTimestamp } from "@/lib/utils/time"

const Page = (props: FlexProps) => <MdPage sx={{}} {...props} />

Expand Down Expand Up @@ -62,7 +60,7 @@ export const upgradeComponents = {
type UpgradeLayoutProps = ChildOnlyProp &
Pick<
MdPageContent,
"slug" | "tocItems" | "lastUpdatedDate" | "contentNotTranslated"
"slug" | "tocItems" | "lastEditLocaleTimestamp" | "contentNotTranslated"
> & {
frontmatter: UpgradeFrontmatter
}
Expand All @@ -71,11 +69,10 @@ export const UpgradeLayout = ({
frontmatter,
slug,
tocItems,
lastUpdatedDate,
lastEditLocaleTimestamp,
contentNotTranslated,
}: UpgradeLayoutProps) => {
const { t } = useTranslation("page-upgrades")
const { locale } = useRouter()

const summaryPoints = getSummaryPoints(frontmatter)

Expand Down Expand Up @@ -120,12 +117,10 @@ export const UpgradeLayout = ({
))}
</List>
</Box>
{lastUpdatedDate && (
<LastUpdated>
{t("common:page-last-updated")}:{" "}
{getLocaleTimestamp(locale as Lang, lastUpdatedDate)}
</LastUpdated>
)}

<LastUpdated>
{t("common:page-last-updated")}: {lastEditLocaleTimestamp}
</LastUpdated>
</>
}
heroImg={frontmatter.image}
Expand Down
3 changes: 2 additions & 1 deletion src/lib/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ export interface MdPageContent {
content: string
frontmatter: Frontmatter
tocItems: ToCItem[]
lastUpdatedDate?: string
lastEditLocaleTimestamp: string
lastDeployLocaleTimestamp: string
contentNotTranslated: boolean
contributors: FileContributor[]
}
Expand Down
4 changes: 2 additions & 2 deletions src/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ export type Root = {
children: ReactNode
contentIsOutdated: boolean
contentNotTranslated: boolean
lastDeployDate: string
lastDeployLocaleTimestamp: string
}

export type BasePageProps = SSRConfig &
Pick<Root, "contentNotTranslated" | "lastDeployDate">
Pick<Root, "contentNotTranslated" | "lastDeployLocaleTimestamp">

export type Frontmatter = RoadmapFrontmatter &
UpgradeFrontmatter &
Expand Down
8 changes: 7 additions & 1 deletion src/lib/utils/md.ts
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,13 @@ export const getContentBySlug = (slug: string) => {
const fileContents = fs.readFileSync(fullPath, "utf8")
const { data, content } = matter(fileContents)
const frontmatter = data as Frontmatter
const items: Omit<MdPageContent, "tocItems" | "contributors"> = {
const items: Omit<
MdPageContent,
| "tocItems"
| "contributors"
| "lastEditLocaleTimestamp"
| "lastDeployLocaleTimestamp"
> = {
slug,
content,
frontmatter,
Expand Down
Loading

0 comments on commit 42ab0e8

Please sign in to comment.