mirror of
https://github.com/koreanbots/core.git
synced 2025-12-18 07:00:23 +00:00
This commit is contained in:
parent
845a434978
commit
967366866d
@ -1,6 +1,6 @@
|
|||||||
import Head from 'next/head'
|
import Head from 'next/head'
|
||||||
import type { AppProps } from 'next/app'
|
import type { AppProps } from 'next/app'
|
||||||
import { ThemeProvider } from 'next-themes'
|
import { ThemeProvider, useTheme } from 'next-themes'
|
||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
|
|
||||||
import Footer from '../components/Footer'
|
import Footer from '../components/Footer'
|
||||||
@ -19,6 +19,8 @@ import '../github-markdown.css'
|
|||||||
let systemColor
|
let systemColor
|
||||||
export default function App({ Component, pageProps }: AppProps): JSX.Element {
|
export default function App({ Component, pageProps }: AppProps): JSX.Element {
|
||||||
const [ betaKey, setBetaKey ] = useState('')
|
const [ betaKey, setBetaKey ] = useState('')
|
||||||
|
const [ theme, setDefaultTheme ] = useState<string|undefined>(undefined)
|
||||||
|
const { setTheme } = useTheme()
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setBetaKey(localStorage.betaKey)
|
setBetaKey(localStorage.betaKey)
|
||||||
console.log(
|
console.log(
|
||||||
@ -29,16 +31,22 @@ export default function App({ Component, pageProps }: AppProps): JSX.Element {
|
|||||||
'%c' + '이곳에 코드를 붙여넣으면 공격자에게 엑세스 토큰을 넘겨줄 수 있습니다!!',
|
'%c' + '이곳에 코드를 붙여넣으면 공격자에게 엑세스 토큰을 넘겨줄 수 있습니다!!',
|
||||||
'color: #ff0000; font-size: 20px; font-weight: bold;'
|
'color: #ff0000; font-size: 20px; font-weight: bold;'
|
||||||
)
|
)
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
useEffect(()=> {
|
||||||
try {
|
try {
|
||||||
systemColor = window.matchMedia('(prefers-color-scheme: dark)')?.matches ? 'dark' : 'light'
|
systemColor = window.matchMedia('(prefers-color-scheme: dark)')?.matches ? 'dark' : 'light'
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
systemColor = 'dark'
|
systemColor = 'dark'
|
||||||
}
|
}
|
||||||
if (!localStorage.theme || !['dark', 'light'].includes(localStorage.theme))
|
if (!localStorage.theme || !['dark', 'light'].includes(localStorage.theme)) {
|
||||||
localStorage.setItem('theme', systemColor)
|
localStorage.setItem('theme', systemColor)
|
||||||
|
setDefaultTheme(systemColor)
|
||||||
|
}
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [])
|
}, [])
|
||||||
return (
|
return (
|
||||||
<ThemeProvider defaultTheme={systemColor} attribute='class' storageKey='theme'>
|
<ThemeProvider forcedTheme={theme} attribute='class' storageKey='theme' enableSystem>
|
||||||
<Head>
|
<Head>
|
||||||
<meta name='viewport' content='width=device-width, initial-scale=1.0' />
|
<meta name='viewport' content='width=device-width, initial-scale=1.0' />
|
||||||
<title>한국 디스코드봇 리스트</title>
|
<title>한국 디스코드봇 리스트</title>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user