Skip to content

Commit 7967620

Browse files
committed
add it on dapps page
1 parent d24cbbd commit 7967620

File tree

2 files changed

+29
-3
lines changed

2 files changed

+29
-3
lines changed

src/lib/utils/contributors.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,12 @@ export const getPageContributorInfo = async (
5454
cache
5555
)
5656

57+
const latestCommitDate = getLastModifiedDate(pagePath, locale!)
58+
const gitHubLastEdit = gitContributors[0]?.date
59+
5760
const lastEditLocaleTimestamp = getLocaleTimestamp(
5861
locale,
59-
gitContributors[0].date as string
62+
gitHubLastEdit || latestCommitDate
6063
)
6164

6265
return { contributors: gitContributors, lastEditLocaleTimestamp }

src/pages/dapps.tsx

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@ import { useRouter } from "next/router"
1111
import { useTranslation } from "next-i18next"
1212
import { serverSideTranslations } from "next-i18next/serverSideTranslations"
1313

14-
import type { BasePageProps, ChildOnlyProp, Lang } from "@/lib/types"
14+
import type {
15+
BasePageProps,
16+
ChildOnlyProp,
17+
CommitHistory,
18+
Lang,
19+
} from "@/lib/types"
1520

1621
import BoxGrid from "@/components/BoxGrid"
1722
import Callout from "@/components/Callout"
@@ -20,6 +25,7 @@ import Card from "@/components/Card"
2025
import DocLink from "@/components/DocLink"
2126
import Emoji from "@/components/Emoji"
2227
import FeedbackCard from "@/components/FeedbackCard"
28+
import FileContributors from "@/components/FileContributors"
2329
import GhostCard from "@/components/GhostCard"
2430
import { Image } from "@/components/Image"
2531
import InfoBanner from "@/components/InfoBanner"
@@ -38,6 +44,7 @@ import InlineLink, { BaseLink } from "@/components/ui/Link"
3844
import { Tag } from "@/components/ui/tag"
3945

4046
import { cn } from "@/lib/utils/cn"
47+
import { getPageContributorInfo } from "@/lib/utils/contributors"
4148
import { existsNamespace } from "@/lib/utils/existsNamespace"
4249
import { getLastDeployDate } from "@/lib/utils/getLastDeployDate"
4350
import { trackCustomEvent } from "@/lib/utils/matomo"
@@ -331,16 +338,27 @@ export const getStaticProps = (async ({ locale }) => {
331338
lastDeployDate
332339
)
333340

341+
const commitHistoryCache: CommitHistory = {}
342+
343+
const { contributors, lastEditLocaleTimestamp } =
344+
await getPageContributorInfo(
345+
"dapps.tsx",
346+
locale as Lang,
347+
commitHistoryCache
348+
)
349+
334350
return {
335351
props: {
336352
...(await serverSideTranslations(locale!, requiredNamespaces)),
337353
contentNotTranslated,
338354
lastDeployLocaleTimestamp,
355+
contributors,
356+
lastEditLocaleTimestamp,
339357
},
340358
}
341359
}) satisfies GetStaticProps<BasePageProps>
342360

343-
const DappsPage = () => {
361+
const DappsPage = ({ contributors, lastEditLocaleTimestamp }) => {
344362
const { t } = useTranslation(["page-dapps", "common"])
345363
const { locale, query } = useRouter()
346364

@@ -1802,6 +1820,11 @@ const DappsPage = () => {
18021820
</Row>
18031821
</Content>
18041822
<Content>
1823+
<FileContributors
1824+
className="my-10 border-t"
1825+
contributors={contributors}
1826+
lastEditLocaleTimestamp={lastEditLocaleTimestamp}
1827+
/>
18051828
<FeedbackCard />
18061829
</Content>
18071830
</Page>

0 commit comments

Comments
 (0)