One Calendar is a privacy-first calendar web app built with Next.js. It has modern security features, including e2ee, password-protected sharing, and self-destructing share links ๐Ÿ“… calendar.xyehr.cn
5
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request #235 from EvanTechDev/codex/remove-unused-components-from-ui

chore: remove unused ui components and fix settings switch display

authored by

Evan Huang and committed by
GitHub
443e7b8f ecb1ca9e

+9 -364
-87
components/ui/accordion.tsx
··· 1 - "use client" 2 - 3 - import * as React from "react" 4 - import { ChevronDownIcon, ChevronUpIcon } from "lucide-react" 5 - import { Accordion as AccordionPrimitive } from "radix-ui" 6 - 7 - import { cn } from "@/lib/utils" 8 - 9 - function Accordion({ 10 - className, 11 - ...props 12 - }: React.ComponentProps<typeof AccordionPrimitive.Root>) { 13 - return ( 14 - <AccordionPrimitive.Root 15 - data-slot="accordion" 16 - className={cn("flex w-full flex-col", className)} 17 - {...props} 18 - /> 19 - ) 20 - } 21 - 22 - function AccordionItem({ 23 - className, 24 - ...props 25 - }: React.ComponentProps<typeof AccordionPrimitive.Item>) { 26 - return ( 27 - <AccordionPrimitive.Item 28 - data-slot="accordion-item" 29 - className={cn("not-last:border-b", className)} 30 - {...props} 31 - /> 32 - ) 33 - } 34 - 35 - function AccordionTrigger({ 36 - className, 37 - children, 38 - ...props 39 - }: React.ComponentProps<typeof AccordionPrimitive.Trigger>) { 40 - return ( 41 - <AccordionPrimitive.Header className="flex"> 42 - <AccordionPrimitive.Trigger 43 - data-slot="accordion-trigger" 44 - className={cn( 45 - "group/accordion-trigger relative flex flex-1 items-start justify-between rounded-lg border border-transparent py-2.5 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:after:border-ring disabled:pointer-events-none disabled:opacity-50 **:data-[slot=accordion-trigger-icon]:ml-auto **:data-[slot=accordion-trigger-icon]:size-4 **:data-[slot=accordion-trigger-icon]:text-muted-foreground", 46 - className 47 - )} 48 - {...props} 49 - > 50 - {children} 51 - <ChevronDownIcon 52 - data-slot="accordion-trigger-icon" 53 - className="pointer-events-none shrink-0 group-aria-expanded/accordion-trigger:hidden" 54 - /> 55 - <ChevronUpIcon 56 - data-slot="accordion-trigger-icon" 57 - className="pointer-events-none hidden shrink-0 group-aria-expanded/accordion-trigger:inline" 58 - /> 59 - </AccordionPrimitive.Trigger> 60 - </AccordionPrimitive.Header> 61 - ) 62 - } 63 - 64 - function AccordionContent({ 65 - className, 66 - children, 67 - ...props 68 - }: React.ComponentProps<typeof AccordionPrimitive.Content>) { 69 - return ( 70 - <AccordionPrimitive.Content 71 - data-slot="accordion-content" 72 - className="overflow-hidden text-sm data-open:animate-accordion-down data-closed:animate-accordion-up" 73 - {...props} 74 - > 75 - <div 76 - className={cn( 77 - "h-(--radix-accordion-content-height) pt-0 pb-2.5 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4", 78 - className 79 - )} 80 - > 81 - {children} 82 - </div> 83 - </AccordionPrimitive.Content> 84 - ) 85 - } 86 - 87 - export { Accordion, AccordionItem, AccordionTrigger, AccordionContent }
-10
components/ui/collapsible.tsx
··· 1 - "use client"; 2 - import * as CollapsiblePrimitive from "@radix-ui/react-collapsible"; 3 - 4 - const Collapsible = CollapsiblePrimitive.Root; 5 - 6 - const CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger; 7 - 8 - const CollapsibleContent = CollapsiblePrimitive.CollapsibleContent; 9 - 10 - export { Collapsible, CollapsibleTrigger, CollapsibleContent };
-200
components/ui/context-menu.tsx
··· 1 - "use client"; 2 - 3 - import * as ContextMenuPrimitive from "@radix-ui/react-context-menu"; 4 - import { Check, ChevronRight, Circle } from "lucide-react"; 5 - import * as React from "react"; 6 - 7 - import { cn } from "@/lib/utils"; 8 - 9 - const ContextMenu = ContextMenuPrimitive.Root; 10 - 11 - const ContextMenuTrigger = ContextMenuPrimitive.Trigger; 12 - 13 - const ContextMenuGroup = ContextMenuPrimitive.Group; 14 - 15 - const ContextMenuPortal = ContextMenuPrimitive.Portal; 16 - 17 - const ContextMenuSub = ContextMenuPrimitive.Sub; 18 - 19 - const ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup; 20 - 21 - const ContextMenuSubTrigger = React.forwardRef< 22 - React.ElementRef<typeof ContextMenuPrimitive.SubTrigger>, 23 - React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubTrigger> & { 24 - inset?: boolean; 25 - } 26 - >(({ className, inset, children, ...props }, ref) => ( 27 - <ContextMenuPrimitive.SubTrigger 28 - ref={ref} 29 - className={cn( 30 - "flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground", 31 - inset && "pl-8", 32 - className, 33 - )} 34 - {...props} 35 - > 36 - {children} 37 - <ChevronRight className="ml-auto h-4 w-4" /> 38 - </ContextMenuPrimitive.SubTrigger> 39 - )); 40 - ContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName; 41 - 42 - const ContextMenuSubContent = React.forwardRef< 43 - React.ElementRef<typeof ContextMenuPrimitive.SubContent>, 44 - React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubContent> 45 - >(({ className, ...props }, ref) => ( 46 - <ContextMenuPrimitive.SubContent 47 - ref={ref} 48 - className={cn( 49 - "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 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 origin-[--radix-context-menu-content-transform-origin]", 50 - className, 51 - )} 52 - {...props} 53 - /> 54 - )); 55 - ContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName; 56 - 57 - const ContextMenuContent = React.forwardRef< 58 - React.ElementRef<typeof ContextMenuPrimitive.Content>, 59 - React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Content> 60 - >(({ className, ...props }, ref) => ( 61 - <ContextMenuPrimitive.Portal> 62 - <ContextMenuPrimitive.Content 63 - ref={ref} 64 - className={cn( 65 - "z-50 max-h-[--radix-context-menu-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md animate-in fade-in-80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 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 origin-[--radix-context-menu-content-transform-origin]", 66 - className, 67 - )} 68 - {...props} 69 - /> 70 - </ContextMenuPrimitive.Portal> 71 - )); 72 - ContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName; 73 - 74 - const ContextMenuItem = React.forwardRef< 75 - React.ElementRef<typeof ContextMenuPrimitive.Item>, 76 - React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Item> & { 77 - inset?: boolean; 78 - } 79 - >(({ className, inset, ...props }, ref) => ( 80 - <ContextMenuPrimitive.Item 81 - ref={ref} 82 - className={cn( 83 - "relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50", 84 - inset && "pl-8", 85 - className, 86 - )} 87 - {...props} 88 - /> 89 - )); 90 - ContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName; 91 - 92 - const ContextMenuCheckboxItem = React.forwardRef< 93 - React.ElementRef<typeof ContextMenuPrimitive.CheckboxItem>, 94 - React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.CheckboxItem> 95 - >(({ className, children, checked, ...props }, ref) => ( 96 - <ContextMenuPrimitive.CheckboxItem 97 - ref={ref} 98 - className={cn( 99 - "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50", 100 - className, 101 - )} 102 - checked={checked} 103 - {...props} 104 - > 105 - <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center"> 106 - <ContextMenuPrimitive.ItemIndicator> 107 - <Check className="h-4 w-4" /> 108 - </ContextMenuPrimitive.ItemIndicator> 109 - </span> 110 - {children} 111 - </ContextMenuPrimitive.CheckboxItem> 112 - )); 113 - ContextMenuCheckboxItem.displayName = 114 - ContextMenuPrimitive.CheckboxItem.displayName; 115 - 116 - const ContextMenuRadioItem = React.forwardRef< 117 - React.ElementRef<typeof ContextMenuPrimitive.RadioItem>, 118 - React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.RadioItem> 119 - >(({ className, children, ...props }, ref) => ( 120 - <ContextMenuPrimitive.RadioItem 121 - ref={ref} 122 - className={cn( 123 - "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50", 124 - className, 125 - )} 126 - {...props} 127 - > 128 - <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center"> 129 - <ContextMenuPrimitive.ItemIndicator> 130 - <Circle className="h-2 w-2 fill-current" /> 131 - </ContextMenuPrimitive.ItemIndicator> 132 - </span> 133 - {children} 134 - </ContextMenuPrimitive.RadioItem> 135 - )); 136 - ContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName; 137 - 138 - const ContextMenuLabel = React.forwardRef< 139 - React.ElementRef<typeof ContextMenuPrimitive.Label>, 140 - React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Label> & { 141 - inset?: boolean; 142 - } 143 - >(({ className, inset, ...props }, ref) => ( 144 - <ContextMenuPrimitive.Label 145 - ref={ref} 146 - className={cn( 147 - "px-2 py-1.5 text-sm font-semibold text-foreground", 148 - inset && "pl-8", 149 - className, 150 - )} 151 - {...props} 152 - /> 153 - )); 154 - ContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName; 155 - 156 - const ContextMenuSeparator = React.forwardRef< 157 - React.ElementRef<typeof ContextMenuPrimitive.Separator>, 158 - React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Separator> 159 - >(({ className, ...props }, ref) => ( 160 - <ContextMenuPrimitive.Separator 161 - ref={ref} 162 - className={cn("-mx-1 my-1 h-px bg-border", className)} 163 - {...props} 164 - /> 165 - )); 166 - ContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName; 167 - 168 - const ContextMenuShortcut = ({ 169 - className, 170 - ...props 171 - }: React.HTMLAttributes<HTMLSpanElement>) => { 172 - return ( 173 - <span 174 - className={cn( 175 - "ml-auto text-xs tracking-widest text-muted-foreground", 176 - className, 177 - )} 178 - {...props} 179 - /> 180 - ); 181 - }; 182 - ContextMenuShortcut.displayName = "ContextMenuShortcut"; 183 - 184 - export { 185 - ContextMenu, 186 - ContextMenuTrigger, 187 - ContextMenuContent, 188 - ContextMenuItem, 189 - ContextMenuCheckboxItem, 190 - ContextMenuRadioItem, 191 - ContextMenuLabel, 192 - ContextMenuSeparator, 193 - ContextMenuShortcut, 194 - ContextMenuGroup, 195 - ContextMenuPortal, 196 - ContextMenuSub, 197 - ContextMenuSubContent, 198 - ContextMenuSubTrigger, 199 - ContextMenuRadioGroup, 200 - };
-28
components/ui/separator.tsx
··· 1 - "use client"; 2 - 3 - import * as SeparatorPrimitive from "@radix-ui/react-separator"; 4 - import * as React from "react"; 5 - 6 - import { cn } from "@/lib/utils"; 7 - 8 - function Separator({ 9 - className, 10 - orientation = "horizontal", 11 - decorative = true, 12 - ...props 13 - }: React.ComponentProps<typeof SeparatorPrimitive.Root>) { 14 - return ( 15 - <SeparatorPrimitive.Root 16 - data-slot="separator" 17 - decorative={decorative} 18 - orientation={orientation} 19 - className={cn( 20 - "bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px", 21 - className, 22 - )} 23 - {...props} 24 - /> 25 - ); 26 - } 27 - 28 - export { Separator };
+9 -4
components/ui/switch.tsx
··· 1 1 "use client" 2 2 3 3 import * as React from "react" 4 - import { Switch as SwitchPrimitive } from "radix-ui" 4 + import * as SwitchPrimitive from "@radix-ui/react-switch" 5 5 6 6 import { cn } from "@/lib/utils" 7 7 ··· 15 15 return ( 16 16 <SwitchPrimitive.Root 17 17 data-slot="switch" 18 - data-size={size} 19 18 className={cn( 20 - "peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50", 19 + "peer inline-flex shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input", 20 + size === "default" ? "h-5 w-9" : "h-4 w-7", 21 21 className 22 22 )} 23 23 {...props} 24 24 > 25 25 <SwitchPrimitive.Thumb 26 26 data-slot="switch-thumb" 27 - className="pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground" 27 + className={cn( 28 + "pointer-events-none block rounded-full bg-background shadow-sm ring-0 transition-transform data-[state=checked]:bg-primary-foreground", 29 + size === "default" 30 + ? "size-4 data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0" 31 + : "size-3 data-[state=checked]:translate-x-3 data-[state=unchecked]:translate-x-0" 32 + )} 28 33 /> 29 34 </SwitchPrimitive.Root> 30 35 )
-35
components/ui/toaster.tsx
··· 1 - "use client"; 2 - 3 - import { 4 - Toast, 5 - ToastClose, 6 - ToastDescription, 7 - ToastProvider, 8 - ToastTitle, 9 - ToastViewport, 10 - } from "@/components/ui/toast"; 11 - import { useToast } from "@/components/ui/use-toast"; 12 - 13 - export function Toaster() { 14 - const { toasts } = useToast(); 15 - 16 - return ( 17 - <ToastProvider> 18 - {toasts.map(function ({ id, title, description, action, ...props }) { 19 - return ( 20 - <Toast key={id} {...props}> 21 - <div className="grid gap-1"> 22 - {title && <ToastTitle>{title}</ToastTitle>} 23 - {description && ( 24 - <ToastDescription>{description}</ToastDescription> 25 - )} 26 - </div> 27 - {action} 28 - <ToastClose /> 29 - </Toast> 30 - ); 31 - })} 32 - <ToastViewport /> 33 - </ToastProvider> 34 - ); 35 - }