Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/components/icons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export {
FaRobot as Robot,
FaLock as Lock,
FaCheck as Check,
FaTrash as Trash,
} from "react-icons/fa6";
export { PiShareFat as Share } from "react-icons/pi";
export { CgSearch as Search, CgSpinner as Spinner } from "react-icons/cg";
Expand Down
8 changes: 8 additions & 0 deletions src/components/markdown/editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@

useEffect(() => {
// @ts-expect-error
if (editor?.storage["markdown"].getMarkdown() !== content) {

Check warning on line 506 in src/components/markdown/editor.tsx

View workflow job for this annotation

GitHub Actions / Lint (Oxlint)

eslint-plugin-react-hooks(exhaustive-deps)

React Hook useEffect has missing dependencies: 'editor.storage', and 'editor.commands'
editor?.commands.setContent(content);
}
}, [content]);
Expand All @@ -515,6 +515,7 @@
"flex flex-row justify-between py-1.5 px-2 pb-0 max-md:hidden",
hideMenu && "hidden",
)}
onMouseDown={(e) => e.preventDefault()}
>
<MenuBar
editor={editor}
Expand Down Expand Up @@ -564,6 +565,7 @@
"flex flex-row justify-between px-2 py-1 md:hidden sticky bottom-0 bg-background/50 backdrop-blur",
hideMenu && "hidden",
)}
onMouseDown={(e) => e.preventDefault()}
>
<MenuBar
className="gap-2.5"
Expand Down Expand Up @@ -636,6 +638,7 @@
"flex flex-row justify-end py-1.5 px-2 pb-0 max-md:hidden",
hideMenu && "hidden",
)}
onMouseDown={(e) => e.preventDefault()}
>
<Button
size="sm"
Expand Down Expand Up @@ -672,6 +675,7 @@
"flex flex-row justify-end px-2 py-1 sticky bottom-0 md:hidden",
hideMenu && "hidden",
)}
onMouseDown={(e) => e.preventDefault()}
>
<Button
size="sm"
Expand Down Expand Up @@ -704,6 +708,7 @@
autoFocus: autoFocusDefault,
placeholder,
onFocus,
onBlur,
onChageEditorType,
footer,
id,
Expand All @@ -715,6 +720,7 @@
autoFocus?: boolean;
placeholder?: string;
onFocus?: () => void;
onBlur?: () => void;
onChageEditorType?: () => void;
footer?: React.ReactNode;
id?: string;
Expand All @@ -738,6 +744,7 @@
autoFocus={autoFocus}
placeholder={placeholder}
onFocus={onFocus}
onBlur={onBlur}
id={id}
hideMenu={hideMenu}
/>
Expand All @@ -753,6 +760,7 @@
autoFocus={autoFocus}
placeholder={placeholder}
onFocus={onFocus}
onBlur={onBlur}
id={id}
hideMenu={hideMenu}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function Input({
/>

{endAdornment && (
<div className="ms-2 flex shrink-0 items-center text-muted-foreground">
<div className="ms-2 flex shrink-0 items-center text-muted-foreground text-base">
{endAdornment}
</div>
)}
Expand Down
15 changes: 13 additions & 2 deletions src/components/ui/multi-select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ import {
DropdownMenuTrigger,
} from "@/src/components/ui/dropdown-menu";
import { ChevronDown } from "lucide-react";
import { isNotNil } from "@/src/lib/utils";
import { cn, isNotNil } from "@/src/lib/utils";
import { Fragment } from "react/jsx-runtime";
import { ComponentProps } from "react";

interface Option<V> {
value: V;
Expand All @@ -21,6 +22,9 @@ interface MultiSelectProps<V> {
placeholder?: string;
renderOption: (opt: Option<V>) => React.ReactNode;
keyExtractor: (opt: V) => string | number;
buttonVariant?: ComponentProps<typeof Button>["variant"];
buttonClassName?: string;
id?: string;
}

export function MultiSelect<V>({
Expand All @@ -30,6 +34,9 @@ export function MultiSelect<V>({
placeholder,
renderOption,
keyExtractor,
buttonVariant = "outline",
buttonClassName,
id,
}: MultiSelectProps<V>) {
const selected = value
.map((value) =>
Expand All @@ -40,7 +47,11 @@ export function MultiSelect<V>({
return (
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button variant="outline" className="rounded-md">
<Button
id={id}
variant={buttonVariant}
className={cn("rounded-md", buttonClassName)}
>
{selected.length === 0 && placeholder && (
<span className="text-muted-foreground font-normal">
{placeholder}
Expand Down
48 changes: 48 additions & 0 deletions src/components/ui/simple-select.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
} from "@/src/components/ui/select";

interface SimpleSelectProps<O> {
options: O[];
value: O | undefined;
onChange: (value: O) => void;
valueGetter: (option: O) => string;
labelGetter: (option: O) => string;
placeholder?: string;
className?: string;
}

export function SimpleSelect<O>({
options,
value,
onChange,
valueGetter,
labelGetter,
placeholder,
className,
}: SimpleSelectProps<O>) {
return (
<Select
value={value !== undefined ? valueGetter(value) : undefined}
onValueChange={(key) => {
const match = options.find((o) => valueGetter(o) === key);
if (match !== undefined) onChange(match);
}}
>
<SelectTrigger className={className}>
<SelectValue placeholder={placeholder} />
</SelectTrigger>
<SelectContent>
{options.map((o) => (
<SelectItem key={valueGetter(o)} value={valueGetter(o)}>
{labelGetter(o)}
</SelectItem>
))}
</SelectContent>
</Select>
);
}
Loading