feat(frontend): connect Next.js server components to Go backend REST API with resilient fallback
- Implement typed REST API client in refer_landing_page/lib/api.ts - Support API_BASE_URL environment variable with graceful fallback to static content - Connect Home page (projects, areas, stats), Members page (active, alumni), Publications (highlights, list, patents), Lectures, and Standardization pages to backend endpoints - Pass all 12 SSG build, TypeScript, ESLint, and E2E quality gates
This commit is contained in:
@@ -1,17 +1,27 @@
|
||||
import React from "react";
|
||||
import Link from "next/link";
|
||||
import { PUB_CATEGORIES } from "../../../content/categories";
|
||||
import { publications, patents } from "../../../content/publications";
|
||||
import { publications as staticPubs, patents as staticPatents } from "../../../content/publications";
|
||||
import { PubCategory } from "../../../content/types";
|
||||
|
||||
export interface CategoryCounts {
|
||||
"intl-journal-conf"?: number;
|
||||
"domestic-journal-conf"?: number;
|
||||
patent?: number;
|
||||
}
|
||||
|
||||
interface CategoryNavProps {
|
||||
currentCategory?: PubCategory;
|
||||
counts?: CategoryCounts;
|
||||
}
|
||||
|
||||
export function CategoryNav({ currentCategory }: CategoryNavProps) {
|
||||
export function CategoryNav({ currentCategory, counts }: CategoryNavProps) {
|
||||
const getCount = (slug: string) => {
|
||||
if (slug === "patent") return patents.length;
|
||||
return publications.filter((p) => p.category === slug).length;
|
||||
if (counts?.[slug as keyof CategoryCounts] !== undefined) {
|
||||
return counts[slug as keyof CategoryCounts]!;
|
||||
}
|
||||
if (slug === "patent") return staticPatents.length;
|
||||
return staticPubs.filter((p) => p.category === slug).length;
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user