diff --git a/desktop-app/package.json b/desktop-app/package.json index b879a4a4..117c52b2 100644 --- a/desktop-app/package.json +++ b/desktop-app/package.json @@ -6,7 +6,7 @@ "author": "Yoshihide Shiono ", "main": "app/background.js", "scripts": { - "dev": "nextron", + "start": "nextron", "build": "nextron build", "postinstall": "electron-builder install-app-deps", "lint": "next lint" @@ -25,6 +25,7 @@ "electron-serve": "^1.1.0", "electron-store": "^8.1.0", "lucide-react": "^0.268.0", + "prop-types": "^15.8.1", "react-day-picker": "^8.8.1", "react-hook-form": "^7.45.4", "tailwind-merge": "^1.14.0", diff --git a/desktop-app/renderer/components/ui/headerPopover.tsx b/desktop-app/renderer/components/custom/headerPopover.tsx similarity index 81% rename from desktop-app/renderer/components/ui/headerPopover.tsx rename to desktop-app/renderer/components/custom/headerPopover.tsx index dcffd1ea..91aba83b 100644 --- a/desktop-app/renderer/components/ui/headerPopover.tsx +++ b/desktop-app/renderer/components/custom/headerPopover.tsx @@ -4,8 +4,6 @@ import { PopoverTrigger } from '@/components/ui/popover' import { Button } from '@/components/ui/button' -import { Input } from '@/components/ui/input' -import { Label } from '@/components/ui/label' export default function HeaderPopover(): JSX.Element { return ( diff --git a/desktop-app/renderer/components/layout/contextHeader.tsx b/desktop-app/renderer/components/layout/contextHeader.tsx index f76c1726..0ff4c9cf 100644 --- a/desktop-app/renderer/components/layout/contextHeader.tsx +++ b/desktop-app/renderer/components/layout/contextHeader.tsx @@ -1,5 +1,5 @@ import type { ReactNode } from 'react' -import HeaderPopover from '@/components/ui/headerPopover' +import HeaderPopover from '@/components/custom/headerPopover' import { Separator } from '@/components/ui/separator' export default function ContextHeader({ children, diff --git a/desktop-app/renderer/components/ui/accordion.tsx b/desktop-app/renderer/components/ui/accordion.tsx index 882f7a84..e2f68344 100644 --- a/desktop-app/renderer/components/ui/accordion.tsx +++ b/desktop-app/renderer/components/ui/accordion.tsx @@ -1,20 +1,25 @@ -"use client"; +'use client' -import * as AccordionPrimitive from "@radix-ui/react-accordion"; -import { ChevronDown } from "lucide-react"; -import * as React from "react"; +import * as AccordionPrimitive from '@radix-ui/react-accordion' +import { ChevronDown } from 'lucide-react' +import * as React from 'react' -import { cn } from "@/lib/utils"; +import { cn } from '@/lib/utils' -const Accordion = AccordionPrimitive.Root; +const Accordion = AccordionPrimitive.Root const AccordionItem = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( - -)); -AccordionItem.displayName = "AccordionItem"; + +)) +AccordionItem.displayName = 'AccordionItem' +AccordionItem.propTypes = AccordionPrimitive.Item.propTypes const AccordionTrigger = React.forwardRef< React.ElementRef, @@ -24,16 +29,18 @@ const AccordionTrigger = React.forwardRef< svg]:rotate-180", + 'flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180', className )} - {...props}> + {...props} + > {children} -)); -AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName; +)) +AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName +AccordionTrigger.propTypes = AccordionPrimitive.Trigger.propTypes const AccordionContent = React.forwardRef< React.ElementRef, @@ -42,13 +49,15 @@ const AccordionContent = React.forwardRef< + {...props} + >
{children}
-)); -AccordionContent.displayName = AccordionPrimitive.Content.displayName; +)) +AccordionContent.displayName = AccordionPrimitive.Content.displayName +AccordionContent.propTypes = AccordionPrimitive.Content.propTypes -export { Accordion, AccordionContent, AccordionItem, AccordionTrigger }; +export { Accordion, AccordionContent, AccordionItem, AccordionTrigger } diff --git a/desktop-app/renderer/components/ui/button.tsx b/desktop-app/renderer/components/ui/button.tsx index c187a1c3..5fd22c19 100644 --- a/desktop-app/renderer/components/ui/button.tsx +++ b/desktop-app/renderer/components/ui/button.tsx @@ -1,47 +1,47 @@ -import { Slot } from "@radix-ui/react-slot" -import { cva, type VariantProps } from "class-variance-authority" -import * as React from "react" +import { Slot } from '@radix-ui/react-slot' +import { cva, type VariantProps } from 'class-variance-authority' +import * as React from 'react' -import { cn } from "@/lib/utils" +import { cn } from '@/lib/utils' const buttonVariants = cva( - "inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", + 'inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50', { variants: { variant: { - default: "bg-primary text-primary-foreground hover:bg-primary/90", + default: 'bg-primary text-primary-foreground hover:bg-primary/90', destructive: - "bg-destructive text-destructive-foreground hover:bg-destructive/90", + 'bg-destructive text-destructive-foreground hover:bg-destructive/90', outline: - "border border-input bg-background hover:bg-accent hover:text-accent-foreground", + 'border border-input bg-background hover:bg-accent hover:text-accent-foreground', secondary: - "bg-secondary text-secondary-foreground hover:bg-secondary/80", - ghost: "hover:bg-accent hover:text-accent-foreground", - link: "text-primary underline-offset-4 hover:underline", + 'bg-secondary text-secondary-foreground hover:bg-secondary/80', + ghost: 'hover:bg-accent hover:text-accent-foreground', + link: 'text-primary underline-offset-4 hover:underline' }, size: { - default: "h-10 px-4 py-2", - sm: "h-9 rounded-md px-3", - lg: "h-11 rounded-md px-8", - icon: "h-10 w-10", - }, + default: 'h-10 px-4 py-2', + sm: 'h-9 rounded-md px-3', + lg: 'h-11 rounded-md px-8', + icon: 'h-10 w-10' + } }, defaultVariants: { - variant: "default", - size: "default", - }, + variant: 'default', + size: 'default' + } } ) export interface ButtonProps extends React.ButtonHTMLAttributes, - VariantProps { + VariantProps { asChild?: boolean } const Button = React.forwardRef( ({ className, variant, size, asChild = false, ...props }, ref) => { - const Comp = asChild ? Slot : "button" + const Comp = asChild ? Slot : 'button' return ( ( ) } ) -Button.displayName = "Button" +Button.displayName = 'Button' export { Button, buttonVariants } diff --git a/desktop-app/renderer/components/ui/calendar.tsx b/desktop-app/renderer/components/ui/calendar.tsx index 1f02e0e0..38fb5b85 100644 --- a/desktop-app/renderer/components/ui/calendar.tsx +++ b/desktop-app/renderer/components/ui/calendar.tsx @@ -1,11 +1,11 @@ -"use client" +'use client' -import { ChevronLeft, ChevronRight } from "lucide-react" -import * as React from "react" -import { DayPicker } from "react-day-picker" +import { ChevronLeft, ChevronRight } from 'lucide-react' +import * as React from 'react' +import { DayPicker } from 'react-day-picker' -import { buttonVariants } from "@/components/ui/button" -import { cn } from "@/lib/utils" +import { buttonVariants } from '@/components/ui/button' +import { cn } from '@/lib/utils' export type CalendarProps = React.ComponentProps @@ -14,51 +14,52 @@ function Calendar({ classNames, showOutsideDays = true, ...props -}: CalendarProps) { +}: CalendarProps): JSX.Element { return ( , - IconRight: ({ ...props }) => , + IconRight: ({ ...props }) => }} {...props} /> ) } -Calendar.displayName = "Calendar" +Calendar.displayName = 'Calendar' +Calendar.propTypes = DayPicker export { Calendar } diff --git a/desktop-app/renderer/components/ui/card.tsx b/desktop-app/renderer/components/ui/card.tsx index afa13ecf..36b768df 100644 --- a/desktop-app/renderer/components/ui/card.tsx +++ b/desktop-app/renderer/components/ui/card.tsx @@ -1,7 +1,7 @@ -import * as React from "react" - -import { cn } from "@/lib/utils" +import * as React from 'react' +import { cn } from '@/lib/utils' +import PropTypes from 'prop-types' const Card = React.forwardRef< HTMLDivElement, React.HTMLAttributes @@ -9,13 +9,16 @@ const Card = React.forwardRef<
)) -Card.displayName = "Card" +Card.displayName = 'Card' +Card.propTypes = { + className: PropTypes.string +} const CardHeader = React.forwardRef< HTMLDivElement, @@ -23,11 +26,14 @@ const CardHeader = React.forwardRef< >(({ className, ...props }, ref) => (
)) -CardHeader.displayName = "CardHeader" +CardHeader.displayName = 'CardHeader' +CardHeader.propTypes = { + className: PropTypes.string +} const CardTitle = React.forwardRef< HTMLParagraphElement, @@ -36,13 +42,16 @@ const CardTitle = React.forwardRef<

)) -CardTitle.displayName = "CardTitle" +CardTitle.displayName = 'CardTitle' +CardTitle.propTypes = { + className: PropTypes.string +} const CardDescription = React.forwardRef< HTMLParagraphElement, @@ -50,19 +59,25 @@ const CardDescription = React.forwardRef< >(({ className, ...props }, ref) => (

)) -CardDescription.displayName = "CardDescription" +CardDescription.displayName = 'CardDescription' +CardDescription.propTypes = { + className: PropTypes.string +} const CardContent = React.forwardRef< HTMLDivElement, React.HTMLAttributes >(({ className, ...props }, ref) => ( -

+
)) -CardContent.displayName = "CardContent" +CardContent.displayName = 'CardContent' +CardContent.propTypes = { + className: PropTypes.string +} const CardFooter = React.forwardRef< HTMLDivElement, @@ -70,10 +85,13 @@ const CardFooter = React.forwardRef< >(({ className, ...props }, ref) => (
)) -CardFooter.displayName = "CardFooter" +CardFooter.displayName = 'CardFooter' +CardFooter.propTypes = { + className: PropTypes.string +} export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent } diff --git a/desktop-app/renderer/components/ui/form.tsx b/desktop-app/renderer/components/ui/form.tsx deleted file mode 100644 index 53e468c5..00000000 --- a/desktop-app/renderer/components/ui/form.tsx +++ /dev/null @@ -1,170 +0,0 @@ -import type * as LabelPrimitive from '@radix-ui/react-label' -import { Slot } from '@radix-ui/react-slot' -import * as React from 'react' -import { Controller, FormProvider, useFormContext } from 'react-hook-form' -import type { ControllerProps, FieldPath, FieldValues } from 'react-hook-form' - -import { Label } from '@/components/ui/label' -import { cn } from '@/lib/utils' - -const Form = FormProvider - -type FormFieldContextValue< - TFieldValues extends FieldValues = FieldValues, - TName extends FieldPath = FieldPath -> = { - name: TName -} - -const FormFieldContext = React.createContext( - {} as FormFieldContextValue -) - -const FormField = < - TFieldValues extends FieldValues = FieldValues, - TName extends FieldPath = FieldPath ->({ - ...props -}: ControllerProps) => { - return ( - - - - ) -} - -const useFormField = () => { - const fieldContext = React.useContext(FormFieldContext) - const itemContext = React.useContext(FormItemContext) - const { getFieldState, formState } = useFormContext() - - const fieldState = getFieldState(fieldContext.name, formState) - - if (!fieldContext) { - throw new Error('useFormField should be used within ') - } - - const { id } = itemContext - - return { - id, - name: fieldContext.name, - formItemId: `${id}-form-item`, - formDescriptionId: `${id}-form-item-description`, - formMessageId: `${id}-form-item-message`, - ...fieldState - } -} - -type FormItemContextValue = { - id: string -} - -const FormItemContext = React.createContext( - {} as FormItemContextValue -) - -const FormItem = React.forwardRef< - HTMLDivElement, - React.HTMLAttributes ->(({ className, ...props }, ref) => { - const id = React.useId() - - return ( - -
- - ) -}) -FormItem.displayName = 'FormItem' - -const FormLabel = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => { - const { error, formItemId } = useFormField() - - return ( -