Skip to content

Commit a83c627

Browse files
Merge pull request #101 from syntaxandsips/mr-dark-debug/fix-npm-run-build-errors
Fix Next.js build errors for topics page and UI components
2 parents b855398 + 2f3fdd8 commit a83c627

4 files changed

Lines changed: 26 additions & 10 deletions

File tree

src/app/topics/page.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export const metadata: Metadata = {
2222
type SearchParamsShape = Record<string, string | string[] | undefined>;
2323

2424
type TopicsPageProps = {
25-
searchParams?: SearchParamsShape | Promise<SearchParamsShape>;
25+
searchParams?: Promise<SearchParamsShape>;
2626
};
2727

2828
const footerLinks = [
@@ -229,10 +229,7 @@ const normalizeParam = (value: string | string[] | undefined) =>
229229
(Array.isArray(value) ? value[0] : value) ?? null;
230230

231231
export default async function TopicsPage({ searchParams }: TopicsPageProps) {
232-
const resolvedSearchParams: SearchParamsShape =
233-
searchParams && typeof (searchParams as Promise<unknown>).then === 'function'
234-
? await (searchParams as Promise<SearchParamsShape>)
235-
: (searchParams ?? {});
232+
const resolvedSearchParams: SearchParamsShape = (await searchParams) ?? {};
236233

237234
const rawTopic = normalizeParam(resolvedSearchParams.topic);
238235
const rawQuery = normalizeParam(resolvedSearchParams.q);

src/components/admin/CommentsModeration.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,9 @@ export const CommentsModeration = ({
187187
<AlertDialogHeader>
188188
<AlertDialogTitle>Delete comment?</AlertDialogTitle>
189189
<AlertDialogDescription>
190-
This will permanently delete this comment from {comment.authorName}. This action cannot be undone.
190+
This will permanently delete this comment from
191+
{" "}
192+
{comment.authorDisplayName ?? 'this reader'}. This action cannot be undone.
191193
</AlertDialogDescription>
192194
</AlertDialogHeader>
193195
<AlertDialogFooter>

src/components/ui/alert-dialog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ function AlertDialogCancel({
138138
}: React.ComponentProps<typeof AlertDialogPrimitive.Cancel>) {
139139
return (
140140
<AlertDialogPrimitive.Cancel
141-
className={cn(buttonVariants({ variant: "neutral" }), className)}
141+
className={cn(buttonVariants({ variant: "outline" }), className)}
142142
{...props}
143143
/>
144144
)

src/components/ui/calendar.tsx

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"use client"
22

33
import * as React from "react"
4-
import { ChevronLeft, ChevronRight } from "lucide-react"
4+
import { ChevronDown, ChevronLeft, ChevronRight, ChevronUp } from "lucide-react"
55
import { DayPicker } from "react-day-picker"
66

77
import { buttonVariants } from "@/components/ui/button"
@@ -75,8 +75,25 @@ function Calendar({
7575
),
7676
}}
7777
components={{
78-
IconLeft: ({ ...props }) => <ChevronLeft className="h-4 w-4" {...props} />,
79-
IconRight: ({ ...props }) => <ChevronRight className="h-4 w-4" {...props} />,
78+
Chevron: ({ orientation = "right", className, size, disabled, ...iconProps }) => {
79+
const IconComponent =
80+
orientation === "left"
81+
? ChevronLeft
82+
: orientation === "up"
83+
? ChevronUp
84+
: orientation === "down"
85+
? ChevronDown
86+
: ChevronRight
87+
88+
return (
89+
<IconComponent
90+
className={cn("h-4 w-4", disabled ? "opacity-40" : undefined, className)}
91+
size={size}
92+
aria-hidden="true"
93+
{...iconProps}
94+
/>
95+
)
96+
},
8097
}}
8198
{...props}
8299
/>

0 commit comments

Comments
 (0)