137 | >(({ className, children, ...props }, ref) => {
138 | const { error, formMessageId } = useFormField();
139 | const body = error ? String(error?.message) : children;
140 |
141 | if (!body) {
142 | return null;
143 | }
144 |
145 | return (
146 |
152 | {body}
153 |
154 | );
155 | });
156 | FormMessage.displayName = "FormMessage";
157 |
158 | export {
159 | useFormField,
160 | Form,
161 | FormItem,
162 | FormLabel,
163 | FormControl,
164 | FormDescription,
165 | FormMessage,
166 | FormField,
167 | };
168 |
--------------------------------------------------------------------------------
/components/markdown/markdown-element/markdown-element.tsx:
--------------------------------------------------------------------------------
1 | import Image from "next/image";
2 | import Link from "next/link";
3 | import { ExternalLink } from "lucide-react";
4 |
5 | import { cn } from "@/lib/utils";
6 |
7 | import { MarkdownElementProps } from "./markdown-element.type";
8 | import { MarkdownHeading } from "@/components/markdown/elements/heading";
9 | import { MarkdownCode } from "@/components/markdown/elements/code";
10 |
11 | export const MarkdownElement = ({ element, parent = null }: MarkdownElementProps) => {
12 | if (parent) {
13 | if (parent.type === "heading" && element.type === "text") {
14 | return ;
15 | }
16 |
17 | if (
18 | parent.type === "blockquote" &&
19 | element.type === "paragraph" &&
20 | element.children[0].type === "text"
21 | ) {
22 | return {element.children[0].value}
;
23 | }
24 |
25 | if (parent.type === "paragraph") {
26 | if (element.type === "strong" && element.children[0].type === "text") {
27 | return (
28 | {element.children[0].value}
29 | );
30 | }
31 |
32 | if (element.type === "link" && element.children[0].type === "text") {
33 | return (
34 |
39 | {element.children[0].value}
40 |
41 |
42 | );
43 | }
44 |
45 | if (element.type === "link" && element.children[0].children[0].type === "text") {
46 | return (
47 |
52 | {element.children[0].value}
53 |
54 |
55 | );
56 | }
57 |
58 | if (element.type === "image") {
59 | return (
60 |
67 | );
68 | }
69 |
70 | if (element.type === "text") {
71 | return <>{element.value}>;
72 | }
73 |
74 | if (element.type === "inlineCode") {
75 | return {element.value};
76 | }
77 |
78 | return {element};
79 | }
80 |
81 | if (element.type === "listItem") {
82 | return (
83 | <>
84 | {/* @ts-ignore */}
85 | {element.children.map((child, i) => {
86 | if (child.type === "paragraph") {
87 | return (
88 |
89 |
90 |
91 | );
92 | }
93 |
94 | if (child.type === "list") {
95 | return ;
96 | }
97 | })}
98 | >
99 | );
100 | }
101 |
102 | if (
103 | element.type == "paragraph" &&
104 | element.children[0].type === "link" &&
105 | element.children[0].children[0].type === "text"
106 | ) {
107 | return (
108 |
109 | {/* @ts-ignore */}
110 | {element.children.map((child, i) => (
111 |
112 | ))}
113 |
114 | );
115 | }
116 |
117 | return {element}
;
118 | }
119 |
120 | if (element.type === "thematicBreak") {
121 | return
;
122 | }
123 |
124 | if (element.type === "heading" || element.type === "blockquote") {
125 | return ;
126 | }
127 |
128 | if (element.type === "paragraph") {
129 | return (
130 |
131 | {/* @ts-ignore */}
132 | {element.children.map((child, i) => (
133 |
134 | ))}
135 |
136 | );
137 | }
138 |
139 | if (element.type === "list") {
140 | const listStyle = cn("ml-1 text-foreground/85", {
141 | "list-descimal": element.ordered,
142 | "list-disc": !element.ordered,
143 | });
144 | return (
145 |
146 | {/* @ts-ignore */}
147 | {element.children.map((child, i) => (
148 |
149 | ))}
150 |
151 | );
152 | }
153 |
154 | if (element.type === "code") {
155 | return ;
156 | }
157 |
158 | return {element};
159 | };
160 |
--------------------------------------------------------------------------------
/components/ui/toast.tsx:
--------------------------------------------------------------------------------
1 | import * as React from "react";
2 | import * as ToastPrimitives from "@radix-ui/react-toast";
3 | import { cva, type VariantProps } from "class-variance-authority";
4 | import { X } from "lucide-react";
5 |
6 | import { cn } from "@/lib/utils";
7 |
8 | const ToastProvider = ToastPrimitives.Provider;
9 |
10 | const ToastViewport = React.forwardRef<
11 | React.ElementRef,
12 | React.ComponentPropsWithoutRef
13 | >(({ className, ...props }, ref) => (
14 |
22 | ));
23 | ToastViewport.displayName = ToastPrimitives.Viewport.displayName;
24 |
25 | const toastVariants = cva(
26 | "group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",
27 | {
28 | variants: {
29 | variant: {
30 | default: "border bg-background text-foreground",
31 | destructive:
32 | "destructive group border-destructive bg-destructive text-destructive-foreground",
33 | },
34 | },
35 | defaultVariants: {
36 | variant: "default",
37 | },
38 | }
39 | );
40 |
41 | const Toast = React.forwardRef<
42 | React.ElementRef,
43 | React.ComponentPropsWithoutRef & VariantProps
44 | >(({ className, variant, ...props }, ref) => {
45 | return (
46 |
51 | );
52 | });
53 | Toast.displayName = ToastPrimitives.Root.displayName;
54 |
55 | const ToastAction = React.forwardRef<
56 | React.ElementRef,
57 | React.ComponentPropsWithoutRef
58 | >(({ className, ...props }, ref) => (
59 |
67 | ));
68 | ToastAction.displayName = ToastPrimitives.Action.displayName;
69 |
70 | const ToastClose = React.forwardRef<
71 | React.ElementRef,
72 | React.ComponentPropsWithoutRef
73 | >(({ className, ...props }, ref) => (
74 |
83 |
84 |
85 | ));
86 | ToastClose.displayName = ToastPrimitives.Close.displayName;
87 |
88 | const ToastTitle = React.forwardRef<
89 | React.ElementRef,
90 | React.ComponentPropsWithoutRef
91 | >(({ className, ...props }, ref) => (
92 |
93 | ));
94 | ToastTitle.displayName = ToastPrimitives.Title.displayName;
95 |
96 | const ToastDescription = React.forwardRef<
97 | React.ElementRef,
98 | React.ComponentPropsWithoutRef
99 | >(({ className, ...props }, ref) => (
100 |
105 | ));
106 | ToastDescription.displayName = ToastPrimitives.Description.displayName;
107 |
108 | type ToastProps = React.ComponentPropsWithoutRef;
109 |
110 | type ToastActionElement = React.ReactElement;
111 |
112 | export {
113 | type ToastProps,
114 | type ToastActionElement,
115 | ToastProvider,
116 | ToastViewport,
117 | Toast,
118 | ToastTitle,
119 | ToastDescription,
120 | ToastClose,
121 | ToastAction,
122 | };
123 |
--------------------------------------------------------------------------------
/components/ui/select.tsx:
--------------------------------------------------------------------------------
1 | "use client";
2 |
3 | import * as React from "react";
4 | import * as SelectPrimitive from "@radix-ui/react-select";
5 | import { Check, ChevronDown, ChevronUp } from "lucide-react";
6 |
7 | import { cn } from "@/lib/utils";
8 |
9 | const Select = SelectPrimitive.Root;
10 |
11 | const SelectGroup = SelectPrimitive.Group;
12 |
13 | const SelectValue = SelectPrimitive.Value;
14 |
15 | const SelectTrigger = React.forwardRef<
16 | React.ElementRef,
17 | React.ComponentPropsWithoutRef
18 | >(({ className, children, ...props }, ref) => (
19 | span]:line-clamp-1",
23 | className
24 | )}
25 | {...props}
26 | >
27 | {children}
28 |
29 |
30 |
31 |
32 | ));
33 | SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
34 |
35 | const SelectScrollUpButton = React.forwardRef<
36 | React.ElementRef,
37 | React.ComponentPropsWithoutRef
38 | >(({ className, ...props }, ref) => (
39 |
44 |
45 |
46 | ));
47 | SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
48 |
49 | const SelectScrollDownButton = React.forwardRef<
50 | React.ElementRef,
51 | React.ComponentPropsWithoutRef
52 | >(({ className, ...props }, ref) => (
53 |
58 |
59 |
60 | ));
61 | SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;
62 |
63 | const SelectContent = React.forwardRef<
64 | React.ElementRef,
65 | React.ComponentPropsWithoutRef
66 | >(({ className, children, position = "popper", ...props }, ref) => (
67 |
68 |
79 |
80 |
87 | {children}
88 |
89 |
90 |
91 |
92 | ));
93 | SelectContent.displayName = SelectPrimitive.Content.displayName;
94 |
95 | const SelectLabel = React.forwardRef<
96 | React.ElementRef,
97 | React.ComponentPropsWithoutRef
98 | >(({ className, ...props }, ref) => (
99 |
104 | ));
105 | SelectLabel.displayName = SelectPrimitive.Label.displayName;
106 |
107 | const SelectItem = React.forwardRef<
108 | React.ElementRef,
109 | React.ComponentPropsWithoutRef
110 | >(({ className, children, ...props }, ref) => (
111 |
119 |
120 |
121 |
122 |
123 |
124 |
125 | {children}
126 |
127 | ));
128 | SelectItem.displayName = SelectPrimitive.Item.displayName;
129 |
130 | const SelectSeparator = React.forwardRef<
131 | React.ElementRef,
132 | React.ComponentPropsWithoutRef
133 | >(({ className, ...props }, ref) => (
134 |
139 | ));
140 | SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
141 |
142 | export {
143 | Select,
144 | SelectGroup,
145 | SelectValue,
146 | SelectTrigger,
147 | SelectContent,
148 | SelectLabel,
149 | SelectItem,
150 | SelectSeparator,
151 | SelectScrollUpButton,
152 | SelectScrollDownButton,
153 | };
154 |
--------------------------------------------------------------------------------
/components/ui/dropdown-menu.tsx:
--------------------------------------------------------------------------------
1 | "use client";
2 |
3 | import * as React from "react";
4 | import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
5 | import { Check, ChevronRight, Circle } from "lucide-react";
6 |
7 | import { cn } from "@/lib/utils";
8 |
9 | const DropdownMenu = DropdownMenuPrimitive.Root;
10 |
11 | const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
12 |
13 | const DropdownMenuGroup = DropdownMenuPrimitive.Group;
14 |
15 | const DropdownMenuPortal = DropdownMenuPrimitive.Portal;
16 |
17 | const DropdownMenuSub = DropdownMenuPrimitive.Sub;
18 |
19 | const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
20 |
21 | const DropdownMenuSubTrigger = React.forwardRef<
22 | React.ElementRef,
23 | React.ComponentPropsWithoutRef & {
24 | inset?: boolean;
25 | }
26 | >(({ className, inset, children, ...props }, ref) => (
27 |
36 | {children}
37 |
38 |
39 | ));
40 | DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;
41 |
42 | const DropdownMenuSubContent = React.forwardRef<
43 | React.ElementRef,
44 | React.ComponentPropsWithoutRef
45 | >(({ className, ...props }, ref) => (
46 |
54 | ));
55 | DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;
56 |
57 | const DropdownMenuContent = React.forwardRef<
58 | React.ElementRef,
59 | React.ComponentPropsWithoutRef
60 | >(({ className, sideOffset = 4, ...props }, ref) => (
61 |
62 |
71 |
72 | ));
73 | DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
74 |
75 | const DropdownMenuItem = React.forwardRef<
76 | React.ElementRef,
77 | React.ComponentPropsWithoutRef & {
78 | inset?: boolean;
79 | }
80 | >(({ className, inset, ...props }, ref) => (
81 |
90 | ));
91 | DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
92 |
93 | const DropdownMenuCheckboxItem = React.forwardRef<
94 | React.ElementRef,
95 | React.ComponentPropsWithoutRef
96 | >(({ className, children, checked, ...props }, ref) => (
97 |
106 |
107 |
108 |
109 |
110 |
111 | {children}
112 |
113 | ));
114 | DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;
115 |
116 | const DropdownMenuRadioItem = React.forwardRef<
117 | React.ElementRef,
118 | React.ComponentPropsWithoutRef
119 | >(({ className, children, ...props }, ref) => (
120 |
128 |
129 |
130 |
131 |
132 |
133 | {children}
134 |
135 | ));
136 | DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
137 |
138 | const DropdownMenuLabel = React.forwardRef<
139 | React.ElementRef,
140 | React.ComponentPropsWithoutRef & {
141 | inset?: boolean;
142 | }
143 | >(({ className, inset, ...props }, ref) => (
144 |
149 | ));
150 | DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
151 |
152 | const DropdownMenuSeparator = React.forwardRef<
153 | React.ElementRef,
154 | React.ComponentPropsWithoutRef
155 | >(({ className, ...props }, ref) => (
156 |
161 | ));
162 | DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
163 |
164 | const DropdownMenuShortcut = ({ className, ...props }: React.HTMLAttributes) => {
165 | return (
166 |
167 | );
168 | };
169 | DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
170 |
171 | export {
172 | DropdownMenu,
173 | DropdownMenuTrigger,
174 | DropdownMenuContent,
175 | DropdownMenuItem,
176 | DropdownMenuCheckboxItem,
177 | DropdownMenuRadioItem,
178 | DropdownMenuLabel,
179 | DropdownMenuSeparator,
180 | DropdownMenuShortcut,
181 | DropdownMenuGroup,
182 | DropdownMenuPortal,
183 | DropdownMenuSub,
184 | DropdownMenuSubContent,
185 | DropdownMenuSubTrigger,
186 | DropdownMenuRadioGroup,
187 | };
188 |
--------------------------------------------------------------------------------
/public/logo.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------