Skip to content

Commit 209f3dc

Browse files
committed
feat: next 15 version update
1 parent e45a2c0 commit 209f3dc

File tree

9 files changed

+2543
-1470
lines changed

9 files changed

+2543
-1470
lines changed

package.json

+16-12
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,30 @@
33
"version": "0.22.2",
44
"private": true,
55
"scripts": {
6-
"dev": "next dev",
6+
"dev": "next dev --turbo",
77
"build": "next build",
88
"start": "next start",
99
"lint": "next lint"
1010
},
1111
"dependencies": {
1212
"@formatjs/intl-localematcher": "^0.5.4",
1313
"@heroicons/react": "^2.1.1",
14-
"@splinetool/react-spline": "^2.2.6",
14+
"@splinetool/react-spline": "^4.0.0",
1515
"@splinetool/runtime": "^1.2.8",
1616
"@supabase/supabase-js": "^2.43.1",
1717
"@uiw/react-md-editor": "^3.20.5",
1818
"eslint": "8.35.0",
19-
"eslint-config-next": "13.2.3",
20-
"framer-motion": "^11.0.3",
19+
"eslint-config-next": "15.0.0",
20+
"framer-motion": "^12.0.0-alpha.0",
2121
"lodash": "^4.17.21",
2222
"negotiator": "^0.6.3",
23-
"next": "^14.2.3",
24-
"react": "^18.3.1",
25-
"react-dom": "^18.3.1",
26-
"react-markdown": "^8.0.5",
27-
"rehype-raw": "^6.1.1",
23+
"next": "15.0.0",
24+
"react": "19.0.0-rc-65a56d0e-20241020",
25+
"react-dom": "19.0.0-rc-65a56d0e-20241020",
26+
"react-markdown": "^9.0.1",
27+
"rehype-raw": "^7.0.0",
2828
"remark": "^14.0.2",
29-
"remark-gfm": "^3.0.1",
29+
"remark-gfm": "^4.0.0",
3030
"remark-html": "^15.0.2",
3131
"swr": "^2.2.4",
3232
"tailwind-scrollbar-hide": "^1.1.7",
@@ -36,12 +36,16 @@
3636
"@types/lodash": "^4.14.202",
3737
"@types/negotiator": "^0.6.3",
3838
"@types/node": "18.14.6",
39-
"@types/react": "^18.3.2",
40-
"@types/react-dom": "^18.3.0",
39+
"@types/react": "npm:[email protected]",
40+
"@types/react-dom": "npm:[email protected]",
4141
"@types/react-syntax-highlighter": "^15.5.13",
4242
"autoprefixer": "^10.4.13",
4343
"postcss": "^8.4.21",
4444
"react-syntax-highlighter": "^15.5.0",
4545
"tailwindcss": "^3.4.3"
46+
},
47+
"resolutions": {
48+
"@types/react": "npm:[email protected]",
49+
"@types/react-dom": "npm:[email protected]"
4650
}
4751
}

src/app/[locale]/_components/MainContainer.tsx

+13-11
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,21 @@
33
import { NavItem } from '@/app/[locale]/_components/NavItem'
44
import { NavModal } from '@/app/[locale]/_components/NavModal'
55
import ChatBox from '@/components/common/chats/ChatBox'
6-
import LoadingCircle from '@/components/common/loadings/LoadingCircle'
6+
// import LoadingCircle from '@/components/common/loadings/LoadingCircle'
77
import { useDictionary } from '@/context/dictionary-provider'
88
import { ChatBubbleLeftEllipsisIcon, DocumentIcon } from '@heroicons/react/24/solid'
99
import { Application, SPEObject } from '@splinetool/runtime'
1010
import { motion } from 'framer-motion'
11-
import dynamic from 'next/dynamic'
11+
// import dynamic from 'next/dynamic'
1212
import { useParams } from 'next/navigation'
1313
import { useRef, useState } from 'react'
1414
import LocaleToggle from './LocaleToggle'
15+
import Spline from '@splinetool/react-spline'
1516

16-
const Spline = dynamic(() => import('@splinetool/react-spline'), {
17-
ssr: false,
18-
loading: () => <LoadingCircle />
19-
})
17+
// const Spline = dynamic(() => import('@splinetool/react-spline'), {
18+
// ssr: false,
19+
// loading: () => <LoadingCircle />
20+
// })
2021

2122
const SPLINE_SCENE = 'https://prod.spline.design/W83XdmrQbaQnPMlJ/scene.splinecode'
2223
const SPLINE_BOT_ID = '7a1937ee-e0ec-4da1-bca9-10b1ff105490'
@@ -29,10 +30,11 @@ const MainContainer = () => {
2930
const navList = [
3031
{
3132
name: t.navigation.posts.title,
32-
href: '/posts',
33+
href: 'https://velog.io/@henrynoowah/posts',
3334
icon: <DocumentIcon className="text-light" />,
3435
desc: t.navigation.posts.description,
35-
locale: params.locale as string
36+
locale: params.locale as string,
37+
external: true
3638
},
3739
// {
3840
// name: 'works',
@@ -79,14 +81,14 @@ const MainContainer = () => {
7981
}
8082
}
8183

82-
const botRef = useRef<SPEObject>()
83-
const splineRef = useRef<Application>()
84+
const botRef = useRef<SPEObject>(null)
85+
const splineRef = useRef<Application>(null)
8486

8587
const onLoad = (spline: Application) => {
8688
splineRef.current = spline
8789
const botObj = spline.findObjectByName(SPLINE_BOT_ID)
8890
botObj?.emitEvent('mouseDown')
89-
botRef.current = botObj
91+
if (botObj) botRef.current = botObj
9092
}
9193

9294
const toggleChat = () => {

src/app/[locale]/layout.tsx

+8-2
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,16 @@ export async function generateStaticParams() {
3131

3232
interface Params {
3333
children: React.ReactNode
34-
params: { locale: Locale }
34+
params: Promise<{ locale: Locale }>
3535
}
3636

37-
const RootLayout = ({ children, params }: Params) => {
37+
const RootLayout = async (props: Params) => {
38+
const params = await props.params;
39+
40+
const {
41+
children
42+
} = props;
43+
3844
return (
3945
<html lang={params.locale}>
4046
<head>

src/app/[locale]/page.tsx

+4-3
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@ import MainContainer from './_components/MainContainer'
77
const inter = Inter({ variable: '--font-inter', subsets: ['latin'] })
88

99
interface Params {
10-
params: {
10+
params: Promise<{
1111
locale: Locale
12-
}
12+
}>
1313
}
1414

15-
const Home = async ({ params }: Params) => {
15+
const Home = async (props: Params) => {
16+
const params = await props.params
1617
const dictionary = await getDictionary(params.locale)
1718
return (
1819
<main className={inter.variable}>

src/app/[locale]/posts/[slug]/page.tsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,16 @@ const getData = async (slug: string): Promise<any> => {
88
return await getPost(slug)
99
}
1010

11-
export const generateMetadata = async ({ params }: any): Promise<Metadata> => {
11+
export const generateMetadata = async (props: any): Promise<Metadata> => {
12+
const params = await props.params;
1213
const post = await getPost(params.slug)
1314
return {
1415
title: post?.title
1516
}
1617
}
1718

18-
const PostDetailPage = async ({ params }: any) => {
19+
const PostDetailPage = async (props: any) => {
20+
const params = await props.params;
1921
const slug = decodeURIComponent(params.slug)
2022
const post = await getData(slug)
2123
return (

src/app/[locale]/posts/layout.tsx

+9-4
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,24 @@ import { ReactNode } from 'react'
1313

1414
interface Params {
1515
children: ReactNode
16-
params: { locale: Locale }
16+
params: Promise<{ locale: Locale }>
1717
}
1818

19-
const PostsLayouts = async ({ children, params }: Params) => {
19+
const PostsLayouts = async (props: Params) => {
20+
const params = await props.params
21+
22+
const { children } = props
23+
2024
const t = await getDictionary(params.locale)
2125
console.log(t)
2226

2327
const navOption: Array<{ label: string; href: string; locale: Locale; external?: boolean }> = [
2428
{ label: t.navigation.home.title, href: '/', locale: params.locale },
2529
{
2630
label: t.navigation.posts.title,
27-
href: '/posts',
28-
locale: params.locale
31+
href: 'https://velog.io/@henrynoowah/posts',
32+
locale: params.locale,
33+
external: true
2934
},
3035
{
3136
label: t.navigation.github.title,

src/components/common/layouts/header/Header.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import packageData from 'package.json'
55
import { Suspense } from 'react'
66
import Nav_mobile from './Nav_mobile'
77
import ShowSearchButton from './ShowSearchButton'
8-
import { useParams } from 'next/navigation'
98
const ThemeToggle = dynamic(() => import('../../themeToggle/ThemeToggle'))
109

1110
const HEADER_HEIGHT = 72

src/components/common/markdowns/index.tsx

+23-27
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,41 @@
11
import '@uiw/react-markdown-preview/markdown.css'
22
import ReactMarkdown from 'react-markdown'
3-
import { SpecialComponents } from 'react-markdown/lib/ast-to-react'
4-
import { NormalComponents } from 'react-markdown/lib/complex-types'
53
import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter'
64
import { vscDarkPlus } from 'react-syntax-highlighter/dist/esm/styles/prism'
75
import rehypeRaw from 'rehype-raw'
8-
import remarkGfm from 'remark-gfm'
96

107
import '@uiw/react-markdown-preview/markdown.css'
118
import '@uiw/react-md-editor/markdown-editor.css'
9+
import remarkGfm from 'remark-gfm'
1210

1311
interface Params {
1412
markdown?: string
1513
}
1614

17-
type MarkDownComponents = Partial<Omit<NormalComponents, keyof SpecialComponents> & SpecialComponents>
18-
19-
const markdownComponents: MarkDownComponents = {
20-
h1: ({ node, ...props }) => (
15+
const markdownComponents = {
16+
h1: ({ node, ...props }: any) => (
2117
<h1 className="text-primary dark:text-light font-bold text-2xl py-6" {...props}>
2218
{props.children}
2319
</h1>
2420
),
25-
h2: ({ node, ...props }) => (
21+
h2: ({ node, ...props }: any) => (
2622
<h2 className="text-primary dark:text-light font-bold text-xl py-6" {...props}>
2723
{props.children}
2824
</h2>
2925
),
30-
h3: ({ node, ...props }) => <h3 className="text-primary dark:text-light font-bold text-lg py-6" {...props} />,
31-
h4: ({ node, ...props }) => <h4 className="text-primary dark:text-light font-bold text-md" {...props} />,
32-
h5: ({ node, ...props }) => <h5 className="text-primary dark:text-light font-bold text-md" {...props} />,
33-
h6: ({ node, ...props }) => <h5 className="text-primary/60 font-bold text-md" {...props} />,
34-
p: ({ node, ...props }) => (
26+
h3: ({ node, ...props }: any) => <h3 className="text-primary dark:text-light font-bold text-lg py-6" {...props} />,
27+
h4: ({ node, ...props }: any) => <h4 className="text-primary dark:text-light font-bold text-md" {...props} />,
28+
h5: ({ node, ...props }: any) => <h5 className="text-primary dark:text-light font-bold text-md" {...props} />,
29+
h6: ({ node, ...props }: any) => <h5 className="text-primary/60 font-bold text-md" {...props} />,
30+
p: ({ node, ...props }: any) => (
3531
<p className="text-dark dark:text-light text-md leading-[1.7rem] whitespace-pre-line py-2" {...props} />
3632
),
37-
ul: ({ node, ...props }) => {
33+
ul: ({ node, ...props }: any) => {
3834
const { ordered: _, ...rest } = props
3935
return <ul className="list-disc text-md leading-6 ps-4 md:ps-8" {...rest} />
4036
},
41-
ol: ({ node, ...props }) => <ol className="list-decimal ps-4 text-md leading-8" {...props} />,
42-
li: ({ node, ...props }) => {
37+
ol: ({ node, ...props }: any) => <ol className="list-decimal ps-4 text-md leading-8" {...props} />,
38+
li: ({ node, ...props }: any) => {
4339
const { ordered: _, ...rest } = props
4440
return (
4541
<li
@@ -53,11 +49,11 @@ const markdownComponents: MarkDownComponents = {
5349
</li>
5450
)
5551
},
56-
hr: ({ node, ...props }) => <hr className="my-6 border-primary/60" {...props} />,
57-
a: ({ node, ...props }) => (
52+
hr: ({ node, ...props }: any) => <hr className="my-6 border-primary/60" {...props} />,
53+
a: ({ node, ...props }: any) => (
5854
<a target="_blank" className="text-primary dark:text-secondary underline underline-offset-1" {...props} />
5955
),
60-
input: ({ node, ...props }) => {
56+
input: ({ node, ...props }: any) => {
6157
if (props.type === 'checkbox') {
6258
const { checked: _, ...rest } = props
6359
return (
@@ -72,15 +68,15 @@ const markdownComponents: MarkDownComponents = {
7268
return <input {...props} />
7369
}
7470
},
75-
blockquote: ({ node, ...props }) => (
71+
blockquote: ({ node, ...props }: any) => (
7672
<blockquote
7773
className="bg-primary/10 text-primary ps-4 py-1 border-l-[0.2rem] border-primary border-solid [&>p]:leading-8"
7874
{...props}
7975
>
8076
{props.children}
8177
</blockquote>
8278
),
83-
code: ({ node, inline, className, children, ...props }) => {
79+
code: ({ node, inline, className, children, ...props }: any) => {
8480
const match = /language-(\w+)/.exec(className || '')
8581
const codeBlock = String(children).replace(/\n$/, ' ')
8682
return !inline ? (
@@ -103,32 +99,32 @@ const markdownComponents: MarkDownComponents = {
10399
</code>
104100
)
105101
},
106-
table: ({ node, className, children, ...props }) => (
102+
table: ({ node, className, children, ...props }: any) => (
107103
<div className="w-full overflow-auto ring-1 ring-inset dark:ring-light/10">
108104
<table className="w-full text-dark dark:text-light ring-inset rounded-md" {...props}>
109105
{children}
110106
</table>
111107
</div>
112108
),
113-
thead: ({ node, className, children, ...props }) => (
109+
thead: ({ node, className, children, ...props }: any) => (
114110
<thead className="w-full border-b-1 border-solid border-light/10" {...props}>
115111
{children}
116112
</thead>
117113
),
118-
tr: ({ node, className, children, isHeader, ...props }) => (
114+
tr: ({ node, className, children, isHeader, ...props }: any) => (
119115
<tr
120116
className="w-fit [&>*]:text-md [&>*]:border [&>*]:border-solid [&>*]:border-light [&>*]:border-collapse [&>th]:whitespace-pre-line [&>th]:p-2 [&>td]:whitespace-pre-line [&>td]:p-2"
121117
{...props}
122118
>
123119
{children}
124120
</tr>
125121
),
126-
tbody: ({ node, className, children, ...props }) => (
122+
tbody: ({ node, className, children, ...props }: any) => (
127123
<tbody className="w-full [&>*]:border [&>*]:border-solid [&>*]:border-light [&>*]:border-collapse" {...props}>
128124
{children}
129125
</tbody>
130126
),
131-
img: ({ node, className, children, ...props }) => (
127+
img: ({ node, className, children, ...props }: any) => (
132128
// eslint-disable-next-line @next/next/no-img-element
133129
<img {...props} alt="" className="w-full overflow-hidden rounded-md ring-1 ring-primary/60 shadow-md my-4" />
134130
)
@@ -141,7 +137,7 @@ export const MarkdowRenderer = ({ markdown }: Params) => {
141137
fontSize: '1rem'
142138
}}
143139
>
144-
<ReactMarkdown remarkPlugins={[remarkGfm]} rehypePlugins={[rehypeRaw]} components={markdownComponents}>
140+
<ReactMarkdown remarkPlugins={[remarkGfm]} rehypePlugins={[rehypeRaw]} components={markdownComponents as any}>
145141
{markdown ?? ''}
146142
</ReactMarkdown>
147143
</div>

0 commit comments

Comments
 (0)