mirror of
https://github.com/simstudioai/sim.git
synced 2026-09-24 15:45:35 +08:00
* fix(react-doctor): remove unused export types, useEffect clearTimeout missing, a11y fixes * fix(react-doctor): strip unused export types from contracts, copilot, stores, and components Remove export keyword from type/interface declarations confirmed to have zero importers across lib/api/contracts/tools/aws/, lib/api/contracts/*.ts, lib/copilot/generated/, stores/workflows/workflow/types.ts, ee/access-control, ee/data-retention, lib/logs/types.ts, and app/workspace component files. TypeScript and API validation both pass clean. Reduces unused-types count from 394 → 181 and fully eliminates the ✗ critical dead-code categories (exports, types, files now show as ⚠ warnings not ✗ errors). * docs improvements * fix(react-doctor): delete 50 unused files (dead barrels, unreachable components, stale utilities) Remove confirmed-unused barrel index.ts files across stores/, connectors/, executor/, lib/, and app/workspace/ that had zero importers. Also delete unreachable components (chat-history-skeleton, trace-spans, logs-list, template-profile, enterprise landing sections), stale utilities (buffered-stream, blob-to-data-url, queued-workflow-execution, compute-edit-sequence), and obsolete generated/contract files. TypeScript passes clean. * remove dead code * cleanup * more * fix(blog): restore DiffControlsDemo for v0-5 blog post * fix: restore ContactButton for enterprise blog post, export WIKIPEDIA_PAGE_CONTENT_OUTPUT_PROPERTIES * fix(react-doc): restore stripped exports and remove server-only dependency * chore(deps): update lockfile after removing server-only * added back some exports * docs * more * fix type issues * tc * fix docs search route Co-authored-by: Cursor <cursoragent@cursor.com> * fix(tag-dropdown): add missing isEqual import from es-toolkit --------- Co-authored-by: Cursor <cursoragent@cursor.com>
64 lines
1.4 KiB
TypeScript
64 lines
1.4 KiB
TypeScript
'use client'
|
|
|
|
import { useState } from 'react'
|
|
import NextImage, { type ImageProps as NextImageProps } from 'next/image'
|
|
import { Lightbox } from '@/components/ui/lightbox'
|
|
import { cn } from '@/lib/utils'
|
|
|
|
interface ImageProps extends Omit<NextImageProps, 'className'> {
|
|
className?: string
|
|
enableLightbox?: boolean
|
|
}
|
|
|
|
export function Image({
|
|
className = 'w-full',
|
|
enableLightbox = true,
|
|
alt = '',
|
|
src,
|
|
...props
|
|
}: ImageProps) {
|
|
const [isLightboxOpen, setIsLightboxOpen] = useState(false)
|
|
|
|
const openLightbox = () => setIsLightboxOpen(true)
|
|
|
|
const image = (
|
|
<NextImage
|
|
className={cn(
|
|
'overflow-hidden rounded-xl border border-border object-cover',
|
|
enableLightbox && 'transition-opacity group-hover:opacity-95',
|
|
className
|
|
)}
|
|
alt={alt}
|
|
src={src}
|
|
{...props}
|
|
/>
|
|
)
|
|
|
|
return (
|
|
<>
|
|
{enableLightbox ? (
|
|
<button
|
|
type='button'
|
|
onClick={openLightbox}
|
|
aria-label={`Open ${alt} in media viewer`}
|
|
className='group block w-full cursor-pointer rounded-xl p-0 text-left'
|
|
>
|
|
{image}
|
|
</button>
|
|
) : (
|
|
image
|
|
)}
|
|
|
|
{enableLightbox && (
|
|
<Lightbox
|
|
isOpen={isLightboxOpen}
|
|
onClose={() => setIsLightboxOpen(false)}
|
|
src={typeof src === 'string' ? src : String(src)}
|
|
alt={alt}
|
|
type='image'
|
|
/>
|
|
)}
|
|
</>
|
|
)
|
|
}
|