Skip to content

Commit c6b8307

Browse files
committed
fixed some type errors
1 parent 7fcb0b5 commit c6b8307

4 files changed

Lines changed: 13 additions & 12 deletions

File tree

app/community/page.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import {
2020
import { getFeedByType, getFeedPosts } from "../data/feed"
2121
import { getUserById, getAllUsers } from "@/lib/api"
2222
import { formatDate, formatNumber } from "@/lib/format"
23+
import type { FeedPost } from "../data/feed"
2324

2425
export const dynamic = 'force-dynamic'
2526

@@ -156,7 +157,7 @@ export default async function CommunityPage() {
156157

157158
import type { ApiUser } from "@/lib/api"
158159

159-
function FeedPost({ post, users }: { post: (typeof feedPosts)[0], users: ApiUser[] }) {
160+
function FeedPost({ post, users }: { post: FeedPost, users: ApiUser[] }) {
160161
const author = users.find(u => String(u.id) === String(post.authorId))
161162

162163
const typeIcons = {
@@ -191,8 +192,8 @@ function FeedPost({ post, users }: { post: (typeof feedPosts)[0], users: ApiUser
191192
<span className="text-xs sm:text-sm text-muted-foreground hidden sm:inline">@{author?.username}</span>
192193
<span className="text-muted-foreground hidden sm:inline">·</span>
193194
<span className="text-xs sm:text-sm text-muted-foreground">{formatDate(post.createdAt)}</span>
194-
<Badge className={`${typeColors[post.type]} text-[10px] sm:text-xs shrink-0`}>
195-
{typeIcons[post.type]}
195+
<Badge className={`${typeColors[post.type as keyof typeof typeColors]} text-[10px] sm:text-xs shrink-0`}>
196+
{typeIcons[post.type as keyof typeof typeIcons]}
196197
<span className="ml-0.5 sm:ml-1 capitalize">{post.type}</span>
197198
</Badge>
198199
</div>
@@ -221,7 +222,7 @@ function FeedPost({ post, users }: { post: (typeof feedPosts)[0], users: ApiUser
221222

222223
{post.tags.length > 0 && (
223224
<div className="flex flex-wrap gap-1 mt-2 sm:mt-3">
224-
{post.tags.map((tag) => (
225+
{post.tags.map((tag: string) => (
225226
<Badge key={tag} variant="outline" className="text-[10px] sm:text-xs">
226227
#{tag}
227228
</Badge>

app/crowdfunding/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Card, CardContent } from "@/components/ui/card"
44
import { Badge } from "@/components/ui/badge"
55
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"
66
import { DollarSign, Flame, Star, Clock } from "lucide-react"
7-
import { campaignCategories, getFeaturedCampaigns, getStaffPicks, fetchCampaigns } from "../data/campaigns"
7+
import { campaignCategories, getFeaturedCampaigns, getStaffPicks, fetchCampaigns, type Campaign } from "../data/campaigns"
88
import { getUserById } from "@/lib/api"
99
import { formatCurrency, formatNumber, calculateFundingProgress } from "@/lib/format"
1010

@@ -120,7 +120,7 @@ export default async function CrowdfundingPage() {
120120
)
121121
}
122122

123-
function CampaignCard({ campaign, creatorsMap }: { campaign: (typeof campaigns)[0]; creatorsMap: Map<string, any> }) {
123+
function CampaignCard({ campaign, creatorsMap }: { campaign: Campaign; creatorsMap: Map<string, any> }) {
124124
const creator = creatorsMap.get(String(campaign.creatorId))
125125
const progress = calculateFundingProgress(campaign.raisedAmount, campaign.goalAmount)
126126

app/marketplace/[id]/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export default async function ListingPage({ params }: { params: Promise<{ id: st
102102
<RequestInfoDialog
103103
listingId={listing.id}
104104
listingName={listing.name}
105-
askingPrice={listing.asking_price}
105+
askingPrice={listing.askingPrice}
106106
>
107107
<Button className="border border-border shadow-[var(--shadow-button)] font-bold">
108108
<MessageSquare className="h-4 w-4 mr-2" />
@@ -402,7 +402,7 @@ export default async function ListingPage({ params }: { params: Promise<{ id: st
402402
<SubmitLoiDialog
403403
listingId={listing.id}
404404
listingName={listing.name}
405-
askingPrice={listing.asking_price}
405+
askingPrice={listing.askingPrice}
406406
>
407407
<Button className="w-full border border-border shadow-[var(--shadow-button)] font-bold text-lg py-6 mb-3">
408408
Submit Letter of Intent

components/dialogs/back-project-dialog.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ interface Reward {
3131
items: string[]
3232
estimatedDelivery: string
3333
shipsTo: string
34-
limitedQuantity?: number
34+
limitedQuantity?: number | null
3535
claimed: number
3636
}
3737

@@ -209,7 +209,7 @@ export function BackProjectDialog({ campaignId, campaignTitle, rewards, children
209209
}`}
210210
>
211211
<div className="flex items-start gap-3">
212-
<RadioGroupItem value={reward.id} disabled={isSoldOut} className="mt-1" />
212+
<RadioGroupItem value={reward.id} disabled={!!isSoldOut} className="mt-1" />
213213
<div className="flex-1">
214214
<div className="flex items-center justify-between mb-1">
215215
<span className="text-xl font-black">{formatCurrency(reward.amount)}</span>
@@ -451,11 +451,11 @@ export function BackProjectDialog({ campaignId, campaignTitle, rewards, children
451451
</Button>
452452
<Button
453453
onClick={handleProceedToConfirmation}
454-
disabled={
454+
disabled={!!(
455455
!cardNumber.trim() || !expiryDate.trim() || !cvv.trim() || !cardName.trim() ||
456456
!fullName.trim() || !city.trim() || !country.trim() ||
457457
(selectedReward && (!address.trim() || !postalCode.trim()))
458-
}
458+
)}
459459
className="border-2 border-black shadow-[4px_4px_0_0_#000] font-bold"
460460
>
461461
Review Order

0 commit comments

Comments
 (0)