Fixed various build errors

This commit is contained in:
Christopher
2026-01-22 14:00:12 -08:00
parent cc302c73d4
commit 38a6b88e7e
5 changed files with 13 additions and 15 deletions
+3 -5
View File
@@ -154,15 +154,13 @@ export default function ProfilePage() {
const method = isFollowing ? 'DELETE' : 'POST'; const method = isFollowing ? 'DELETE' : 'POST';
const res = await fetch(`/api/users/${handle}/follow`, { method }); const res = await fetch(`/api/users/${handle}/follow`, { method });
if (res.ok) { if (res.ok && user) {
setIsFollowing(!isFollowing); setIsFollowing(!isFollowing);
if (user) {
setUser({ setUser({
...user, ...user,
followersCount: isFollowing ? user.followersCount - 1 : user.followersCount + 1, followersCount: isFollowing ? (user.followersCount || 0) - 1 : (user.followersCount || 0) + 1,
}); });
} }
}
}; };
const handleSaveProfile = async () => { const handleSaveProfile = async () => {
@@ -352,7 +350,7 @@ export default function ProfilePage() {
fontSize: '14px', fontSize: '14px',
}}> }}>
<CalendarIcon /> <CalendarIcon />
<span>Joined {formatDate(user.createdAt)}</span> <span>Joined {formatDate(user.createdAt || new Date().toISOString())}</span>
</div> </div>
<div style={{ display: 'flex', gap: '16px', marginTop: '12px' }}> <div style={{ display: 'flex', gap: '16px', marginTop: '12px' }}>
+1 -1
View File
@@ -1,7 +1,7 @@
import { NextResponse } from 'next/server'; import { NextResponse } from 'next/server';
import { db, posts, users, notifications } from '@/db'; import { db, posts, users, notifications } from '@/db';
import { requireAuth } from '@/lib/auth'; import { requireAuth } from '@/lib/auth';
import { eq } from 'drizzle-orm'; import { eq, and } from 'drizzle-orm';
type RouteContext = { params: Promise<{ id: string }> }; type RouteContext = { params: Promise<{ id: string }> };
+2 -2
View File
@@ -70,13 +70,13 @@ export async function GET(
...post, ...post,
isLiked: likedPostIds.has(post.id), isLiked: likedPostIds.has(post.id),
isReposted: repostedPostIds.has(post.id), isReposted: repostedPostIds.has(post.id),
}; } as any;
replyPosts = replies.map(r => ({ replyPosts = replies.map(r => ({
...r, ...r,
isLiked: likedPostIds.has(r.id), isLiked: likedPostIds.has(r.id),
isReposted: repostedPostIds.has(r.id), isReposted: repostedPostIds.has(r.id),
})); })) as any;
} }
} catch { } catch {
// Not authenticated or other error, skip flags // Not authenticated or other error, skip flags
+1 -1
View File
@@ -328,7 +328,7 @@ export async function GET(request: Request) {
...p, ...p,
isLiked: likedPostIds.has(p.id), isLiked: likedPostIds.has(p.id),
isReposted: repostedPostIds.has(p.id), isReposted: repostedPostIds.has(p.id),
})); })) as any;
} }
} }
} catch (error) { } catch (error) {
+3 -3
View File
@@ -1,14 +1,14 @@
'use client'; 'use client';
import { useState } from 'react'; import { useState, useEffect } from 'react';
import Link from 'next/link'; import Link from 'next/link';
import { HeartIcon, RepeatIcon, MessageIcon, FlagIcon } from '@/components/Icons'; import { HeartIcon, RepeatIcon, MessageIcon, FlagIcon } from '@/components/Icons';
import { Post } from '@/lib/types'; import { Post } from '@/lib/types';
interface PostCardProps { interface PostCardProps {
post: Post; post: Post;
onLike?: (id: string) => void; onLike?: (id: string, currentLiked: boolean) => void;
onRepost?: (id: string) => void; onRepost?: (id: string, currentReposted: boolean) => void;
onComment?: (post: Post) => void; onComment?: (post: Post) => void;
isDetail?: boolean; isDetail?: boolean;
} }