From 1b2e85bfd7cee38d11f793ab08551819c919b071 Mon Sep 17 00:00:00 2001 From: JiPai <3956400+PaiJi@users.noreply.github.com> Date: Thu, 9 May 2024 16:18:27 +0800 Subject: [PATCH] feat: opti (#179) * feat: add posthog * feat: remove posthog * style: use next/font * feat: use Fluent emoji * feat: use fluent emoji in footer * fix: fix typo * fix: fix image too large * fix: kick out addDynamicIconSelectors * chore: remove dependency * chore: test no font import bundle size * fix: enable next/font * feat: enable sentry source upload & new 404 * feat: enable autoformat for logo --- next.config.js | 8 +-- package.json | 1 + public/svgs/lion.svg | 1 + public/svgs/smiling-face-with-hearts.svg | 1 + public/svgs/steaming-bowl.svg | 1 + public/svgs/tiger-face.svg | 1 + public/svgs/wolf.svg | 1 + src/components/eventCard/index.tsx | 1 + src/components/layout/footer.tsx | 14 ++++- src/components/layout/header.tsx | 72 +++++++++++++++++++++++- src/components/layout/index.tsx | 10 +--- src/pages/404.tsx | 27 +++++++-- src/pages/[organization]/[slug].tsx | 1 + src/pages/[organization]/index.tsx | 1 + src/pages/_app.tsx | 41 ++++++++++++-- src/pages/_document.tsx | 48 ++-------------- src/pages/index.tsx | 8 +-- src/pages/organization.tsx | 1 + src/styles/globals.css | 6 +- tailwind.config.js | 1 + yarn.lock | 20 +++++++ 21 files changed, 188 insertions(+), 77 deletions(-) create mode 100644 public/svgs/lion.svg create mode 100644 public/svgs/smiling-face-with-hearts.svg create mode 100644 public/svgs/steaming-bowl.svg create mode 100644 public/svgs/tiger-face.svg create mode 100644 public/svgs/wolf.svg diff --git a/next.config.js b/next.config.js index 860680f..f6e7d98 100644 --- a/next.config.js +++ b/next.config.js @@ -20,13 +20,13 @@ const gitRevisionPlugin = new GitRevisionPlugin(); /** @type {import('next').NextConfig} */ const nextConfig = { output: "standalone", + poweredByHeader: false, reactStrictMode: true, images: { unoptimized: false, loader: "custom", loaderFile: "./src/utils/imageLoader.ts", }, - optimizeFonts: false, assetPrefix: isProd && STATIC_CDN_URL ? STATIC_CDN_URL : undefined, experimental: { swcPlugins: [ @@ -38,11 +38,11 @@ const nextConfig = { ], ], }, - trailingSlash: true, sentry: { - disableClientWebpackPlugin: true, - disableServerWebpackPlugin: true, + // disableClientWebpackPlugin: true, + // disableServerWebpackPlugin: true, hideSourcemaps: true, + disableLogger: true, }, webpack: (config, { buildId, dev, isServer, defaultLoaders, webpack }) => { config.plugins.push( diff --git a/package.json b/package.json index b78fd24..dfce09a 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ }, "dependencies": { "@headlessui/react": "^2.0.1", + "@next/third-parties": "^14.2.3", "@radix-ui/react-collapsible": "^1.0.3", "@sentry/nextjs": "^7.113.0", "@xata.io/client": "^0.29.4", diff --git a/public/svgs/lion.svg b/public/svgs/lion.svg new file mode 100644 index 0000000..e0de005 --- /dev/null +++ b/public/svgs/lion.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/svgs/smiling-face-with-hearts.svg b/public/svgs/smiling-face-with-hearts.svg new file mode 100644 index 0000000..caef819 --- /dev/null +++ b/public/svgs/smiling-face-with-hearts.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/svgs/steaming-bowl.svg b/public/svgs/steaming-bowl.svg new file mode 100644 index 0000000..d89d6a7 --- /dev/null +++ b/public/svgs/steaming-bowl.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/svgs/tiger-face.svg b/public/svgs/tiger-face.svg new file mode 100644 index 0000000..8372226 --- /dev/null +++ b/public/svgs/tiger-face.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/svgs/wolf.svg b/public/svgs/wolf.svg new file mode 100644 index 0000000..13518ba --- /dev/null +++ b/public/svgs/wolf.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/components/eventCard/index.tsx b/src/components/eventCard/index.tsx index 221387a..b2378a6 100644 --- a/src/components/eventCard/index.tsx +++ b/src/components/eventCard/index.tsx @@ -88,6 +88,7 @@ export default function EventCard({ height={100} sizes="100px" aria-label="organization's logo" + autoFormat /> )} diff --git a/src/components/layout/footer.tsx b/src/components/layout/footer.tsx index 8a36cf4..3864c35 100644 --- a/src/components/layout/footer.tsx +++ b/src/components/layout/footer.tsx @@ -1,7 +1,6 @@ import { AboutUsLinks, FriendSiteLinks } from "@/constants/staticConfig"; import { sendTrack } from "@/utils/track"; import Link from "next/link"; -import { FaKissWinkHeart } from "react-icons/fa"; import { format } from "date-fns"; import { zhCN } from "date-fns/locale"; @@ -58,8 +57,17 @@ export default function Footer({ isCNRegion }: { isCNRegion: boolean }) {
由 - - 和🍜 + smiling-face-with-hearts + 和 + steaming-bowl 制作而成 {isCNRegion && ( diff --git a/src/components/layout/header.tsx b/src/components/layout/header.tsx index 5df0f3c..c20ddc5 100644 --- a/src/components/layout/header.tsx +++ b/src/components/layout/header.tsx @@ -6,6 +6,50 @@ import { useEffect, useMemo, useRef, useState } from "react"; import { HiMenu } from "react-icons/hi"; import { IoMdClose } from "react-icons/io"; +// const AnimeEmojis = [ +// "tiger-face", +// "wolf", +// "lion", +// "dog-face", +// "fox", +// "leopard", +// "bison", +// "ox", +// "cow", +// "water-buffalo", +// "cow-face", +// "boar", +// "elephant", +// "mammoth", +// "rhinoceros", +// "hippopotamus", +// "shark", +// "seal", +// "dolphin", +// "whale", +// "spouting", +// "dragon", +// "crocodile", +// "parrot", +// "owl", +// "eagle", +// "dove", +// "penguin", +// "bird", +// "paw", +// "badger", +// "skunk", +// "langaroo", +// "otter", +// "sloth", +// "panda", +// "koala", +// "polar-bear", +// "bear", +// ].map((emojiName) => ( +// +// )); + export default function Header() { const { pathname } = useRouter(); @@ -32,7 +76,33 @@ export default function Header() {
- FEC 🐺🐱🐯 +
+ FEC + {/* 🐺🦁🐯 */} + + {/* */} + title-emoji + title-emoji + title-emoji + {/* */} + {/* */} + +

FEC·兽展日历

/ diff --git a/src/components/layout/index.tsx b/src/components/layout/index.tsx index 00d6d7a..badae7d 100644 --- a/src/components/layout/index.tsx +++ b/src/components/layout/index.tsx @@ -52,10 +52,7 @@ export default function Layout({ key="keywords" /> - + - + -

你似乎迷路了...

- Who is my fearless hero? -
+
+
+

404

+

+ 你似乎迷路了... +

+

+ Who is my fearless hero? +

+
+ + 回到首页 + + {/* + 通知管理员 + */} +
+
+
); } diff --git a/src/pages/[organization]/[slug].tsx b/src/pages/[organization]/[slug].tsx index 7972d61..73695bd 100644 --- a/src/pages/[organization]/[slug].tsx +++ b/src/pages/[organization]/[slug].tsx @@ -299,6 +299,7 @@ export default function EventDetail({ event }: { event: Event }) { width={200} height={200} src={event.organization.logoUrl} + autoFormat />
)} diff --git a/src/pages/[organization]/index.tsx b/src/pages/[organization]/index.tsx index 78ebe56..040fd18 100644 --- a/src/pages/[organization]/index.tsx +++ b/src/pages/[organization]/index.tsx @@ -72,6 +72,7 @@ export default function OrganizationDetail(props: { width={200} height={200} src={organization.logoUrl} + autoFormat />
)} diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx index 88cce48..90b30da 100644 --- a/src/pages/_app.tsx +++ b/src/pages/_app.tsx @@ -1,14 +1,43 @@ +import { GoogleAnalytics } from "@next/third-parties/google"; +import { Noto_Sans_SC, Rubik } from "next/font/google"; + import Layout from "@/components/layout"; + import "@/styles/globals.css"; import type { AppProps } from "next/app"; +const isEnableTrack = process.env.ENABLE_TRACK === "true"; + +const notoSC = Noto_Sans_SC({ + weight: ["400", "500", "700"], + subsets: ["latin"], + variable: "--font-noto-sans", + preload: false, +}); + +const rubik = Rubik({ + weight: ["400", "500", "700"], + subsets: ["latin"], + variable: "--font-rubik", + preload: false, +}); + export default function App({ Component, pageProps }: AppProps) { return ( - - - + <> + + + + {isEnableTrack && } + + ); } diff --git a/src/pages/_document.tsx b/src/pages/_document.tsx index 9bfd58a..c4e7a99 100644 --- a/src/pages/_document.tsx +++ b/src/pages/_document.tsx @@ -6,62 +6,24 @@ const isEnableTrack = process.env.ENABLE_TRACK === "true"; export default function Document() { return ( - - - - -