Switch to vercel's biome setup (#543)

This commit is contained in:
Jared Palmer 2024-11-15 13:00:15 -05:00 committed by GitHub
parent b8643353c0
commit 43aa1c6e58
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
52 changed files with 414 additions and 201 deletions

View file

@ -18,6 +18,7 @@ import {
useSidebar,
} from '@/components/ui/sidebar';
import { BetterTooltip } from '@/components/ui/tooltip';
import Link from 'next/link';
export function AppSidebar({ user }: { user: User | undefined }) {
const router = useRouter();
@ -28,21 +29,21 @@ export function AppSidebar({ user }: { user: User | undefined }) {
<SidebarHeader>
<SidebarMenu>
<div className="flex flex-row justify-between items-center">
<div
<Link
href="/"
onClick={() => {
setOpenMobile(false);
router.push('/');
router.refresh();
}}
className="flex flex-row gap-3 items-center"
>
<span className="text-lg font-semibold px-2 hover:bg-muted rounded-md cursor-pointer">
Chatbot
</span>
</div>
</Link>
<BetterTooltip content="New Chat" align="start">
<Button
variant="ghost"
type="button"
className="p-2 h-fit"
onClick={() => {
setOpenMobile(false);

View file

@ -23,7 +23,7 @@ export function PureBlockStreamHandler({
function areEqual(
prevProps: BlockStreamHandlerProps,
nextProps: BlockStreamHandlerProps
nextProps: BlockStreamHandlerProps,
) {
if (!prevProps.streamingData && !nextProps.streamingData) {
return true;

View file

@ -80,13 +80,13 @@ export function Block({
votes: Array<Vote> | undefined;
append: (
message: Message | CreateMessage,
chatRequestOptions?: ChatRequestOptions
chatRequestOptions?: ChatRequestOptions,
) => Promise<string | null | undefined>;
handleSubmit: (
event?: {
preventDefault?: () => void;
},
chatRequestOptions?: ChatRequestOptions
chatRequestOptions?: ChatRequestOptions,
) => void;
}) {
const [messagesContainerRef, messagesEndRef] =
@ -100,7 +100,7 @@ export function Block({
block && block.status !== 'streaming'
? `/api/document?id=${block.documentId}`
: null,
fetcher
fetcher,
);
const { data: suggestions } = useSWR<Array<Suggestion>>(
@ -110,7 +110,7 @@ export function Block({
fetcher,
{
dedupingInterval: 5000,
}
},
);
const [mode, setMode] = useState<'edit' | 'diff'>('edit');
@ -176,15 +176,15 @@ export function Block({
}
return currentDocuments;
},
{ revalidate: false }
{ revalidate: false },
);
},
[block, mutate]
[block, mutate],
);
const debouncedHandleContentChange = useDebounceCallback(
handleContentChange,
2000
2000,
);
const saveContent = useCallback(
@ -199,7 +199,7 @@ export function Block({
}
}
},
[document, debouncedHandleContentChange, handleContentChange]
[document, debouncedHandleContentChange, handleContentChange],
);
function getDocumentContentById(index: number) {
@ -430,7 +430,7 @@ export function Block({
new Date(),
{
addSuffix: true,
}
},
)}`}
</div>
) : (
@ -496,7 +496,7 @@ export function Block({
'p-2 h-fit !pointer-events-auto dark:hover:bg-zinc-700',
{
'bg-muted': mode === 'diff',
}
},
)}
onClick={() => {
handleVersionChange('toggle');

View file

@ -66,7 +66,7 @@ export function Chat({
const { data: votes } = useSWR<Array<Vote>>(
`/api/vote?chatId=${id}`,
fetcher
fetcher,
);
const [messagesContainerRef, messagesEndRef] =

View file

@ -60,10 +60,10 @@ export const DiffView = ({ oldContent, newContent }: DiffEditorProps) => {
const parser = DOMParser.fromSchema(diffSchema);
const oldHtmlContent = renderToString(
<ReactMarkdown>{oldContent}</ReactMarkdown>
<ReactMarkdown>{oldContent}</ReactMarkdown>,
);
const newHtmlContent = renderToString(
<ReactMarkdown>{newContent}</ReactMarkdown>
<ReactMarkdown>{newContent}</ReactMarkdown>,
);
const oldContainer = document.createElement('div');

View file

@ -30,7 +30,8 @@ export function DocumentToolResult({
setBlock,
}: DocumentToolResultProps) {
return (
<div
<button
type="button"
className="bg-background cursor-pointer border py-2 px-3 rounded-xl w-fit flex flex-row gap-3 items-start"
onClick={(event) => {
const rect = event.currentTarget.getBoundingClientRect();
@ -64,7 +65,7 @@ export function DocumentToolResult({
<div className="">
{getActionText(type)} {result.title}
</div>
</div>
</button>
);
}

View file

@ -89,7 +89,7 @@ function PureEditor({
useEffect(() => {
if (editorRef.current && content) {
const currentContent = buildContentFromDocument(
editorRef.current.state.doc
editorRef.current.state.doc,
);
if (status === 'streaming') {
@ -98,7 +98,7 @@ function PureEditor({
const transaction = editorRef.current.state.tr.replaceWith(
0,
editorRef.current.state.doc.content.size,
newDocument.content
newDocument.content,
);
transaction.setMeta('no-save', true);
@ -112,7 +112,7 @@ function PureEditor({
const transaction = editorRef.current.state.tr.replaceWith(
0,
editorRef.current.state.doc.content.size,
newDocument.content
newDocument.content,
);
transaction.setMeta('no-save', true);
@ -125,14 +125,14 @@ function PureEditor({
if (editorRef.current?.state.doc && content) {
const projectedSuggestions = projectWithPositions(
editorRef.current.state.doc,
suggestions
suggestions,
).filter(
(suggestion) => suggestion.selectionStart && suggestion.selectionEnd
(suggestion) => suggestion.selectionStart && suggestion.selectionEnd,
);
const decorations = createDecorations(
projectedSuggestions,
editorRef.current
editorRef.current,
);
const transaction = editorRef.current.state.tr;

View file

@ -119,5 +119,5 @@ const NonMemoizedMarkdown = ({ children }: { children: string }) => {
export const Markdown = memo(
NonMemoizedMarkdown,
(prevProps, nextProps) => prevProps.children === nextProps.children
(prevProps, nextProps) => prevProps.children === nextProps.children,
);

View file

@ -80,7 +80,7 @@ export function MessageActions({
if (!currentVotes) return [];
const votesWithoutCurrent = currentVotes.filter(
(vote) => vote.messageId !== message.id
(vote) => vote.messageId !== message.id,
);
return [
@ -92,7 +92,7 @@ export function MessageActions({
},
];
},
{ revalidate: false }
{ revalidate: false },
);
return 'Upvoted Response!';
@ -134,7 +134,7 @@ export function MessageActions({
if (!currentVotes) return [];
const votesWithoutCurrent = currentVotes.filter(
(vote) => vote.messageId !== message.id
(vote) => vote.messageId !== message.id,
);
return [
@ -146,7 +146,7 @@ export function MessageActions({
},
];
},
{ revalidate: false }
{ revalidate: false },
);
return 'Downvoted Response!';

View file

@ -39,7 +39,7 @@ export const PreviewMessage = ({
>
<div
className={cx(
'group-data-[role=user]/message:bg-primary group-data-[role=user]/message:text-primary-foreground flex gap-4 group-data-[role=user]/message:px-3 w-full group-data-[role=user]/message:w-fit group-data-[role=user]/message:ml-auto group-data-[role=user]/message:max-w-2xl group-data-[role=user]/message:py-2 rounded-xl'
'group-data-[role=user]/message:bg-primary group-data-[role=user]/message:text-primary-foreground flex gap-4 group-data-[role=user]/message:px-3 w-full group-data-[role=user]/message:w-fit group-data-[role=user]/message:ml-auto group-data-[role=user]/message:max-w-2xl group-data-[role=user]/message:py-2 rounded-xl',
)}
>
{message.role === 'assistant' && (
@ -158,7 +158,7 @@ export const ThinkingMessage = () => {
'flex gap-4 group-data-[role=user]/message:px-3 w-full group-data-[role=user]/message:w-fit group-data-[role=user]/message:ml-auto group-data-[role=user]/message:max-w-2xl group-data-[role=user]/message:py-2 rounded-xl',
{
'group-data-[role=user]/message:bg-muted': true,
}
},
)}
>
<div className="size-8 flex items-center rounded-full justify-center ring-1 shrink-0 ring-border">

View file

@ -27,7 +27,7 @@ export function ModelSelector({
const selectModel = useMemo(
() => models.find((model) => model.id === optimisticModelId),
[optimisticModelId]
[optimisticModelId],
);
return (
@ -36,7 +36,7 @@ export function ModelSelector({
asChild
className={cn(
'w-fit data-[state=open]:bg-accent data-[state=open]:text-accent-foreground',
className
className,
)}
>
<Button variant="outline" className="md:px-2 md:h-[34px]">

View file

@ -66,13 +66,13 @@ export function MultimodalInput({
setMessages: Dispatch<SetStateAction<Array<Message>>>;
append: (
message: Message | CreateMessage,
chatRequestOptions?: ChatRequestOptions
chatRequestOptions?: ChatRequestOptions,
) => Promise<string | null | undefined>;
handleSubmit: (
event?: {
preventDefault?: () => void;
},
chatRequestOptions?: ChatRequestOptions
chatRequestOptions?: ChatRequestOptions,
) => void;
className?: string;
}) {
@ -94,7 +94,7 @@ export function MultimodalInput({
const [localStorageInput, setLocalStorageInput] = useLocalStorage(
'input',
''
'',
);
useEffect(() => {
@ -180,7 +180,7 @@ export function MultimodalInput({
const uploadPromises = files.map((file) => uploadFile(file));
const uploadedAttachments = await Promise.all(uploadPromises);
const successfullyUploadedAttachments = uploadedAttachments.filter(
(attachment) => attachment !== undefined
(attachment) => attachment !== undefined,
);
setAttachments((currentAttachments) => [
@ -193,7 +193,7 @@ export function MultimodalInput({
setUploadQueue([]);
}
},
[setAttachments]
[setAttachments],
);
return (
@ -269,7 +269,7 @@ export function MultimodalInput({
onChange={handleInput}
className={cx(
'min-h-[24px] max-h-[calc(75dvh)] overflow-hidden resize-none rounded-xl text-base bg-muted',
className
className,
)}
rows={3}
autoFocus

View file

@ -213,7 +213,7 @@ export function SidebarHistory({ user }: { user: User | undefined }) {
lastWeek: [],
lastMonth: [],
older: [],
} as GroupedChats
} as GroupedChats,
);
};

View file

@ -2,7 +2,6 @@ import type { ComponentProps } from 'react';
import { type SidebarTrigger, useSidebar } from '@/components/ui/sidebar';
import { BetterTooltip } from '@/components/ui/tooltip';
import { cn } from '@/lib/utils';
import { SidebarLeftIcon } from './icons';
import { Button } from './ui/button';

View file

@ -46,14 +46,15 @@ export const Suggestion = ({
<div className="size-4 bg-muted-foreground/25 rounded-full" />
<div className="font-medium">Assistant</div>
</div>
<div
<button
type="button"
className="text-xs text-gray-500 cursor-pointer"
onClick={() => {
setIsExpanded(false);
}}
>
<CrossIcon size={12} />
</div>
</button>
</div>
<div>{suggestion.description}</div>
<Button

View file

@ -32,7 +32,6 @@ import {
StopIcon,
SummarizeIcon,
} from './icons';
import { Button } from './ui/button';
type ToolProps = {
type: 'final-polish' | 'request-suggestions' | 'adjust-reading-level';
@ -45,7 +44,7 @@ type ToolProps = {
isAnimating: boolean;
append: (
message: Message | CreateMessage,
chatRequestOptions?: ChatRequestOptions
chatRequestOptions?: ChatRequestOptions,
) => Promise<string | null | undefined>;
};
@ -159,7 +158,7 @@ const ReadingLevelSelector = ({
isAnimating: boolean;
append: (
message: Message | CreateMessage,
chatRequestOptions?: ChatRequestOptions
chatRequestOptions?: ChatRequestOptions,
) => Promise<string | null | undefined>;
}) => {
const LEVELS = [
@ -212,7 +211,7 @@ const ReadingLevelSelector = ({
{
'bg-primary text-primary-foreground': currentLevel !== 2,
'bg-background text-foreground': currentLevel === 2,
}
},
)}
style={{ y }}
drag="y"
@ -272,7 +271,7 @@ export const Tools = ({
setSelectedTool: Dispatch<SetStateAction<string | null>>;
append: (
message: Message | CreateMessage,
chatRequestOptions?: ChatRequestOptions
chatRequestOptions?: ChatRequestOptions,
) => Promise<string | null | undefined>;
isAnimating: boolean;
setIsToolbarVisible: Dispatch<SetStateAction<boolean>>;
@ -338,7 +337,7 @@ export const Toolbar = ({
isLoading: boolean;
append: (
message: Message | CreateMessage,
chatRequestOptions?: ChatRequestOptions
chatRequestOptions?: ChatRequestOptions,
) => Promise<string | null | undefined>;
stop: () => void;
setMessages: Dispatch<SetStateAction<Message[]>>;

View file

@ -19,7 +19,7 @@ const AlertDialogOverlay = React.forwardRef<
<AlertDialogPrimitive.Overlay
className={cn(
'fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',
className
className,
)}
{...props}
ref={ref}
@ -37,7 +37,7 @@ const AlertDialogContent = React.forwardRef<
ref={ref}
className={cn(
'fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg',
className
className,
)}
{...props}
/>
@ -52,7 +52,7 @@ const AlertDialogHeader = ({
<div
className={cn(
'flex flex-col space-y-2 text-center sm:text-left',
className
className,
)}
{...props}
/>
@ -66,7 +66,7 @@ const AlertDialogFooter = ({
<div
className={cn(
'flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2',
className
className,
)}
{...props}
/>
@ -119,7 +119,7 @@ const AlertDialogCancel = React.forwardRef<
className={cn(
buttonVariants({ variant: 'outline' }),
'mt-2 sm:mt-0',
className
className,
)}
{...props}
/>

View file

@ -30,7 +30,7 @@ const buttonVariants = cva(
variant: 'default',
size: 'default',
},
}
},
);
export interface ButtonProps
@ -49,7 +49,7 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
{...props}
/>
);
}
},
);
Button.displayName = 'Button';

View file

@ -10,7 +10,7 @@ const Card = React.forwardRef<
ref={ref}
className={cn(
'rounded-lg border bg-card text-card-foreground shadow-sm',
className
className,
)}
{...props}
/>
@ -37,7 +37,7 @@ const CardTitle = React.forwardRef<
ref={ref}
className={cn(
'text-2xl font-semibold leading-none tracking-tight',
className
className,
)}
{...props}
/>

View file

@ -29,7 +29,7 @@ const DropdownMenuSubTrigger = React.forwardRef<
className={cn(
'flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent',
inset && 'pl-8',
className
className,
)}
{...props}
>
@ -48,7 +48,7 @@ const DropdownMenuSubContent = React.forwardRef<
ref={ref}
className={cn(
'z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg 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',
className
className,
)}
{...props}
/>
@ -66,7 +66,7 @@ const DropdownMenuContent = React.forwardRef<
sideOffset={sideOffset}
className={cn(
'z-50 min-w-[8rem] overflow-hidden rounded-lg 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',
className
className,
)}
{...props}
/>
@ -85,7 +85,7 @@ const DropdownMenuItem = React.forwardRef<
className={cn(
'relative flex gap-2 cursor-default select-none items-center rounded-md px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0',
inset && 'pl-8',
className
className,
)}
{...props}
/>
@ -100,7 +100,7 @@ const DropdownMenuCheckboxItem = React.forwardRef<
ref={ref}
className={cn(
'relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
className
className,
)}
checked={checked}
{...props}
@ -124,7 +124,7 @@ const DropdownMenuRadioItem = React.forwardRef<
ref={ref}
className={cn(
'relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
className
className,
)}
{...props}
>
@ -149,7 +149,7 @@ const DropdownMenuLabel = React.forwardRef<
className={cn(
'px-2 py-1.5 text-sm font-semibold',
inset && 'pl-8',
className
className,
)}
{...props}
/>

View file

@ -12,13 +12,13 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>(
type={type}
className={cn(
'flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50',
className
className,
)}
ref={ref}
{...props}
/>
);
}
},
);
Input.displayName = 'Input';

View file

@ -7,7 +7,7 @@ import { cva, type VariantProps } from 'class-variance-authority';
import { cn } from '@/lib/utils';
const labelVariants = cva(
'text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70'
'text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70',
);
const Label = React.forwardRef<

View file

@ -20,7 +20,7 @@ const SelectTrigger = React.forwardRef<
ref={ref}
className={cn(
'flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1',
className
className,
)}
{...props}
>
@ -40,7 +40,7 @@ const SelectScrollUpButton = React.forwardRef<
ref={ref}
className={cn(
'flex cursor-default items-center justify-center py-1',
className
className,
)}
{...props}
>
@ -57,7 +57,7 @@ const SelectScrollDownButton = React.forwardRef<
ref={ref}
className={cn(
'flex cursor-default items-center justify-center py-1',
className
className,
)}
{...props}
>
@ -78,7 +78,7 @@ const SelectContent = React.forwardRef<
'relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover 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',
position === 'popper' &&
'data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1',
className
className,
)}
position={position}
{...props}
@ -88,7 +88,7 @@ const SelectContent = React.forwardRef<
className={cn(
'p-1',
position === 'popper' &&
'h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]'
'h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]',
)}
>
{children}
@ -119,7 +119,7 @@ const SelectItem = React.forwardRef<
ref={ref}
className={cn(
'relative flex w-full 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',
className
className,
)}
{...props}
>

View file

@ -11,7 +11,7 @@ const Separator = React.forwardRef<
>(
(
{ className, orientation = 'horizontal', decorative = true, ...props },
ref
ref,
) => (
<SeparatorPrimitive.Root
ref={ref}
@ -20,11 +20,11 @@ const Separator = React.forwardRef<
className={cn(
'shrink-0 bg-border',
orientation === 'horizontal' ? 'h-[1px] w-full' : 'h-full w-[1px]',
className
className,
)}
{...props}
/>
)
),
);
Separator.displayName = SeparatorPrimitive.Root.displayName;

View file

@ -22,7 +22,7 @@ const SheetOverlay = React.forwardRef<
<SheetPrimitive.Overlay
className={cn(
'fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',
className
className,
)}
{...props}
ref={ref}
@ -46,7 +46,7 @@ const sheetVariants = cva(
defaultVariants: {
side: 'right',
},
}
},
);
interface SheetContentProps
@ -81,7 +81,7 @@ const SheetHeader = ({
<div
className={cn(
'flex flex-col space-y-2 text-center sm:text-left',
className
className,
)}
{...props}
/>
@ -95,7 +95,7 @@ const SheetFooter = ({
<div
className={cn(
'flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2',
className
className,
)}
{...props}
/>

View file

@ -70,7 +70,7 @@ const SidebarProvider = React.forwardRef<
children,
...props
},
ref
ref,
) => {
const isMobile = useIsMobile();
const [openMobile, setOpenMobile] = React.useState(false);
@ -91,7 +91,7 @@ const SidebarProvider = React.forwardRef<
// This sets the cookie to keep the sidebar state.
document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;
},
[setOpenProp, open]
[setOpenProp, open],
);
// Helper to toggle the sidebar.
@ -131,7 +131,15 @@ const SidebarProvider = React.forwardRef<
setOpenMobile,
toggleSidebar,
}),
[state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar]
[
state,
open,
setOpen,
isMobile,
openMobile,
setOpenMobile,
toggleSidebar,
],
);
return (
@ -147,7 +155,7 @@ const SidebarProvider = React.forwardRef<
}
className={cn(
'group/sidebar-wrapper flex min-h-svh w-full has-[[data-variant=inset]]:bg-sidebar',
className
className,
)}
data-state={state}
ref={ref}
@ -158,7 +166,7 @@ const SidebarProvider = React.forwardRef<
</TooltipProvider>
</SidebarContext.Provider>
);
}
},
);
SidebarProvider.displayName = 'SidebarProvider';
@ -179,7 +187,7 @@ const Sidebar = React.forwardRef<
children,
...props
},
ref
ref,
) => {
const { isMobile, state, openMobile, setOpenMobile } = useSidebar();
@ -188,7 +196,7 @@ const Sidebar = React.forwardRef<
<div
className={cn(
'flex h-full w-[--sidebar-width] flex-col bg-sidebar text-sidebar-foreground',
className
className,
)}
ref={ref}
{...props}
@ -239,7 +247,7 @@ const Sidebar = React.forwardRef<
'group-data-[side=right]:rotate-180',
variant === 'floating' || variant === 'inset'
? 'group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]'
: 'group-data-[collapsible=icon]:w-[--sidebar-width-icon]'
: 'group-data-[collapsible=icon]:w-[--sidebar-width-icon]',
)}
/>
<div
@ -252,7 +260,7 @@ const Sidebar = React.forwardRef<
variant === 'floating' || variant === 'inset'
? 'p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4)_+2px)]'
: 'group-data-[collapsible=icon]:w-[--sidebar-width-icon] group-data-[side=left]:border-r group-data-[side=right]:border-l',
className
className,
)}
{...props}
>
@ -265,7 +273,7 @@ const Sidebar = React.forwardRef<
</div>
</div>
);
}
},
);
Sidebar.displayName = 'Sidebar';
@ -315,7 +323,7 @@ const SidebarRail = React.forwardRef<
'group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full group-data-[collapsible=offcanvas]:hover:bg-sidebar',
'[[data-side=left][data-collapsible=offcanvas]_&]:-right-2',
'[[data-side=right][data-collapsible=offcanvas]_&]:-left-2',
className
className,
)}
{...props}
/>
@ -333,7 +341,7 @@ const SidebarInset = React.forwardRef<
className={cn(
'relative flex min-h-svh flex-1 flex-col bg-background',
'peer-data-[variant=inset]:min-h-[calc(100svh-theme(spacing.4))] md:peer-data-[variant=inset]:m-2 md:peer-data-[state=collapsed]:peer-data-[variant=inset]:ml-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow',
className
className,
)}
{...props}
/>
@ -351,7 +359,7 @@ const SidebarInput = React.forwardRef<
data-sidebar="input"
className={cn(
'h-8 w-full bg-background shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring',
className
className,
)}
{...props}
/>
@ -414,7 +422,7 @@ const SidebarContent = React.forwardRef<
data-sidebar="content"
className={cn(
'flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden',
className
className,
)}
{...props}
/>
@ -450,7 +458,7 @@ const SidebarGroupLabel = React.forwardRef<
className={cn(
'duration-200 flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 outline-none ring-sidebar-ring transition-[margin,opa] ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0',
'group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0',
className
className,
)}
{...props}
/>
@ -473,7 +481,7 @@ const SidebarGroupAction = React.forwardRef<
// Increases the hit area of the button on mobile.
'after:absolute after:-inset-2 after:md:hidden',
'group-data-[collapsible=icon]:hidden',
className
className,
)}
{...props}
/>
@ -539,7 +547,7 @@ const sidebarMenuButtonVariants = cva(
variant: 'default',
size: 'default',
},
}
},
);
const SidebarMenuButton = React.forwardRef<
@ -560,7 +568,7 @@ const SidebarMenuButton = React.forwardRef<
className,
...props
},
ref
ref,
) => {
const Comp = asChild ? Slot : 'button';
const { isMobile, state } = useSidebar();
@ -597,7 +605,7 @@ const SidebarMenuButton = React.forwardRef<
/>
</Tooltip>
);
}
},
);
SidebarMenuButton.displayName = 'SidebarMenuButton';
@ -624,7 +632,7 @@ const SidebarMenuAction = React.forwardRef<
'group-data-[collapsible=icon]:hidden',
showOnHover &&
'group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0',
className
className,
)}
{...props}
/>
@ -646,7 +654,7 @@ const SidebarMenuBadge = React.forwardRef<
'peer-data-[size=default]/menu-button:top-1.5',
'peer-data-[size=lg]/menu-button:top-2.5',
'group-data-[collapsible=icon]:hidden',
className
className,
)}
{...props}
/>
@ -701,7 +709,7 @@ const SidebarMenuSub = React.forwardRef<
className={cn(
'mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5',
'group-data-[collapsible=icon]:hidden',
className
className,
)}
{...props}
/>
@ -736,7 +744,7 @@ const SidebarMenuSubButton = React.forwardRef<
size === 'sm' && 'text-xs',
size === 'md' && 'text-sm',
'group-data-[collapsible=icon]:hidden',
className
className,
)}
{...props}
/>

View file

@ -11,13 +11,13 @@ const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
<textarea
className={cn(
'flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50',
className
className,
)}
ref={ref}
{...props}
/>
);
}
},
);
Textarea.displayName = 'Textarea';

View file

@ -20,7 +20,7 @@ const TooltipContent = React.forwardRef<
sideOffset={sideOffset}
className={cn(
'z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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',
className
className,
)}
{...props}
/>

View file

@ -62,7 +62,7 @@ export const VersionFooter = ({
body: JSON.stringify({
timestamp: getDocumentTimestampByIndex(
documents,
currentVersionIndex
currentVersionIndex,
),
}),
}),
@ -75,14 +75,14 @@ export const VersionFooter = ({
new Date(
getDocumentTimestampByIndex(
documents,
currentVersionIndex
)
)
)
currentVersionIndex,
),
),
),
),
]
: [],
}
},
);
}}
>

View file

@ -207,10 +207,10 @@ export function Weather({
weatherAtLocation?: WeatherAtLocation;
}) {
const currentHigh = Math.max(
...weatherAtLocation.hourly.temperature_2m.slice(0, 24)
...weatherAtLocation.hourly.temperature_2m.slice(0, 24),
);
const currentLow = Math.min(
...weatherAtLocation.hourly.temperature_2m.slice(0, 24)
...weatherAtLocation.hourly.temperature_2m.slice(0, 24),
);
const isDay = isWithinInterval(new Date(weatherAtLocation.current.time), {
@ -235,17 +235,17 @@ export function Weather({
// Find the index of the current time or the next closest time
const currentTimeIndex = weatherAtLocation.hourly.time.findIndex(
(time) => new Date(time) >= new Date(weatherAtLocation.current.time)
(time) => new Date(time) >= new Date(weatherAtLocation.current.time),
);
// Slice the arrays to get the desired number of items
const displayTimes = weatherAtLocation.hourly.time.slice(
currentTimeIndex,
currentTimeIndex + hoursToShow
currentTimeIndex + hoursToShow,
);
const displayTemperatures = weatherAtLocation.hourly.temperature_2m.slice(
currentTimeIndex,
currentTimeIndex + hoursToShow
currentTimeIndex + hoursToShow,
);
return (
@ -257,7 +257,7 @@ export function Weather({
},
{
'bg-indigo-900': !isDay,
}
},
)}
>
<div className="flex flex-row justify-between items-center">
@ -270,7 +270,7 @@ export function Weather({
},
{
'bg-indigo-100': !isDay,
}
},
)}
/>
<div className="text-4xl font-medium text-blue-50">
@ -296,7 +296,7 @@ export function Weather({
},
{
'bg-indigo-200': !isDay,
}
},
)}
/>
<div className="text-blue-50 text-sm">