File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -23,7 +23,6 @@ import {
2323} from "react-router-dom" ;
2424import { SideBar } from "./sidebar" ;
2525import { useAppConfig } from "../store/config" ;
26- import { useMaskStore } from "../store/mask" ;
2726
2827export function Loading ( props : { noLogo ?: boolean } ) {
2928 return (
@@ -91,12 +90,24 @@ const useHasHydrated = () => {
9190 return hasHydrated ;
9291} ;
9392
93+ const loadAsyncGoogleFont = ( ) => {
94+ const linkEl = document . createElement ( "link" ) ;
95+ linkEl . rel = "stylesheet" ;
96+ linkEl . href =
97+ "/google-fonts/css2?family=Noto+Sans+SC:wght@300;400;700;900&display=swap" ;
98+ document . head . appendChild ( linkEl ) ;
99+ } ;
100+
94101function Screen ( ) {
95102 const config = useAppConfig ( ) ;
96103 const location = useLocation ( ) ;
97104 const isHome = location . pathname === Path . Home ;
98105 const isMobileScreen = useMobileScreen ( ) ;
99106
107+ useEffect ( ( ) => {
108+ loadAsyncGoogleFont ( ) ;
109+ } , [ ] ) ;
110+
100111 return (
101112 < div
102113 className = {
Original file line number Diff line number Diff line change @@ -34,11 +34,6 @@ export default function RootLayout({
3434 < head >
3535 < meta name = "version" content = { buildConfig . commitId } />
3636 < link rel = "manifest" href = "/site.webmanifest" > </ link >
37- < link rel = "preconnect" href = "https://fonts.proxy.ustclug.org" > </ link >
38- < link
39- rel = "stylesheet"
40- href = "https://fonts.proxy.ustclug.org/css2?family=Noto+Sans+SC:wght@300;400;700;900& display = swap "
41- > </ link >
4237 < script src = "/serviceWorkerRegister.js" defer > </ script >
4338 </ head >
4439 < body > { children } </ body >
Original file line number Diff line number Diff line change @@ -10,6 +10,10 @@ const nextConfig = {
1010 source : "/api/proxy/:path*" ,
1111 destination : "https://api.openai.com/:path*" ,
1212 } ,
13+ {
14+ source : "/google-fonts/:path*" ,
15+ destination : "https://fonts.googleapis.com/:path*" ,
16+ } ,
1317 ] ;
1418
1519 const apiUrl = process . env . API_URL ;
You can’t perform that action at this time.
0 commit comments