mirror of
https://github.com/DefectingCat/DefectingCat.github.io
synced 2025-07-15 00:31:36 +00:00
feat: add global 404 page
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
NEXT_PUBLIC_GITHUB_API=
|
||||
NEXT_PUBLIC_GISCUS_CATEGORY_ID=
|
||||
NEXT_PUBLIC_GISCUS_REPO_ID=
|
||||
# NEXT_PUBLIC_GITHUB_API=
|
||||
# NEXT_PUBLIC_GISCUS_CATEGORY_ID=
|
||||
# NEXT_PUBLIC_GISCUS_REPO_ID=
|
||||
NEXT_PUBLIC_ALGOLIA_SEARCH_ADMIN_KEY=
|
||||
NEXT_PUBLIC_ALGOLIA_APP_ID=
|
||||
|
@ -10,14 +10,18 @@ const GlobalError = ({
|
||||
error: Error & { digest?: string };
|
||||
reset: () => void;
|
||||
}) => {
|
||||
console.error(error);
|
||||
|
||||
return (
|
||||
<html>
|
||||
<body
|
||||
className={clsx('w-full h-dvh flex', 'justify-center items-center')}
|
||||
>
|
||||
<div>
|
||||
<h2 className="text-xl">Something went wrong! ノ( OωOノ)</h2>
|
||||
<Button onClick={() => reset()}>Try again</Button>
|
||||
<h2 className="text-xl mb-1">Something went wrong! ノ( OωOノ)</h2>
|
||||
<Button onClick={() => reset()} className="cursor-pointer">
|
||||
Try again
|
||||
</Button>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
15
app/not-found.tsx
Normal file
15
app/not-found.tsx
Normal file
@ -0,0 +1,15 @@
|
||||
import Button from 'components/rua/button';
|
||||
import Link from 'next/link';
|
||||
|
||||
export default function NotFound() {
|
||||
return (
|
||||
<main className="flex-1 w-full max-w-4xl mx-auto flex items-center justify-center">
|
||||
<div>
|
||||
<h2 className="text-xl mb-1">来到了神秘次元 ∑( 口 ||)</h2>
|
||||
<Link href="/">
|
||||
<Button className="cursor-pointer">Home</Button>
|
||||
</Link>
|
||||
</div>
|
||||
</main>
|
||||
);
|
||||
}
|
@ -16,7 +16,6 @@ const PostToc = dynamic(() => import('components/post/post-toc'));
|
||||
const PostCommnetLine = dynamic(
|
||||
() => import('components/post/post-commnet-line'),
|
||||
);
|
||||
const PostComment = dynamic(() => import('components/post/post-comment'));
|
||||
|
||||
export async function generateStaticParams() {
|
||||
return await allPostsPath();
|
||||
|
@ -41,6 +41,7 @@ const BackToTop = () => {
|
||||
'lg:right-8 lg:bottom-8',
|
||||
'transition-all duration-300',
|
||||
showTop ? 'visible scale-100' : 'invisible scale-0',
|
||||
'cursor-pointer',
|
||||
)}
|
||||
>
|
||||
<FiChevronUp className="w-6 h-6" />
|
||||
|
@ -14,11 +14,11 @@ const CatModel = () => {
|
||||
const camera = useThree((state) => state.camera);
|
||||
const gltf = useLoader(
|
||||
GLTFLoader,
|
||||
'./models/just_a_hungry_cat/modelDraco.gltf',
|
||||
'/models/just_a_hungry_cat/modelDraco.gltf',
|
||||
(loader) => {
|
||||
toggleLoading(true);
|
||||
const dracoLoader = new DRACOLoader();
|
||||
dracoLoader.setDecoderPath('./libs/draco/');
|
||||
dracoLoader.setDecoderPath('/libs/draco/');
|
||||
loader.setDRACOLoader(dracoLoader);
|
||||
},
|
||||
);
|
||||
|
@ -41,11 +41,11 @@ const CloudModel = () => {
|
||||
|
||||
const gltf = useLoader(
|
||||
GLTFLoader,
|
||||
'./models/cloud_station/modelDraco.gltf',
|
||||
'/models/cloud_station/modelDraco.gltf',
|
||||
(loader) => {
|
||||
toggleLoading(true);
|
||||
const dracoLoader = new DRACOLoader();
|
||||
dracoLoader.setDecoderPath('./libs/draco/');
|
||||
dracoLoader.setDecoderPath('/libs/draco/');
|
||||
loader.setDRACOLoader(dracoLoader);
|
||||
},
|
||||
);
|
||||
|
@ -6,7 +6,7 @@ import { GistData, GistsFile, PageKeys, PageSize } from 'types';
|
||||
const password = process.env.NEXT_PUBLIC_GITHUB_API;
|
||||
const host = process.env.NEXT_PUBLIC_GISTS_HOST ?? 'https://api.github.com';
|
||||
|
||||
if (!password) throw new Error('No GitHub token detected.');
|
||||
// if (!password) throw new Error('No GitHub token detected.');
|
||||
const MyOctokit = Octokit.plugin(restEndpointMethods);
|
||||
const octokit = new MyOctokit({
|
||||
auth: password,
|
||||
|
12
lib/image.ts
Normal file
12
lib/image.ts
Normal file
@ -0,0 +1,12 @@
|
||||
// [TODO]
|
||||
export default function imageProcess({
|
||||
src,
|
||||
width,
|
||||
quality,
|
||||
}: {
|
||||
src: string;
|
||||
width: number;
|
||||
quality?: number;
|
||||
}) {
|
||||
return `/${src}`;
|
||||
}
|
@ -15,8 +15,9 @@ const fileLoaderPathUrl = new URL(fileLoaderPath, import.meta.url).href;
|
||||
*/
|
||||
const nextConfig = {
|
||||
reactStrictMode: true,
|
||||
// swcMinify: true,
|
||||
output: 'standalone',
|
||||
// output: 'standalone',
|
||||
output: 'export',
|
||||
trailingSlash: true,
|
||||
allowedDevOrigins: [
|
||||
'local-origin.dev',
|
||||
'*.local-origin.dev',
|
||||
@ -29,6 +30,9 @@ const nextConfig = {
|
||||
hostname: '**',
|
||||
},
|
||||
],
|
||||
unoptimized: true,
|
||||
loader: 'custom',
|
||||
loaderFile: './lib/image.ts',
|
||||
},
|
||||
experimental: {
|
||||
webpackBuildWorker: true,
|
||||
|
Reference in New Issue
Block a user