Skip to content

Commit

Permalink
refactor: use app dir properly
Browse files Browse the repository at this point in the history
  • Loading branch information
iCrawl committed Sep 29, 2023
1 parent d740f0b commit 643987d
Show file tree
Hide file tree
Showing 30 changed files with 226 additions and 1,043 deletions.
10 changes: 2 additions & 8 deletions apps/report/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,11 @@
"description": "",
"scripts": {
"test": "vitest run",
"build": "yarn build:css && yarn build:next",
"build": "yarn build:next",
"build:check": "tsc --noEmit",
"build:next": "next build",
"build:css": "yarn generate:css",
"dev": "concurrently 'yarn dev:css' 'yarn dev:next'",
"dev": "concurrently 'yarn dev:next'",
"dev:next": "next dev",
"dev:css": "yarn generate:css --watch",
"generate:css": "unocss 'src/**/*.tsx' --out-file ./src/styles/unocss.css",
"lint": "prettier --check . && cross-env TIMING=1 eslint src --ext mjs,js,ts,tsx --format=pretty",
"format": "prettier --write . && cross-env TIMING=1 eslint src --ext mjs,js,ts,tsx --fix --format=pretty",
"fmt": "yarn format"
Expand Down Expand Up @@ -51,8 +48,6 @@
"@testing-library/react": "^14.0.0",
"@types/node": "^18.18.1",
"@types/react-dom": "^18.2.8",
"@unocss/cli": "^0.56.4",
"@unocss/reset": "^0.56.4",
"@vercel/node": "^3.0.6",
"@vitejs/plugin-react": "^4.1.0",
"@vitest/coverage-v8": "^0.34.6",
Expand All @@ -65,7 +60,6 @@
"mdast": "^3.0.0",
"prettier": "^3.0.3",
"typescript": "^5.2.2",
"unocss": "^0.56.4",
"vitest": "^0.34.6"
},
"engines": {
Expand Down
87 changes: 87 additions & 0 deletions apps/report/src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
import type { Metadata } from "next";
import type { PropsWithChildren } from "react";
import { StyleSheets } from "./stylesheets";

import "~/styles/main.css";

export const metadata: Metadata = {
title: "Yuudachi Report",
viewport: {
minimumScale: 1,
initialScale: 1,
width: "device-width",
},
icons: {
other: [
{
url: "/favicon-32x32.png",
sizes: "32x32",
type: "image/png",
},
{
url: "/favicon-16x16.png",
sizes: "16x16",
type: "image/png",
},
],
apple: [
"/apple-touch-icon.png",
{
url: "/safari-pinned-tab.svg",
rel: "mask-icon",
},
],
},

manifest: "/site.webmanifest",

themeColor: [
{ media: "(prefers-color-scheme: light)", color: "#ffffff" },
{ media: "(prefers-color-scheme: dark)", color: "#0d1117" },
],
colorScheme: "light dark",

appleWebApp: {
title: "Yuudachi Report",
},

applicationName: "Yuudachi Report",

openGraph: {
siteName: "Yuudachi Report",
type: "website",
title: "Yuudachi Report",
},

twitter: {
card: "summary_large_image",
creator: "@iCrawlToGo",
},

other: {
"msapplication-TileColor": "#0d1117",
},
};

export default function RootLayout({ children }: PropsWithChildren) {
return (
<html data-color-mode="dark" data-dark-theme="dark" lang="en">
<body>
<StyleSheets />
<script
// eslint-disable-next-line react/no-danger
dangerouslySetInnerHTML={{
__html: `(() => {
const prefersDarkMode = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
const persistedColorPreference = localStorage.getItem('theme') || 'auto';
if (persistedColorPreference === 'dark' || (prefersDarkMode && persistedColorPreference !== 'light')) {
document.documentElement.classList.toggle('dark', true);
}
})();`,
}}
/>
{children}
</body>
</html>
);
}
37 changes: 37 additions & 0 deletions apps/report/src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import type { SerializeOptions } from "next-mdx-remote/dist/types";
import { MDXRemote } from "next-mdx-remote/rsc";
import rehypeHighlight from "rehype-highlight";
import rehypeIgnore from "rehype-ignore";
import rehypeRaw from "rehype-raw";
import rehypeSlug from "rehype-slug";
import remarkGfm from "remark-gfm";
import rehypeGithubBlockquoteAdmonitions from "~/util/rehype-github-blockquote-admonitions";
import rehypeHighlightANSI from "~/util/rehype-highlight-ansi";
import remarkGithubBlockquoteAdmonitions from "~/util/remark-github-blockquote-admonitions";

const mdxOptions = {
mdxOptions: {
remarkPlugins: [remarkGfm, remarkGithubBlockquoteAdmonitions],
remarkRehypeOptions: { allowDangerousHtml: true },
rehypePlugins: [
rehypeRaw as any,
rehypeIgnore as any,
rehypeSlug,
rehypeGithubBlockquoteAdmonitions,
rehypeHighlightANSI,
[rehypeHighlight as any, { ignoreMissing: true, detect: true }],
],
format: "md",
},
} satisfies SerializeOptions;

export default async function Page({ searchParams }: { readonly searchParams: { url: string } }) {
const res = await fetch(searchParams.url);
const text = await res.text();

return (
<div className="markdown-body">
<MDXRemote options={mdxOptions} source={text} />
</div>
);
}
33 changes: 33 additions & 0 deletions apps/report/src/app/stylesheets.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
"use client";

import ReactDOM from "react-dom";

export function StyleSheets() {
ReactDOM.preload("https://cdnjs.cloudflare.com/ajax/libs/Primer/20.4.1/base.min.css", {
as: "style",
crossOrigin: "anonymous",
integrity: "sha512-Y3BvSXIyScMEFBi2QYvDc12tw0MpND6sYYKqdObiNlE432O1fv0/jeCbuuVeSNjd2ZuAM3EJbeVBFe/b0rKoYg==",
});
ReactDOM.preload("https://cdnjs.cloudflare.com/ajax/libs/Primer/20.4.1/color-modes.min.css", {
as: "style",
crossOrigin: "anonymous",
integrity: "sha512-XTbUut8Rc/r06Iif/K7xDOub5F4TO2vTCV4InexCz5RvpGMaSfUf2tMRxYX6ha0zzFy+UfKdb94ehR+dOKYPhg==",
});
ReactDOM.preload("https://cdnjs.cloudflare.com/ajax/libs/Primer/20.4.1/utilities.min.css", {
as: "style",
crossOrigin: "anonymous",
integrity: "sha512-OS48DOZqdQdDDxUfXtTx/xv8SjfIwc/k8gf75MaFh6uNb7xA50neIEvAi68wzvGJrW646ZVZH0AQXHSsvwMvpw==",
});
ReactDOM.preload("https://cdnjs.cloudflare.com/ajax/libs/Primer/20.4.1/markdown.min.css", {
as: "style",
crossOrigin: "anonymous",
integrity: "sha512-z9fESt0h0bJJwWXYjGCV8v/SLbIkxgEIRBvt9d4xw+xSNUT+D1RpA/BUu8FBu6RqRWetBNaKeCC9Tr16/hPBhw==",
});
ReactDOM.preload("https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.6.0/styles/github-dark.min.css", {
as: "style",
crossOrigin: "anonymous",
integrity: "sha512-rO+olRTkcf304DQBxSWxln8JXCzTHlKnIdnMUwYvQa9/Jd4cQaNkItIUj6Z4nvW1dqK0SKXLbn9h4KwZTNtAyw==",
});

return null;
}
8 changes: 0 additions & 8 deletions apps/report/src/pages/_app.tsx

This file was deleted.

61 changes: 0 additions & 61 deletions apps/report/src/pages/_document.tsx

This file was deleted.

45 changes: 0 additions & 45 deletions apps/report/src/pages/index.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion apps/report/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@
"~/*": ["./src/*"]
}
},
"include": ["api/**/*.js", "src/**/*.ts", "src/**/*.tsx", "next-env.d.ts", "types.d.ts", ".next/types/**/*.ts"],
"include": ["src/**/*.ts", "src/**/*.tsx", "next-env.d.ts", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
}
1 change: 0 additions & 1 deletion apps/report/types.d.ts

This file was deleted.

13 changes: 0 additions & 13 deletions apps/report/unocss.config.ts

This file was deleted.

3 changes: 0 additions & 3 deletions apps/report/vercel.json

This file was deleted.

4 changes: 0 additions & 4 deletions apps/website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,10 @@
"license": "AGPL-3.0",
"private": true,
"dependencies": {
"ariakit": "^2.0.0-next.44",
"cmdk": "^0.2.0",
"next": "^13.5.3",
"next-themes": "^0.2.1",
"pocketbase": "^0.18.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-use": "^17.4.0",
"sharp": "^0.32.6"
},
"devDependencies": {
Expand Down
14 changes: 0 additions & 14 deletions apps/website/src/app/auth/layout.tsx

This file was deleted.

Loading

2 comments on commit 643987d

@vercel
Copy link

@vercel vercel bot commented on 643987d Sep 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

yuudachi – ./apps/website

yuudachi-git-main-discordjs.vercel.app
yuudachi.vercel.app
yuudachi-discordjs.vercel.app
www.yuudachi.dev
yuudachi.dev

@vercel
Copy link

@vercel vercel bot commented on 643987d Sep 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

yuudachi-report – ./apps/report

yuudachi-report-discordjs.vercel.app
yuudachi-report-git-main-discordjs.vercel.app
yuudachi-report.vercel.app

Please sign in to comment.