Fix TypeScript errors and create .env file
Co-authored-by: denshooter <44590296+denshooter@users.noreply.github.com>
This commit is contained in:
@@ -148,7 +148,7 @@ export async function GET(request: NextRequest) {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Handle missing database table gracefully
|
// Handle missing database table gracefully
|
||||||
if (error instanceof PrismaClientKnownRequestError && error.code === 'P2021') {
|
if (error instanceof PrismaClientKnownRequestError && error.code === 'P2021') {
|
||||||
if (process.env.NOD-fallbackE_ENV === 'development') {
|
if (process.env.NODE_ENV === 'development') {
|
||||||
console.warn('Project table does not exist. Returning empty result.');
|
console.warn('Project table does not exist. Returning empty result.');
|
||||||
}
|
}
|
||||||
return NextResponse.json({
|
return NextResponse.json({
|
||||||
|
|||||||
@@ -8,6 +8,32 @@ import type { JSONContent } from "@tiptap/react";
|
|||||||
import RichTextClient from "./RichTextClient";
|
import RichTextClient from "./RichTextClient";
|
||||||
import CurrentlyReading from "./CurrentlyReading";
|
import CurrentlyReading from "./CurrentlyReading";
|
||||||
|
|
||||||
|
// Type definitions for CMS data
|
||||||
|
interface TechStackItem {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
url?: string;
|
||||||
|
icon_url?: string;
|
||||||
|
sort: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface TechStackCategory {
|
||||||
|
id: string;
|
||||||
|
key: string;
|
||||||
|
icon: string;
|
||||||
|
sort: number;
|
||||||
|
name: string;
|
||||||
|
items: TechStackItem[];
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Hobby {
|
||||||
|
id: string;
|
||||||
|
key: string;
|
||||||
|
icon: string;
|
||||||
|
title: string;
|
||||||
|
description?: string;
|
||||||
|
}
|
||||||
|
|
||||||
const staggerContainer: Variants = {
|
const staggerContainer: Variants = {
|
||||||
hidden: { opacity: 0 },
|
hidden: { opacity: 0 },
|
||||||
visible: {
|
visible: {
|
||||||
@@ -35,8 +61,8 @@ const About = () => {
|
|||||||
const locale = useLocale();
|
const locale = useLocale();
|
||||||
const t = useTranslations("home.about");
|
const t = useTranslations("home.about");
|
||||||
const [cmsDoc, setCmsDoc] = useState<JSONContent | null>(null);
|
const [cmsDoc, setCmsDoc] = useState<JSONContent | null>(null);
|
||||||
const [techStackFromCMS, setTechStackFromCMS] = useState<any[] | null>(null);
|
const [techStackFromCMS, setTechStackFromCMS] = useState<TechStackCategory[] | null>(null);
|
||||||
const [hobbiesFromCMS, setHobbiesFromCMS] = useState<any[] | null>(null);
|
const [hobbiesFromCMS, setHobbiesFromCMS] = useState<Hobby[] | null>(null);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
(async () => {
|
(async () => {
|
||||||
@@ -146,7 +172,7 @@ const About = () => {
|
|||||||
|
|
||||||
// Use CMS Hobbies if available, otherwise fallback
|
// Use CMS Hobbies if available, otherwise fallback
|
||||||
const hobbies = hobbiesFromCMS
|
const hobbies = hobbiesFromCMS
|
||||||
? hobbiesFromCMS.map((hobby: any) => ({
|
? hobbiesFromCMS.map((hobby: Hobby) => ({
|
||||||
icon: iconMap[hobby.icon] || Code,
|
icon: iconMap[hobby.icon] || Code,
|
||||||
text: hobby.title
|
text: hobby.title
|
||||||
}))
|
}))
|
||||||
@@ -154,11 +180,11 @@ const About = () => {
|
|||||||
|
|
||||||
// Use CMS Tech Stack if available, otherwise fallback
|
// Use CMS Tech Stack if available, otherwise fallback
|
||||||
const techStack = techStackFromCMS
|
const techStack = techStackFromCMS
|
||||||
? techStackFromCMS.map((cat: any) => ({
|
? techStackFromCMS.map((cat: TechStackCategory) => ({
|
||||||
key: cat.key,
|
key: cat.key,
|
||||||
category: cat.name,
|
category: cat.name,
|
||||||
icon: iconMap[cat.icon] || Code,
|
icon: iconMap[cat.icon] || Code,
|
||||||
items: cat.items.map((item: any) => item.name)
|
items: cat.items.map((item: TechStackItem) => item.name)
|
||||||
}))
|
}))
|
||||||
: techStackFallback;
|
: techStackFallback;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user