Skip to content

Commit 1233357

Browse files
committed
fix: web lint error fix
1 parent 3e9aa04 commit 1233357

20 files changed

Lines changed: 98 additions & 77 deletions

File tree

apps/web/app/api/trpc/[trpc]/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const handler = async (req: Request) => {
2323
},
2424
}
2525
: null,
26-
io: null as any, // ⚠️ Mocking io for Next.js API route environment
26+
io: null as unknown as Context['io'], // ⚠️ Mocking io for Next.js API route environment
2727
};
2828
};
2929

apps/web/app/article/[slug]/page.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ export default function ArticlePage() {
5959
<div className="flex flex-col items-center gap-3 text-center">
6060

6161
<Image
62-
src={(article as any).authorImage || "/avatar.jpg"}
62+
src={article.authorImage || "/avatar.jpg"}
6363
alt="author"
64-
width={10}
65-
height={10}
64+
width={40}
65+
height={40}
6666
className="rounded-full aspect-square object-cover"
6767
/>
6868

@@ -121,7 +121,7 @@ export default function ArticlePage() {
121121
<Loader2 className="w-6 h-6 animate-spin text-zinc-500" />
122122
</div>
123123
) : comments && comments.length > 0 ? (
124-
(comments as any).map((comment: any)=> (
124+
comments.map((comment) => (
125125
<Comment
126126
key={comment.id}
127127
comment={comment}

apps/web/app/article/create/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,9 @@ export default function ComposeArticlePage() {
9898
utils.articles.getArticles.invalidate();
9999
router.push('/feed');
100100

101-
} catch (error: any) {
101+
} catch (error) {
102102
console.error(error);
103-
toast.error(error.message || "Failed to publish article");
103+
toast.error(error instanceof Error ? error.message : "Failed to publish article");
104104
} finally {
105105
setUploading(false);
106106
}

apps/web/app/feed/FeedClient.tsx

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ import { LeftSidebar } from '@/components/layout/left-sidebar/LeftSidebar';
44
import { RightSidebar } from '@/components/layout/right-sidebar/RightSidebar';
55
import { FeedBox } from './components/feedbox/FeedBox';
66
import { trpc } from '@/utils/trpc';
7-
import { useState, useEffect } from 'react';
8-
import { useSession } from 'next-auth/react';
97

108
interface FeedClientProps {
119
session: Session | null;
@@ -16,13 +14,6 @@ export default function FeedClient({ session }: FeedClientProps) {
1614
{},
1715
{ enabled: !!session } // Only fetch user sidebar info if logged in
1816
);
19-
const [showOnboarding, setShowOnboarding] = useState(false);
20-
21-
useEffect(() => {
22-
if (!isLoading && userInfo?.user && !userInfo.user.onboardingCompleted) {
23-
setShowOnboarding(true);
24-
}
25-
}, [isLoading, userInfo]);
2617

2718
return (
2819
<div className="flex justify-center min-h-screen bg-black">

apps/web/app/feed/components/Comment.tsx

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,22 @@ import { useState } from "react";
66
import { trpc } from "@/utils/trpc";
77
import { formatPostTime } from "@/utils/formatTime";
88

9+
interface CommentData {
10+
id: string;
11+
content: string;
12+
createdAt: string | Date;
13+
user: {
14+
id: string;
15+
name?: string | null;
16+
email?: string | null;
17+
image?: string | null;
18+
};
19+
likes?: any[];
20+
replies?: CommentData[];
21+
}
22+
923
interface CommentProps {
10-
comment: any;
24+
comment: CommentData;
1125
targetId: string;
1226
type?: "post" | "article";
1327
onCommentAdded: () => void;
@@ -170,7 +184,7 @@ export function Comment({ comment, targetId, type = "post", onCommentAdded, dept
170184
{/* Nested Replies */}
171185
{comment.replies && comment.replies.length > 0 && (
172186
<div className="ml-8 border-l-2 border-neutral-800">
173-
{comment.replies.map((reply: any) => (
187+
{comment.replies.map((reply) => (
174188
<Comment
175189
key={reply.id}
176190
comment={reply}

apps/web/app/feed/components/feedbox/CreatePostBox.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"use client";
22
import { useState } from "react";
3-
import { FileText, Sparkles, Code2, Users, Image, Smile } from "lucide-react";
3+
import { FileText, Sparkles, Code2, Users, Image as ImageIcon, Smile } from "lucide-react";
44
import ImageNext from "next/image";
55
import { useRouter } from "next/navigation";
66
import type { Session } from "next-auth";
@@ -90,7 +90,7 @@ export function CreatePostBox({ groupId, session }: CreatePostBoxProps = {}) {
9090
className="hover:text-white transition-colors"
9191
title="Add image"
9292
>
93-
<Image size={18} />
93+
<ImageIcon size={18} />
9494
</button>
9595
<button
9696
onClick={() => setIsModalOpen(true)}

apps/web/app/feed/components/feedbox/CreatePostModal.tsx

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import type React from "react"
44
import { useState, useRef } from "react"
5-
import { X, Image, Smile, Loader2 } from "lucide-react"
5+
import { X, Image as ImageIcon, Smile, Loader2 } from "lucide-react"
66
import { motion, AnimatePresence } from "framer-motion"
77
import NextImage from "next/image"
88
import { toast } from "sonner"
@@ -32,7 +32,6 @@ const trendingTags = [
3232
export function CreatePostModal({
3333
isOpen,
3434
onClose,
35-
session,
3635
groupId,
3736
prefillContent = "",
3837
prefillImages = [],
@@ -262,10 +261,13 @@ export function CreatePostModal({
262261
<div className="flex flex-wrap gap-2 mt-3">
263262
{files.map((file, i) => (
264263
<div key={i} className="relative group">
265-
<img
264+
<NextImage
266265
src={URL.createObjectURL(file)}
267-
alt=""
266+
alt="preview"
267+
width={80}
268+
height={80}
268269
className="h-20 w-20 object-cover rounded-lg border border-zinc-700"
270+
unoptimized
269271
/>
270272
<button
271273
onClick={() => removeFile(i)}
@@ -282,10 +284,12 @@ export function CreatePostModal({
282284
{existingImages.length > 0 && (
283285
<div className="flex flex-wrap gap-2 mt-3">
284286
{existingImages.map((url, i) => (
285-
<img
287+
<NextImage
286288
key={i}
287289
src={url}
288-
alt=""
290+
alt="existing preview"
291+
width={80}
292+
height={80}
289293
className="h-20 w-20 object-cover rounded-lg border border-zinc-700"
290294
/>
291295
))}
@@ -301,7 +305,7 @@ export function CreatePostModal({
301305
className="hover:text-white transition-colors"
302306
title="Attach image"
303307
>
304-
<Image size={18} />
308+
<ImageIcon size={18} />
305309
</button>
306310
<button className="hover:text-white transition-colors" title="Emoji">
307311
<Smile size={18} />

apps/web/app/feed/components/feedbox/DraftModal.tsx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import type { Session } from "next-auth"
88
import { trpc } from "@/utils/trpc"
99
import { CreatePostModal } from "./CreatePostModal"
1010

11+
import Image from "next/image"
12+
1113
interface DraftModalProps {
1214
open: boolean
1315
onClose: () => void
@@ -117,12 +119,14 @@ export function DraftModal({ open, onClose, session, groupId }: DraftModalProps)
117119
{draft.images && draft.images.length > 0 && (
118120
<div className="flex gap-2 mt-2">
119121
{draft.images.slice(0, 3).map((url, i) => (
120-
<img
121-
key={i}
122-
src={url}
123-
alt=""
124-
className="h-12 w-12 object-cover rounded-lg border border-zinc-700"
125-
/>
122+
<div key={i} className="relative h-12 w-12 shrink-0">
123+
<Image
124+
src={url}
125+
alt="draft preview"
126+
fill
127+
className="object-cover rounded-lg border border-zinc-700"
128+
/>
129+
</div>
126130
))}
127131
{draft.images.length > 3 && (
128132
<div className="h-12 w-12 rounded-lg bg-zinc-800 border border-zinc-700 flex items-center justify-center text-xs text-zinc-400">

apps/web/app/feed/components/feedbox/PostCard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export function PostCard({
6262
const [isDeleted, setIsDeleted] = useState(false);
6363

6464
const toggleLikeMutation = trpc.likes.toggleLike.useMutation({
65-
onError: (err) => {
65+
onError: () => {
6666
toast.error("Failed to like post");
6767
// Rollback
6868
setIsLiked(isLiked);

apps/web/app/feed/components/feedbox/PostCardView.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { PostContent } from "./PostContent";
88
import { useRouter } from "next/navigation";
99

1010
type PostCardViewProps = {
11+
user: string;
1112
name: string;
1213
username: string;
1314
time: string;
@@ -40,6 +41,7 @@ type PostCardViewProps = {
4041
};
4142

4243
export function PostCardView({
44+
user,
4345
name,
4446
username,
4547
time,
@@ -74,14 +76,14 @@ export function PostCardView({
7476

7577
const embedRegex = /\[PROJECT_EMBED:(.+?)\]/;
7678
const match = text.match(embedRegex);
77-
let projectEmbed: any = null;
79+
let projectEmbed: { id?: string; userId?: string; url?: string; name?: string; description?: string } | null = null;
7880
let cleanText = text;
7981

8082
if (match) {
8183
try {
8284
projectEmbed = JSON.parse(match[1]);
8385
cleanText = text.replace(embedRegex, '').trim();
84-
} catch (e) {
86+
} catch {
8587
// Invalid JSON, ignore
8688
}
8789
}
@@ -94,11 +96,11 @@ export function PostCardView({
9496
<div className="flex justify-between items-start">
9597
<div className="flex gap-2 w-full">
9698
<Image
97-
src={avatarUrl || "/profile.jpg"}
99+
src={user || "/profile.jpg"}
98100
alt="user"
99101
width={36}
100102
height={36}
101-
className="w-9 h-9 object-cover rounded-full cursor-pointer flex-shrink-0"
103+
className="w-9 h-9 object-cover rounded-full cursor-pointer shrink-0"
102104
onClick={onProfileClick}
103105
/>
104106

0 commit comments

Comments
 (0)