Skip to content
This repository was archived by the owner on Dec 23, 2025. It is now read-only.

Commit 2831873

Browse files
committed
feat(web): add page route
1 parent 57bd4dc commit 2831873

20 files changed

Lines changed: 146 additions & 21 deletions

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"cryptodex",
44
"highcharts",
55
"packedbubble",
6+
"strapi",
67
"tanstack"
78
]
89
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { ReactNode } from "react";
2+
import { Header } from "../_components/header";
3+
import { getHeaderNavItems } from "@/lib/api/common";
4+
5+
export default async function Layout({ children }: { children: ReactNode}) {
6+
const headerNavItems = await getHeaderNavItems()
7+
return (
8+
<div>
9+
<Header headerNavItems={headerNavItems} />
10+
{children}
11+
</div>
12+
)
13+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
export default function NotFound() {
2+
return (
3+
<div
4+
style={{ height: 'calc(100dvh - 56px)' }}
5+
className="flex flex-col items-center justify-center gap-4"
6+
>
7+
<svg
8+
width="128"
9+
fill="currentColor"
10+
className="text-primary mb-4"
11+
viewBox="0 0 112 138"
12+
>
13+
<path
14+
fillRule="evenodd"
15+
clipRule="evenodd"
16+
d="M12 4h88a8 8 0 018 8v108H4V12a8 8 0 018-8zM0 12C0 5.373 5.373 0 12 0h88c6.627 0 12 5.373 12 12v112h-8.131v13.156H10V124H0V12zm21.603 5.953h67.954c.565 0 1.023.458 1.023 1.023V72.93c0 .565-.458 1.023-1.023 1.023H21.603a1.023 1.023 0 01-1.023-1.023V18.976c0-.565.458-1.023 1.023-1.023zm-5.023 1.023a5.023 5.023 0 015.023-5.023h67.954a5.023 5.023 0 015.023 5.023V72.93a5.023 5.023 0 01-5.023 5.023H21.603a5.023 5.023 0 01-5.023-5.023V18.976zm83.29 105.522H14v8.658h85.87v-8.658zM92.433 93.94H64.81v5.074h27.626V93.94zm-80.877 10.074h10.046v5.074H11.557v-5.074zm18.836-78.9h-3.767v5.165h3.767v-5.165zm5.023 0h3.767v5.165h-3.767v-5.165zm12.557 0h-3.767v5.165h3.767v-5.165zm5.023 0h3.767v5.165h-3.767v-5.165zm12.557 0h-3.767v5.165h3.767v-5.165zm5.023 0h3.767v5.165h-3.767v-5.165zM30.393 35.16h-3.767v5.164h3.767V35.16zm5.023 0h3.767v5.164h-3.767V35.16zm12.557 0h-3.767v5.164h3.767V35.16zm5.023 0h3.767v5.164h-3.767V35.16zM30.393 45.206h-3.767v5.164h3.767v-5.164zm5.023 0h3.767v5.164h-3.767v-5.164zM30.393 55.25h-3.767v5.165h3.767v-5.164zm5.023 0h3.767v5.165h-3.767v-5.164zm12.557 0h-3.767v5.165h3.767v-5.164zm12.624-6.76l3.114-3.115 7.41 7.41 7.007-7.006 3.293 3.294-7.006 7.007 7.41 7.41-3.114 3.114-7.41-7.41-7.007 7.006-3.293-3.294 7.006-7.006-7.41-7.41z"
17+
></path>
18+
</svg>
19+
<h1 className="text-5xl">Not found</h1>
20+
<div className="text-sm sm:text-base">
21+
The page you're trying to access does not exist.
22+
</div>
23+
</div>
24+
)
25+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.page-content h1 {
2+
@apply text-2xl font-semibold pt-4;
3+
}
4+
5+
.page-content h2 {
6+
@apply text-xl font-semibold pt-4;
7+
}
8+
9+
.page-content ul {
10+
@apply list-disc list-outside space-y-1 ml-4 md:ml-6;
11+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/* eslint-disable react/no-danger */
2+
import { getPage } from '@/lib/api/page'
3+
4+
import './page.css'
5+
import { notFound } from 'next/navigation'
6+
7+
export default async function Page({
8+
params,
9+
}: {
10+
params: { pageSlug: string }
11+
}) {
12+
const { pageSlug } = params
13+
const page = await getPage(pageSlug)
14+
15+
if (!page) {
16+
notFound()
17+
}
18+
19+
return (
20+
<div>
21+
<div className="absolute top-0 -z-10 h-full w-full bg-white dark:hidden">
22+
<div className="absolute bottom-auto left-auto right-0 top-0 h-[500px] w-[500px] -translate-x-[30%] translate-y-[20%] rounded-full bg-[rgba(173,109,244,0.5)] opacity-50 blur-[80px]" />
23+
</div>
24+
<div className="fixed bottom-0 left-0 right-0 top-0 -z-10 hidden dark:block">
25+
<div className="relative h-full w-full bg-slate-950">
26+
<div className="absolute bottom-0 left-0 right-0 top-0 bg-[radial-gradient(circle_500px_at_50%_200px,#3e3e3e,transparent)]" />
27+
</div>
28+
</div>
29+
30+
<div className="container mx-auto max-w-screen-md p-4 pb-8 md:mb-16 md:px-0">
31+
<div className="flex flex-col items-start justify-center py-8 md:py-16">
32+
<h1 className="text-5xl">{page?.title_en}</h1>
33+
</div>
34+
<div
35+
className="[& h1]:text-lg page-content space-y-4"
36+
dangerouslySetInnerHTML={{ __html: page?.content_en || '' }}
37+
/>
38+
</div>
39+
</div>
40+
)
41+
}

apps/web/src/app/_components/crypto-bubbles.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { useWindowSize } from 'react-use'
1414

1515
import { exchangeFilterAtom, performanceOptionAtom } from '@/atoms/crypto'
1616
import { useTrackBannerClick } from '@/components/ad-banner'
17-
import type { MonetizationAdBannerComponent } from '@/lib/api'
17+
import type { MonetizationAdBannerComponent } from '@/lib/api/strapi'
1818
import {
1919
BUBBLE_OPTIONS,
2020
DEFAULT_PERFORMANCE_OPTION,

apps/web/src/app/_components/crypto-table/columns.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
TooltipProvider,
1414
TooltipTrigger,
1515
} from '@/components/ui/tooltip'
16-
import type { ExchangeListResponseDataItem } from '@/lib/api'
16+
import type { ExchangeListResponseDataItem } from '@/lib/api/strapi'
1717
import type { Exchange } from '@/lib/exchanges'
1818
import type { ANY, CryptoData, Currency } from '@/lib/types'
1919

apps/web/src/app/_components/crypto-table/crypto-table.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import {
3333
TableHeader,
3434
TableRow,
3535
} from '@/components/ui/table'
36-
import type { ExchangeListResponseDataItem } from '@/lib/api'
36+
import type { ExchangeListResponseDataItem } from '@/lib/api/strapi'
3737
import { CRYPTO_TABLE_SIZE } from '@/lib/constants'
3838
import type { CryptoData } from '@/lib/types'
3939

apps/web/src/app/_components/exchange-logo.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Image from 'next/image'
22

3-
import type { ExchangeListResponseDataItem } from '@/lib/api'
3+
import type { ExchangeListResponseDataItem } from '@/lib/api/strapi'
44
import { cn } from '@/lib/utils'
55
import { track } from '@vercel/analytics/react'
66

apps/web/src/app/_components/header.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import Link from 'next/link'
55

66
import { DynamicLink } from '@/components/dynamic-link'
77
import { Button } from '@/components/ui/button'
8-
import type { NavigationAppBarNavComponent } from '@/lib/api'
8+
import type { NavigationAppBarNavComponent } from '@/lib/api/strapi'
99

1010
export type HeaderProps = {
1111
children?: ReactNode
@@ -27,7 +27,7 @@ export const Header: FC<HeaderProps> = async ({
2727
src="/images/logo/logo-base-256x256.png"
2828
width={32}
2929
/>
30-
<div className="ml-1 hidden text-lg font-semibold text-[#4D0BDA] md:block">
30+
<div className="ml-1 hidden text-lg font-semibold text-primary md:block">
3131
<b>Harga</b>Crypto
3232
</div>
3333
</Link>

0 commit comments

Comments
 (0)