feat: swap Google Fonts for local fonts + fix Suspense boundary

- Replace next/font/google with next/font/local for Inter and Merriweather
- Add self-hosted font files to public/fonts/
- Wrap useSearchParams in Suspense boundary for /chat page
- Eliminates Turbopack TLS font loading issues during build
This commit is contained in:
Max
2026-01-27 11:31:56 +07:00
parent 3f4db8afb9
commit 5bc36f2354
7 changed files with 48 additions and 8 deletions

View File

@@ -1,6 +1,6 @@
"use client";
import { useEffect, useState } from 'react';
import { useEffect, useState, Suspense } from 'react';
import { useSearchParams, useRouter } from 'next/navigation';
import { ChatWindow } from '@/components/features/chat/chat-window';
import { ChatInput } from '@/components/features/chat/chat-input';
@@ -11,7 +11,7 @@ import Link from "next/link";
import { LLMService } from '@/services/llm-service';
import { ProviderManagementService } from '@/services/provider-management-service';
export default function ChatPage() {
function ChatPageContent() {
const { resetSession, phase } = useChatStore();
const searchParams = useSearchParams();
const router = useRouter();
@@ -90,3 +90,16 @@ export default function ChatPage() {
</div>
);
}
export default function ChatPage() {
return (
<Suspense fallback={
<div className="flex flex-col h-dvh bg-background items-center justify-center">
<Loader2 className="w-8 h-8 animate-spin text-indigo-500" />
</div>
}>
<ChatPageContent />
</Suspense>
);
}

View File

@@ -1,19 +1,24 @@
import type { Metadata } from "next";
import { Inter, Merriweather } from "next/font/google";
import localFont from "next/font/local";
import "./globals.css";
import { OfflineIndicator } from "../components/features/common";
import { InstallPrompt } from "../components/features/pwa/install-prompt";
import { ThemeProvider } from "@/components/theme-provider";
const inter = Inter({
const inter = localFont({
src: "../../public/fonts/Inter-VariableFont.woff2",
variable: "--font-inter",
subsets: ["latin"],
display: "swap",
});
const merriweather = Merriweather({
const merriweather = localFont({
src: [
{ path: "../../public/fonts/Merriweather-Light.woff2", weight: "300", style: "normal" },
{ path: "../../public/fonts/Merriweather-Regular.woff2", weight: "400", style: "normal" },
{ path: "../../public/fonts/Merriweather-Bold.woff2", weight: "700", style: "normal" },
{ path: "../../public/fonts/Merriweather-Black.woff2", weight: "900", style: "normal" },
],
variable: "--font-merriweather",
subsets: ["latin"],
weight: ["300", "400", "700", "900"],
display: "swap",
});