Refactor component code for improved readability and consistency
Some checks failed
CI / ci (push) Failing after 1m36s

- Simplified map creation in ActivityCorrelations component.
- Adjusted className formatting in AccordionTrigger and other UI components for better readability.
- Removed unnecessary line breaks in various components including Breadcrumb, Calendar, Checkbox, and others.
- Enhanced code formatting in NativeSelect and NavigationMenuTrigger components for consistency.
- Updated route imports in routeTree.gen.ts for uniformity in quotation marks.
- Cleaned up JSX structure in ReminderCard and ReminderForm components for clarity.
This commit is contained in:
2026-08-26 09:19:45 +02:00
parent 4bcc9f0686
commit 7aa5d692dc
20 changed files with 297 additions and 259 deletions

View File

@@ -11,9 +11,7 @@ export function ActivityCorrelations() {
const { data: correlations, isLoading } = useAllCorrelations(activeIds) const { data: correlations, isLoading } = useAllCorrelations(activeIds)
const activityMap = new Map( const activityMap = new Map((activities ?? []).map((a) => [a.id, a.name]))
(activities ?? []).map((a) => [a.id, a.name])
)
const sorted = [...(correlations ?? [])].sort( const sorted = [...(correlations ?? [])].sort(
(a, b) => Math.abs(b.correlation!) - Math.abs(a.correlation!) (a, b) => Math.abs(b.correlation!) - Math.abs(a.correlation!)
@@ -54,7 +52,7 @@ function CorrelationBar({ name, value }: { name: string; value: number }) {
}`} }`}
style={{ width: `${pct / 2}%` }} style={{ width: `${pct / 2}%` }}
/> />
<div className="absolute left-1/2 top-0 h-full w-px bg-muted-foreground/30" /> <div className="absolute top-0 left-1/2 h-full w-px bg-muted-foreground/30" />
</div> </div>
<span <span
className={`w-12 shrink-0 text-right text-xs font-medium ${ className={`w-12 shrink-0 text-right text-xs font-medium ${

View File

@@ -39,8 +39,14 @@ function AccordionTrigger({
{...props} {...props}
> >
{children} {children}
<ChevronDownIcon data-slot="accordion-trigger-icon" className="pointer-events-none shrink-0 group-aria-expanded/accordion-trigger:hidden" /> <ChevronDownIcon
<ChevronUpIcon data-slot="accordion-trigger-icon" className="pointer-events-none hidden shrink-0 group-aria-expanded/accordion-trigger:inline" /> data-slot="accordion-trigger-icon"
className="pointer-events-none shrink-0 group-aria-expanded/accordion-trigger:hidden"
/>
<ChevronUpIcon
data-slot="accordion-trigger-icon"
className="pointer-events-none hidden shrink-0 group-aria-expanded/accordion-trigger:inline"
/>
</AccordionPrimitive.Trigger> </AccordionPrimitive.Trigger>
</AccordionPrimitive.Header> </AccordionPrimitive.Header>
) )

View File

@@ -85,9 +85,7 @@ function BreadcrumbSeparator({
className={cn("[&>svg]:size-3.5", className)} className={cn("[&>svg]:size-3.5", className)}
{...props} {...props}
> >
{children ?? ( {children ?? <ChevronRightIcon />}
<ChevronRightIcon />
)}
</li> </li>
) )
} }
@@ -107,8 +105,7 @@ function BreadcrumbEllipsis({
)} )}
{...props} {...props}
> >
<MoreHorizontalIcon <MoreHorizontalIcon />
/>
<span className="sr-only">More</span> <span className="sr-only">More</span>
</span> </span>
) )

View File

@@ -10,7 +10,11 @@ import {
import { cn } from "@/lib/utils" import { cn } from "@/lib/utils"
import { Button, buttonVariants } from "@/components/ui/button" import { Button, buttonVariants } from "@/components/ui/button"
import { ChevronLeftIcon, ChevronRightIcon, ChevronDownIcon } from "lucide-react" import {
ChevronLeftIcon,
ChevronRightIcon,
ChevronDownIcon,
} from "lucide-react"
function Calendar({ function Calendar({
className, className,
@@ -153,7 +157,10 @@ function Calendar({
if (orientation === "right") { if (orientation === "right") {
return ( return (
<ChevronRightIcon className={cn("size-4", className)} {...props} /> <ChevronRightIcon
className={cn("size-4", className)}
{...props}
/>
) )
} }

View File

@@ -19,8 +19,7 @@ function Checkbox({ className, ...props }: CheckboxPrimitive.Root.Props) {
data-slot="checkbox-indicator" data-slot="checkbox-indicator"
className="grid place-content-center text-current transition-none [&>svg]:size-3.5" className="grid place-content-center text-current transition-none [&>svg]:size-3.5"
> >
<CheckIcon <CheckIcon />
/>
</CheckboxPrimitive.Indicator> </CheckboxPrimitive.Indicator>
</CheckboxPrimitive.Root> </CheckboxPrimitive.Root>
) )

View File

@@ -108,7 +108,10 @@ function ComboboxContent({
<ComboboxPrimitive.Popup <ComboboxPrimitive.Popup
data-slot="combobox-content" data-slot="combobox-content"
data-chips={!!anchor} data-chips={!!anchor}
className={cn("group/combobox-content relative max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-[calc(var(--anchor-width)+--spacing(7))] origin-(--transform-origin) overflow-hidden rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[chips=true]:min-w-(--anchor-width) data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 *:data-[slot=input-group]:m-1 *:data-[slot=input-group]:mb-0 *:data-[slot=input-group]:h-8 *:data-[slot=input-group]:border-input/30 *:data-[slot=input-group]:bg-input/30 *:data-[slot=input-group]:shadow-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className )} className={cn(
"group/combobox-content relative max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-[calc(var(--anchor-width)+--spacing(7))] origin-(--transform-origin) overflow-hidden rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[chips=true]:min-w-(--anchor-width) data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 *:data-[slot=input-group]:m-1 *:data-[slot=input-group]:mb-0 *:data-[slot=input-group]:h-8 *:data-[slot=input-group]:border-input/30 *:data-[slot=input-group]:bg-input/30 *:data-[slot=input-group]:shadow-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
className
)}
{...props} {...props}
/> />
</ComboboxPrimitive.Positioner> </ComboboxPrimitive.Positioner>

View File

@@ -11,10 +11,7 @@ import {
DialogHeader, DialogHeader,
DialogTitle, DialogTitle,
} from "@/components/ui/dialog" } from "@/components/ui/dialog"
import { import { InputGroup, InputGroupAddon } from "@/components/ui/input-group"
InputGroup,
InputGroupAddon,
} from "@/components/ui/input-group"
import { SearchIcon, CheckIcon } from "lucide-react" import { SearchIcon, CheckIcon } from "lucide-react"
function Command({ function Command({

View File

@@ -52,7 +52,10 @@ function ContextMenuContent({
> >
<ContextMenuPrimitive.Popup <ContextMenuPrimitive.Popup
data-slot="context-menu-content" data-slot="context-menu-content"
className={cn("z-50 max-h-(--available-height) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className )} className={cn(
"z-50 max-h-(--available-height) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
className
)}
{...props} {...props}
/> />
</ContextMenuPrimitive.Positioner> </ContextMenuPrimitive.Positioner>
@@ -174,8 +177,7 @@ function ContextMenuCheckboxItem({
> >
<span className="pointer-events-none absolute right-2"> <span className="pointer-events-none absolute right-2">
<ContextMenuPrimitive.CheckboxItemIndicator> <ContextMenuPrimitive.CheckboxItemIndicator>
<CheckIcon <CheckIcon />
/>
</ContextMenuPrimitive.CheckboxItemIndicator> </ContextMenuPrimitive.CheckboxItemIndicator>
</span> </span>
{children} {children}
@@ -214,8 +216,7 @@ function ContextMenuRadioItem({
> >
<span className="pointer-events-none absolute right-2"> <span className="pointer-events-none absolute right-2">
<ContextMenuPrimitive.RadioItemIndicator> <ContextMenuPrimitive.RadioItemIndicator>
<CheckIcon <CheckIcon />
/>
</ContextMenuPrimitive.RadioItemIndicator> </ContextMenuPrimitive.RadioItemIndicator>
</span> </span>
{children} {children}

View File

@@ -76,8 +76,7 @@ function InputOTPSeparator({ ...props }: React.ComponentProps<"div">) {
role="separator" role="separator"
{...props} {...props}
> >
<MinusIcon <MinusIcon />
/>
</div> </div>
) )
} }

View File

@@ -80,7 +80,10 @@ function MenubarContent({
align={align} align={align}
alignOffset={alignOffset} alignOffset={alignOffset}
sideOffset={sideOffset} sideOffset={sideOffset}
className={cn("min-w-36 rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95", className )} className={cn(
"min-w-36 rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95",
className
)}
{...props} {...props}
/> />
) )
@@ -128,8 +131,7 @@ function MenubarCheckboxItem({
> >
<span className="pointer-events-none absolute left-1.5 flex size-4 items-center justify-center [&_svg:not([class*='size-'])]:size-4"> <span className="pointer-events-none absolute left-1.5 flex size-4 items-center justify-center [&_svg:not([class*='size-'])]:size-4">
<MenuPrimitive.CheckboxItemIndicator> <MenuPrimitive.CheckboxItemIndicator>
<CheckIcon <CheckIcon />
/>
</MenuPrimitive.CheckboxItemIndicator> </MenuPrimitive.CheckboxItemIndicator>
</span> </span>
{children} {children}
@@ -163,8 +165,7 @@ function MenubarRadioItem({
> >
<span className="pointer-events-none absolute left-1.5 flex size-4 items-center justify-center [&_svg:not([class*='size-'])]:size-4"> <span className="pointer-events-none absolute left-1.5 flex size-4 items-center justify-center [&_svg:not([class*='size-'])]:size-4">
<MenuPrimitive.RadioItemIndicator> <MenuPrimitive.RadioItemIndicator>
<CheckIcon <CheckIcon />
/>
</MenuPrimitive.RadioItemIndicator> </MenuPrimitive.RadioItemIndicator>
</span> </span>
{children} {children}
@@ -254,7 +255,10 @@ function MenubarSubContent({
return ( return (
<DropdownMenuSubContent <DropdownMenuSubContent
data-slot="menubar-sub-content" data-slot="menubar-sub-content"
className={cn("min-w-32 rounded-lg bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className )} className={cn(
"min-w-32 rounded-lg bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
className
)}
{...props} {...props}
/> />
) )

View File

@@ -105,8 +105,7 @@ function MessageScrollerButton({
> >
{children ?? ( {children ?? (
<> <>
<ArrowDownIcon <ArrowDownIcon />
/>
<span className="sr-only"> <span className="sr-only">
{direction === "end" ? "Scroll to end" : "Scroll to start"} {direction === "end" ? "Scroll to end" : "Scroll to start"}
</span> </span>

View File

@@ -27,7 +27,11 @@ function NativeSelect({
className="h-8 w-full min-w-0 appearance-none rounded-lg border border-input bg-transparent py-1 pr-8 pl-2.5 text-sm transition-colors outline-none select-none selection:bg-primary selection:text-primary-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-[size=sm]:py-0.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40" className="h-8 w-full min-w-0 appearance-none rounded-lg border border-input bg-transparent py-1 pr-8 pl-2.5 text-sm transition-colors outline-none select-none selection:bg-primary selection:text-primary-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-[size=sm]:py-0.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40"
{...props} {...props}
/> />
<ChevronDownIcon className="pointer-events-none absolute top-1/2 right-2.5 size-4 -translate-y-1/2 text-muted-foreground select-none" aria-hidden="true" data-slot="native-select-icon" /> <ChevronDownIcon
className="pointer-events-none absolute top-1/2 right-2.5 size-4 -translate-y-1/2 text-muted-foreground select-none"
aria-hidden="true"
data-slot="native-select-icon"
/>
</div> </div>
) )
} }

View File

@@ -71,7 +71,10 @@ function NavigationMenuTrigger({
{...props} {...props}
> >
{children}{" "} {children}{" "}
<ChevronDownIcon className="relative top-px ml-1 size-3 transition duration-300 group-data-popup-open/navigation-menu-trigger:rotate-180 group-data-open/navigation-menu-trigger:rotate-180" aria-hidden="true" /> <ChevronDownIcon
className="relative top-px ml-1 size-3 transition duration-300 group-data-popup-open/navigation-menu-trigger:rotate-180 group-data-open/navigation-menu-trigger:rotate-180"
aria-hidden="true"
/>
</NavigationMenuPrimitive.Trigger> </NavigationMenuPrimitive.Trigger>
) )
} }

View File

@@ -2,7 +2,11 @@ import * as React from "react"
import { cn } from "@/lib/utils" import { cn } from "@/lib/utils"
import { Button } from "@/components/ui/button" import { Button } from "@/components/ui/button"
import { ChevronLeftIcon, ChevronRightIcon, MoreHorizontalIcon } from "lucide-react" import {
ChevronLeftIcon,
ChevronRightIcon,
MoreHorizontalIcon,
} from "lucide-react"
function Pagination({ className, ...props }: React.ComponentProps<"nav">) { function Pagination({ className, ...props }: React.ComponentProps<"nav">) {
return ( return (
@@ -112,8 +116,7 @@ function PaginationEllipsis({
)} )}
{...props} {...props}
> >
<MoreHorizontalIcon <MoreHorizontalIcon />
/>
<span className="sr-only">More pages</span> <span className="sr-only">More pages</span>
</span> </span>
) )

View File

@@ -125,7 +125,10 @@ function QuestionnaireChoice({
data-slot="questionnaire-choice-indicator-dot" data-slot="questionnaire-choice-indicator-dot"
className="hidden size-2 rounded-full bg-primary-foreground group-data-[type=checkbox]/questionnaire-choice:hidden group-data-checked/questionnaire-choice:block" className="hidden size-2 rounded-full bg-primary-foreground group-data-[type=checkbox]/questionnaire-choice:hidden group-data-checked/questionnaire-choice:block"
/> />
<CheckIcon data-slot="questionnaire-choice-indicator-check" className="hidden size-3.5 group-data-[type=radio]/questionnaire-choice:hidden group-data-checked/questionnaire-choice:block" /> <CheckIcon
data-slot="questionnaire-choice-indicator-check"
className="hidden size-3.5 group-data-[type=radio]/questionnaire-choice:hidden group-data-checked/questionnaire-choice:block"
/>
</span> </span>
<QuestionnairePrimitive.ChoiceLabel <QuestionnairePrimitive.ChoiceLabel
data-slot="questionnaire-choice-label" data-slot="questionnaire-choice-label"

View File

@@ -1,4 +1,3 @@
import * as React from "react"
import { ScrollArea as ScrollAreaPrimitive } from "@base-ui/react/scroll-area" import { ScrollArea as ScrollAreaPrimitive } from "@base-ui/react/scroll-area"
import { cn } from "@/lib/utils" import { cn } from "@/lib/utils"

View File

@@ -83,7 +83,10 @@ function SelectContent({
<SelectPrimitive.Popup <SelectPrimitive.Popup
data-slot="select-content" data-slot="select-content"
data-align-trigger={alignItemWithTrigger} data-align-trigger={alignItemWithTrigger}
className={cn("relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className )} className={cn(
"relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
className
)}
{...props} {...props}
> >
<SelectScrollUpButton /> <SelectScrollUpButton />
@@ -162,8 +165,7 @@ function SelectScrollUpButton({
)} )}
{...props} {...props}
> >
<ChevronUpIcon <ChevronUpIcon />
/>
</SelectPrimitive.ScrollUpArrow> </SelectPrimitive.ScrollUpArrow>
) )
} }
@@ -181,8 +183,7 @@ function SelectScrollDownButton({
)} )}
{...props} {...props}
> >
<ChevronDownIcon <ChevronDownIcon />
/>
</SelectPrimitive.ScrollDownArrow> </SelectPrimitive.ScrollDownArrow>
) )
} }

View File

@@ -3,7 +3,13 @@ import { Loader2Icon } from "lucide-react"
function Spinner({ className, ...props }: React.ComponentProps<"svg">) { function Spinner({ className, ...props }: React.ComponentProps<"svg">) {
return ( return (
<Loader2Icon data-slot="spinner" role="status" aria-label="Loading" className={cn("size-4 animate-spin", className)} {...props} /> <Loader2Icon
data-slot="spinner"
role="status"
aria-label="Loading"
className={cn("size-4 animate-spin", className)}
{...props}
/>
) )
} }

View File

@@ -8,198 +8,198 @@
// You should NOT make any changes in this file as it will be overwritten. // You should NOT make any changes in this file as it will be overwritten.
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified. // Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
import { Route as rootRouteImport } from './routes/__root' import { Route as rootRouteImport } from "./routes/__root"
import { Route as AuthRouteImport } from './routes/_auth' import { Route as AuthRouteImport } from "./routes/_auth"
import { Route as LoginRouteImport } from './routes/login' import { Route as LoginRouteImport } from "./routes/login"
import { Route as RegisterRouteImport } from './routes/register' import { Route as RegisterRouteImport } from "./routes/register"
import { Route as AuthIndexRouteImport } from './routes/_auth/index' import { Route as AuthIndexRouteImport } from "./routes/_auth/index"
import { Route as AuthActivitiesRouteImport } from './routes/_auth/activities' import { Route as AuthActivitiesRouteImport } from "./routes/_auth/activities"
import { Route as AuthAddRouteImport } from './routes/_auth/add' import { Route as AuthAddRouteImport } from "./routes/_auth/add"
import { Route as AuthCalendarRouteImport } from './routes/_auth/calendar' import { Route as AuthCalendarRouteImport } from "./routes/_auth/calendar"
import { Route as AuthDiaryRouteImport } from './routes/_auth/diary' import { Route as AuthDiaryRouteImport } from "./routes/_auth/diary"
import { Route as AuthExportRouteImport } from './routes/_auth/export' import { Route as AuthExportRouteImport } from "./routes/_auth/export"
import { Route as AuthImportRouteImport } from './routes/_auth/import' import { Route as AuthImportRouteImport } from "./routes/_auth/import"
import { Route as AuthRemindersRouteImport } from './routes/_auth/reminders' import { Route as AuthRemindersRouteImport } from "./routes/_auth/reminders"
import { Route as AuthSettingsRouteImport } from './routes/_auth/settings' import { Route as AuthSettingsRouteImport } from "./routes/_auth/settings"
import { Route as AuthStatsRouteImport } from './routes/_auth/stats' import { Route as AuthStatsRouteImport } from "./routes/_auth/stats"
import { Route as AuthEditIdRouteImport } from './routes/_auth/edit.$id' import { Route as AuthEditIdRouteImport } from "./routes/_auth/edit.$id"
import { Route as AuthEntryIdRouteImport } from './routes/_auth/entry.$id' import { Route as AuthEntryIdRouteImport } from "./routes/_auth/entry.$id"
const AuthRoute = AuthRouteImport.update({ const AuthRoute = AuthRouteImport.update({
id: '/_auth', id: "/_auth",
getParentRoute: () => rootRouteImport, getParentRoute: () => rootRouteImport,
} as any) } as any)
const LoginRoute = LoginRouteImport.update({ const LoginRoute = LoginRouteImport.update({
id: '/login', id: "/login",
path: '/login', path: "/login",
getParentRoute: () => rootRouteImport, getParentRoute: () => rootRouteImport,
} as any) } as any)
const RegisterRoute = RegisterRouteImport.update({ const RegisterRoute = RegisterRouteImport.update({
id: '/register', id: "/register",
path: '/register', path: "/register",
getParentRoute: () => rootRouteImport, getParentRoute: () => rootRouteImport,
} as any) } as any)
const AuthIndexRoute = AuthIndexRouteImport.update({ const AuthIndexRoute = AuthIndexRouteImport.update({
id: '/', id: "/",
path: '/', path: "/",
getParentRoute: () => AuthRoute, getParentRoute: () => AuthRoute,
} as any) } as any)
const AuthActivitiesRoute = AuthActivitiesRouteImport.update({ const AuthActivitiesRoute = AuthActivitiesRouteImport.update({
id: '/activities', id: "/activities",
path: '/activities', path: "/activities",
getParentRoute: () => AuthRoute, getParentRoute: () => AuthRoute,
} as any) } as any)
const AuthAddRoute = AuthAddRouteImport.update({ const AuthAddRoute = AuthAddRouteImport.update({
id: '/add', id: "/add",
path: '/add', path: "/add",
getParentRoute: () => AuthRoute, getParentRoute: () => AuthRoute,
} as any) } as any)
const AuthCalendarRoute = AuthCalendarRouteImport.update({ const AuthCalendarRoute = AuthCalendarRouteImport.update({
id: '/calendar', id: "/calendar",
path: '/calendar', path: "/calendar",
getParentRoute: () => AuthRoute, getParentRoute: () => AuthRoute,
} as any) } as any)
const AuthDiaryRoute = AuthDiaryRouteImport.update({ const AuthDiaryRoute = AuthDiaryRouteImport.update({
id: '/diary', id: "/diary",
path: '/diary', path: "/diary",
getParentRoute: () => AuthRoute, getParentRoute: () => AuthRoute,
} as any) } as any)
const AuthExportRoute = AuthExportRouteImport.update({ const AuthExportRoute = AuthExportRouteImport.update({
id: '/export', id: "/export",
path: '/export', path: "/export",
getParentRoute: () => AuthRoute, getParentRoute: () => AuthRoute,
} as any) } as any)
const AuthImportRoute = AuthImportRouteImport.update({ const AuthImportRoute = AuthImportRouteImport.update({
id: '/import', id: "/import",
path: '/import', path: "/import",
getParentRoute: () => AuthRoute, getParentRoute: () => AuthRoute,
} as any) } as any)
const AuthRemindersRoute = AuthRemindersRouteImport.update({ const AuthRemindersRoute = AuthRemindersRouteImport.update({
id: '/reminders', id: "/reminders",
path: '/reminders', path: "/reminders",
getParentRoute: () => AuthRoute, getParentRoute: () => AuthRoute,
} as any) } as any)
const AuthSettingsRoute = AuthSettingsRouteImport.update({ const AuthSettingsRoute = AuthSettingsRouteImport.update({
id: '/settings', id: "/settings",
path: '/settings', path: "/settings",
getParentRoute: () => AuthRoute, getParentRoute: () => AuthRoute,
} as any) } as any)
const AuthStatsRoute = AuthStatsRouteImport.update({ const AuthStatsRoute = AuthStatsRouteImport.update({
id: '/stats', id: "/stats",
path: '/stats', path: "/stats",
getParentRoute: () => AuthRoute, getParentRoute: () => AuthRoute,
} as any).lazy(() => import('./routes/_auth/stats.lazy').then((d) => d.Route)) } as any).lazy(() => import("./routes/_auth/stats.lazy").then((d) => d.Route))
const AuthEditIdRoute = AuthEditIdRouteImport.update({ const AuthEditIdRoute = AuthEditIdRouteImport.update({
id: '/edit/$id', id: "/edit/$id",
path: '/edit/$id', path: "/edit/$id",
getParentRoute: () => AuthRoute, getParentRoute: () => AuthRoute,
} as any) } as any)
const AuthEntryIdRoute = AuthEntryIdRouteImport.update({ const AuthEntryIdRoute = AuthEntryIdRouteImport.update({
id: '/entry/$id', id: "/entry/$id",
path: '/entry/$id', path: "/entry/$id",
getParentRoute: () => AuthRoute, getParentRoute: () => AuthRoute,
} as any) } as any)
export interface FileRoutesByFullPath { export interface FileRoutesByFullPath {
'/': typeof AuthIndexRoute "/": typeof AuthIndexRoute
'/login': typeof LoginRoute "/login": typeof LoginRoute
'/register': typeof RegisterRoute "/register": typeof RegisterRoute
'/activities': typeof AuthActivitiesRoute "/activities": typeof AuthActivitiesRoute
'/add': typeof AuthAddRoute "/add": typeof AuthAddRoute
'/calendar': typeof AuthCalendarRoute "/calendar": typeof AuthCalendarRoute
'/diary': typeof AuthDiaryRoute "/diary": typeof AuthDiaryRoute
'/export': typeof AuthExportRoute "/export": typeof AuthExportRoute
'/import': typeof AuthImportRoute "/import": typeof AuthImportRoute
'/reminders': typeof AuthRemindersRoute "/reminders": typeof AuthRemindersRoute
'/settings': typeof AuthSettingsRoute "/settings": typeof AuthSettingsRoute
'/stats': typeof AuthStatsRoute "/stats": typeof AuthStatsRoute
'/edit/$id': typeof AuthEditIdRoute "/edit/$id": typeof AuthEditIdRoute
'/entry/$id': typeof AuthEntryIdRoute "/entry/$id": typeof AuthEntryIdRoute
} }
export interface FileRoutesByTo { export interface FileRoutesByTo {
'/login': typeof LoginRoute "/login": typeof LoginRoute
'/register': typeof RegisterRoute "/register": typeof RegisterRoute
'/activities': typeof AuthActivitiesRoute "/activities": typeof AuthActivitiesRoute
'/add': typeof AuthAddRoute "/add": typeof AuthAddRoute
'/calendar': typeof AuthCalendarRoute "/calendar": typeof AuthCalendarRoute
'/diary': typeof AuthDiaryRoute "/diary": typeof AuthDiaryRoute
'/export': typeof AuthExportRoute "/export": typeof AuthExportRoute
'/import': typeof AuthImportRoute "/import": typeof AuthImportRoute
'/reminders': typeof AuthRemindersRoute "/reminders": typeof AuthRemindersRoute
'/settings': typeof AuthSettingsRoute "/settings": typeof AuthSettingsRoute
'/stats': typeof AuthStatsRoute "/stats": typeof AuthStatsRoute
'/': typeof AuthIndexRoute "/": typeof AuthIndexRoute
'/edit/$id': typeof AuthEditIdRoute "/edit/$id": typeof AuthEditIdRoute
'/entry/$id': typeof AuthEntryIdRoute "/entry/$id": typeof AuthEntryIdRoute
} }
export interface FileRoutesById { export interface FileRoutesById {
__root__: typeof rootRouteImport __root__: typeof rootRouteImport
'/_auth': typeof AuthRouteWithChildren "/_auth": typeof AuthRouteWithChildren
'/login': typeof LoginRoute "/login": typeof LoginRoute
'/register': typeof RegisterRoute "/register": typeof RegisterRoute
'/_auth/activities': typeof AuthActivitiesRoute "/_auth/activities": typeof AuthActivitiesRoute
'/_auth/add': typeof AuthAddRoute "/_auth/add": typeof AuthAddRoute
'/_auth/calendar': typeof AuthCalendarRoute "/_auth/calendar": typeof AuthCalendarRoute
'/_auth/diary': typeof AuthDiaryRoute "/_auth/diary": typeof AuthDiaryRoute
'/_auth/export': typeof AuthExportRoute "/_auth/export": typeof AuthExportRoute
'/_auth/import': typeof AuthImportRoute "/_auth/import": typeof AuthImportRoute
'/_auth/reminders': typeof AuthRemindersRoute "/_auth/reminders": typeof AuthRemindersRoute
'/_auth/settings': typeof AuthSettingsRoute "/_auth/settings": typeof AuthSettingsRoute
'/_auth/stats': typeof AuthStatsRoute "/_auth/stats": typeof AuthStatsRoute
'/_auth/': typeof AuthIndexRoute "/_auth/": typeof AuthIndexRoute
'/_auth/edit/$id': typeof AuthEditIdRoute "/_auth/edit/$id": typeof AuthEditIdRoute
'/_auth/entry/$id': typeof AuthEntryIdRoute "/_auth/entry/$id": typeof AuthEntryIdRoute
} }
export interface FileRouteTypes { export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath fileRoutesByFullPath: FileRoutesByFullPath
fullPaths: fullPaths:
| '/' | "/"
| '/login' | "/login"
| '/register' | "/register"
| '/activities' | "/activities"
| '/add' | "/add"
| '/calendar' | "/calendar"
| '/diary' | "/diary"
| '/export' | "/export"
| '/import' | "/import"
| '/reminders' | "/reminders"
| '/settings' | "/settings"
| '/stats' | "/stats"
| '/edit/$id' | "/edit/$id"
| '/entry/$id' | "/entry/$id"
fileRoutesByTo: FileRoutesByTo fileRoutesByTo: FileRoutesByTo
to: to:
| '/login' | "/login"
| '/register' | "/register"
| '/activities' | "/activities"
| '/add' | "/add"
| '/calendar' | "/calendar"
| '/diary' | "/diary"
| '/export' | "/export"
| '/import' | "/import"
| '/reminders' | "/reminders"
| '/settings' | "/settings"
| '/stats' | "/stats"
| '/' | "/"
| '/edit/$id' | "/edit/$id"
| '/entry/$id' | "/entry/$id"
id: id:
| '__root__' | "__root__"
| '/_auth' | "/_auth"
| '/login' | "/login"
| '/register' | "/register"
| '/_auth/activities' | "/_auth/activities"
| '/_auth/add' | "/_auth/add"
| '/_auth/calendar' | "/_auth/calendar"
| '/_auth/diary' | "/_auth/diary"
| '/_auth/export' | "/_auth/export"
| '/_auth/import' | "/_auth/import"
| '/_auth/reminders' | "/_auth/reminders"
| '/_auth/settings' | "/_auth/settings"
| '/_auth/stats' | "/_auth/stats"
| '/_auth/' | "/_auth/"
| '/_auth/edit/$id' | "/_auth/edit/$id"
| '/_auth/entry/$id' | "/_auth/entry/$id"
fileRoutesById: FileRoutesById fileRoutesById: FileRoutesById
} }
export interface RootRouteChildren { export interface RootRouteChildren {
@@ -208,110 +208,110 @@ export interface RootRouteChildren {
RegisterRoute: typeof RegisterRoute RegisterRoute: typeof RegisterRoute
} }
declare module '@tanstack/react-router' { declare module "@tanstack/react-router" {
interface FileRoutesByPath { interface FileRoutesByPath {
'/_auth': { "/_auth": {
id: '/_auth' id: "/_auth"
path: '' path: ""
fullPath: '/' fullPath: "/"
preLoaderRoute: typeof AuthRouteImport preLoaderRoute: typeof AuthRouteImport
parentRoute: typeof rootRouteImport parentRoute: typeof rootRouteImport
} }
'/login': { "/login": {
id: '/login' id: "/login"
path: '/login' path: "/login"
fullPath: '/login' fullPath: "/login"
preLoaderRoute: typeof LoginRouteImport preLoaderRoute: typeof LoginRouteImport
parentRoute: typeof rootRouteImport parentRoute: typeof rootRouteImport
} }
'/register': { "/register": {
id: '/register' id: "/register"
path: '/register' path: "/register"
fullPath: '/register' fullPath: "/register"
preLoaderRoute: typeof RegisterRouteImport preLoaderRoute: typeof RegisterRouteImport
parentRoute: typeof rootRouteImport parentRoute: typeof rootRouteImport
} }
'/_auth/': { "/_auth/": {
id: '/_auth/' id: "/_auth/"
path: '/' path: "/"
fullPath: '/' fullPath: "/"
preLoaderRoute: typeof AuthIndexRouteImport preLoaderRoute: typeof AuthIndexRouteImport
parentRoute: typeof AuthRoute parentRoute: typeof AuthRoute
} }
'/_auth/activities': { "/_auth/activities": {
id: '/_auth/activities' id: "/_auth/activities"
path: '/activities' path: "/activities"
fullPath: '/activities' fullPath: "/activities"
preLoaderRoute: typeof AuthActivitiesRouteImport preLoaderRoute: typeof AuthActivitiesRouteImport
parentRoute: typeof AuthRoute parentRoute: typeof AuthRoute
} }
'/_auth/add': { "/_auth/add": {
id: '/_auth/add' id: "/_auth/add"
path: '/add' path: "/add"
fullPath: '/add' fullPath: "/add"
preLoaderRoute: typeof AuthAddRouteImport preLoaderRoute: typeof AuthAddRouteImport
parentRoute: typeof AuthRoute parentRoute: typeof AuthRoute
} }
'/_auth/calendar': { "/_auth/calendar": {
id: '/_auth/calendar' id: "/_auth/calendar"
path: '/calendar' path: "/calendar"
fullPath: '/calendar' fullPath: "/calendar"
preLoaderRoute: typeof AuthCalendarRouteImport preLoaderRoute: typeof AuthCalendarRouteImport
parentRoute: typeof AuthRoute parentRoute: typeof AuthRoute
} }
'/_auth/diary': { "/_auth/diary": {
id: '/_auth/diary' id: "/_auth/diary"
path: '/diary' path: "/diary"
fullPath: '/diary' fullPath: "/diary"
preLoaderRoute: typeof AuthDiaryRouteImport preLoaderRoute: typeof AuthDiaryRouteImport
parentRoute: typeof AuthRoute parentRoute: typeof AuthRoute
} }
'/_auth/export': { "/_auth/export": {
id: '/_auth/export' id: "/_auth/export"
path: '/export' path: "/export"
fullPath: '/export' fullPath: "/export"
preLoaderRoute: typeof AuthExportRouteImport preLoaderRoute: typeof AuthExportRouteImport
parentRoute: typeof AuthRoute parentRoute: typeof AuthRoute
} }
'/_auth/import': { "/_auth/import": {
id: '/_auth/import' id: "/_auth/import"
path: '/import' path: "/import"
fullPath: '/import' fullPath: "/import"
preLoaderRoute: typeof AuthImportRouteImport preLoaderRoute: typeof AuthImportRouteImport
parentRoute: typeof AuthRoute parentRoute: typeof AuthRoute
} }
'/_auth/reminders': { "/_auth/reminders": {
id: '/_auth/reminders' id: "/_auth/reminders"
path: '/reminders' path: "/reminders"
fullPath: '/reminders' fullPath: "/reminders"
preLoaderRoute: typeof AuthRemindersRouteImport preLoaderRoute: typeof AuthRemindersRouteImport
parentRoute: typeof AuthRoute parentRoute: typeof AuthRoute
} }
'/_auth/settings': { "/_auth/settings": {
id: '/_auth/settings' id: "/_auth/settings"
path: '/settings' path: "/settings"
fullPath: '/settings' fullPath: "/settings"
preLoaderRoute: typeof AuthSettingsRouteImport preLoaderRoute: typeof AuthSettingsRouteImport
parentRoute: typeof AuthRoute parentRoute: typeof AuthRoute
} }
'/_auth/stats': { "/_auth/stats": {
id: '/_auth/stats' id: "/_auth/stats"
path: '/stats' path: "/stats"
fullPath: '/stats' fullPath: "/stats"
preLoaderRoute: typeof AuthStatsRouteImport preLoaderRoute: typeof AuthStatsRouteImport
parentRoute: typeof AuthRoute parentRoute: typeof AuthRoute
} }
'/_auth/edit/$id': { "/_auth/edit/$id": {
id: '/_auth/edit/$id' id: "/_auth/edit/$id"
path: '/edit/$id' path: "/edit/$id"
fullPath: '/edit/$id' fullPath: "/edit/$id"
preLoaderRoute: typeof AuthEditIdRouteImport preLoaderRoute: typeof AuthEditIdRouteImport
parentRoute: typeof AuthRoute parentRoute: typeof AuthRoute
} }
'/_auth/entry/$id': { "/_auth/entry/$id": {
id: '/_auth/entry/$id' id: "/_auth/entry/$id"
path: '/entry/$id' path: "/entry/$id"
fullPath: '/entry/$id' fullPath: "/entry/$id"
preLoaderRoute: typeof AuthEntryIdRouteImport preLoaderRoute: typeof AuthEntryIdRouteImport
parentRoute: typeof AuthRoute parentRoute: typeof AuthRoute
} }

View File

@@ -102,7 +102,7 @@ function ReminderCard({ reminder }: { reminder: ReminderResponse }) {
const handleUpdate = (schedule: CreateReminderRequest) => { const handleUpdate = (schedule: CreateReminderRequest) => {
updateReminder.mutate( updateReminder.mutate(
{ id: reminder.id, body: { schedule } }, { id: reminder.id, body: { schedule } },
{ onSuccess: () => setEditing(false) }, { onSuccess: () => setEditing(false) }
) )
} }
@@ -133,9 +133,7 @@ function ReminderCard({ reminder }: { reminder: ReminderResponse }) {
<div className="flex flex-wrap gap-2"> <div className="flex flex-wrap gap-2">
{DAYS.map(({ key, label }) => { {DAYS.map(({ key, label }) => {
const time = reminder.schedule[key] const time = reminder.schedule[key]
return ( return <DayPill key={key} label={label} time={time} />
<DayPill key={key} label={label} time={time} />
)
})} })}
</div> </div>
@@ -151,7 +149,11 @@ function ReminderCard({ reminder }: { reminder: ReminderResponse }) {
<AlertDialog> <AlertDialog>
<AlertDialogTrigger <AlertDialogTrigger
render={ render={
<Button variant="outline" size="sm" className="text-destructive" /> <Button
variant="outline"
size="sm"
className="text-destructive"
/>
} }
> >
<Trash2 className="h-4 w-4" /> <Trash2 className="h-4 w-4" />
@@ -217,18 +219,20 @@ function ReminderForm({
isPending: boolean isPending: boolean
}) { }) {
const defaultTime = "20:00" const defaultTime = "20:00"
const [schedule, setSchedule] = useState<Record<DayKey, string | null>>(() => { const [schedule, setSchedule] = useState<Record<DayKey, string | null>>(
if (initial) return { ...initial } () => {
return { if (initial) return { ...initial }
monday: null, return {
tuesday: null, monday: null,
wednesday: null, tuesday: null,
thursday: null, wednesday: null,
friday: null, thursday: null,
saturday: null, friday: null,
sunday: null, saturday: null,
sunday: null,
}
} }
}) )
const toggleDay = (day: DayKey) => { const toggleDay = (day: DayKey) => {
setSchedule((prev) => ({ setSchedule((prev) => ({
@@ -262,7 +266,12 @@ function ReminderForm({
<CardContent className="flex flex-col gap-4"> <CardContent className="flex flex-col gap-4">
<div className="flex items-center justify-between"> <div className="flex items-center justify-between">
<span className="text-xs text-muted-foreground">Select days</span> <span className="text-xs text-muted-foreground">Select days</span>
<Button variant="ghost" size="sm" onClick={selectAll} className="text-xs"> <Button
variant="ghost"
size="sm"
onClick={selectAll}
className="text-xs"
>
{DAYS.every(({ key }) => schedule[key]) ? "Clear all" : "Every day"} {DAYS.every(({ key }) => schedule[key]) ? "Clear all" : "Every day"}
</Button> </Button>
</div> </div>