fix: resolve all TypeScript errors in web app

This commit is contained in:
Jason Woltje
2026-01-29 22:23:28 -06:00
parent abbf886483
commit 1e927751a9
23 changed files with 207 additions and 136 deletions

View File

@@ -45,8 +45,16 @@ const AlertDialogContext = React.createContext<{
}>({});
export function AlertDialog({ open, onOpenChange, children }: AlertDialogProps) {
const contextValue: { open?: boolean; onOpenChange?: (open: boolean) => void } = {};
if (open !== undefined) {
contextValue.open = open;
}
if (onOpenChange !== undefined) {
contextValue.onOpenChange = onOpenChange;
}
return (
<AlertDialogContext.Provider value={{ open, onOpenChange }}>
<AlertDialogContext.Provider value={contextValue}>
{children}
</AlertDialogContext.Provider>
);

View File

@@ -3,9 +3,9 @@ import type { ButtonProps as BaseButtonProps } from "@mosaic/ui";
import type { ReactNode, ButtonHTMLAttributes } from "react";
// Extend Button to support additional variants
type ExtendedVariant = "primary" | "secondary" | "danger" | "ghost" | "outline" | "destructive" | "link";
type ExtendedVariant = "default" | "primary" | "secondary" | "danger" | "ghost" | "outline" | "destructive" | "link";
export interface ButtonProps extends Omit<BaseButtonProps, "variant"> {
export interface ButtonProps extends Omit<BaseButtonProps, "variant" | "size"> {
variant?: ExtendedVariant;
size?: "sm" | "md" | "lg" | "icon";
children: ReactNode;
@@ -13,6 +13,7 @@ export interface ButtonProps extends Omit<BaseButtonProps, "variant"> {
// Map extended variants to base variants
const variantMap: Record<string, "primary" | "secondary" | "danger" | "ghost"> = {
"default": "primary",
"outline": "ghost",
"destructive": "danger",
"link": "ghost",

View File

@@ -48,8 +48,20 @@ export function Select({ value, onValueChange, defaultValue, disabled, children
setIsOpen(false);
};
const contextValue: {
value?: string;
onValueChange?: (value: string) => void;
isOpen: boolean;
setIsOpen: (open: boolean) => void;
} = { isOpen, setIsOpen };
if (currentValue !== undefined) {
contextValue.value = currentValue;
}
contextValue.onValueChange = handleValueChange;
return (
<SelectContext.Provider value={{ value: currentValue, onValueChange: handleValueChange, isOpen, setIsOpen }}>
<SelectContext.Provider value={contextValue}>
<div className="relative">{children}</div>
</SelectContext.Provider>
);