Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: rewrite home page #1178

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion packages/home/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,18 @@ function getEnvs() {
}

function getNextConfig() {
return {
/** @type {import('next').NextConfig} */
const config = {
// Next config
productionBrowserSourceMaps: true,
trailingSlash: false,
devIndicators: {
// https://nextjs.org/docs/api-reference/next.config.js/build-indicator
buildActivityPosition: "bottom-left",
},
experimental: {
appDir: true,
},
webpack: (config, _options) => {
config.module.rules.push({
test: /\.(jpe?g|png|webp)$/i,
Expand All @@ -54,6 +58,7 @@ function getNextConfig() {
},
env: getEnvs(),
}
return config
}

const baseConfig = withBundleAnalyzer(getNextConfig())
Expand Down
60 changes: 60 additions & 0 deletions packages/home/src/app/head.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import React from "react"

const NextMeta: React.FC<{ host: string; hasManifest: boolean; description: string }> = ({ host, hasManifest, description }) => {
const image = `${host}/share/img/icons/android-chrome-512x512.png`
return (
<>
<meta name="description" content={description} />

{/* PWA */}
{hasManifest && <link rel="manifest" href="/manifest.json" />}
{/*
> Always specify the theme color using the meta tag. Even though it can also be declared in the web app manifest file:
> - Browsers only acknowledge the value from the web app manifest file once the user has added the page to their home screen.
> - The theme-color meta tag overwrites the value specified in the web app manifest file so it allows for better individual page level customization.
https://webhint.io/docs/user-guide/hints/hint-meta-theme-color/
*/}
{/* This color is the default address bar color of Chrome */}
<meta name="theme-color" content="#e6eaed"></meta>

{/* Apple https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariWebContent/ConfiguringWebApplications/ConfiguringWebApplications.html */}
<link rel="apple-touch-icon" href="/share/img/icons/apple-touch-icon-192x192.png" sizes="192x192"></link>
<link rel="apple-touch-icon" href="/share/img/icons/apple-touch-icon-180x180.png" sizes="180x180"></link>
<link rel="apple-touch-icon" href="/share/img/icons/apple-touch-icon-152x152.png" sizes="152x152"></link>
<meta name="apple-mobile-web-app-capable" content="yes"></meta>

{/* Mircosoft */}
<meta name="msapplication-TileColor" content="#222222" />

{/* Twitter https://developer.twitter.com/en/docs/tweets/optimize-with-cards/overview/abouts-cards */}
<meta name="twitter:card" content="summary" />
<meta name="twitter:url" content={host} />
<meta name="twitter:title" content="Rino" />
<meta name="twitter:description" content={description} />
<meta name="twitter:image" content={image} />
<meta name="twitter:creator" content="@xxxxxxx" />

{/* Open Graph protocol https://ogp.me/ */}
<meta property="og:type" content="website" />
<meta property="og:title" content="Rino" />
<meta property="og:site_name" content="Rino" />
<meta property="og:description" content={description} />
<meta property="og:url" content={host} />
<meta property="og:image" content={image} />
</>
)
}

export default function Head() {
const host = "https://www.rino.app"
const hasManifest = false
const description = "WYSIWYG Markdown Editor"

return (
<>
<meta name="viewport" content="initial-scale=1.0, width=device-width" />
<title>Rino</title>
<NextMeta hasManifest={hasManifest} host={host} description={description} />
</>
)
}
11 changes: 11 additions & 0 deletions packages/home/src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from "react"

function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html lang="en">
<body>{children}</body>
</html>
)
}

export default RootLayout
30 changes: 30 additions & 0 deletions packages/home/src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
"use client"

import { CssBaseline, ThemeProvider } from "@mui/material"
import React from "react"
import snapshot from "../assets/share/snapshot-mac.png"
import { Homepage } from "../components/homepage"
import { theme } from "../styles/theme"

const IndexPage: React.FC = () => {
return (
<ThemeProvider theme={theme}>
{/* CssBaseline kickstart an elegant, consistent, and simple baseline to build upon. */}
<CssBaseline />

<Homepage
hero={{
imageProps: {
src: snapshot.src,
srcSet: snapshot.srcSet,
width: snapshot.width,
height: snapshot.height,
loading: "lazy",
},
}}
/>
</ThemeProvider>
)
}

export default IndexPage
38 changes: 0 additions & 38 deletions packages/home/src/pages/_app.tsx

This file was deleted.

129 changes: 0 additions & 129 deletions packages/home/src/pages/_document.tsx

This file was deleted.

22 changes: 0 additions & 22 deletions packages/home/src/pages/index.tsx

This file was deleted.

22 changes: 18 additions & 4 deletions packages/home/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
{
"compilerOptions": {
"target": "es6",
"lib": ["dom", "dom.iterable", "esnext"],
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
Expand All @@ -14,10 +18,20 @@
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true
"incremental": true,
"plugins": [
{
"name": "next"
}
]
},
"include": [
"./*.d.ts" // We don't actually use this tsconfig.json. It's just for Next.js
// We don't actually use this tsconfig.json. It's just for Next.js
"./*.d.ts",
"./src/global.d.ts",
".next/types/**/*.ts"
],
"exclude": ["node_modules"]
"exclude": [
"node_modules"
]
}