agent-ecosystem/src/renderer/components/team/attachments/AttachmentPreviewList.tsx
iliya 80147c9900 feat: update package version and add linting dependency
- Bumped package version from 0.1.0 to 1.0.0 to reflect significant updates.
- Added @codemirror/lint dependency to enhance code linting capabilities.
- Updated pnpm-lock.yaml to include the new linting dependency version.
2026-03-05 18:57:07 +02:00

57 lines
1.8 KiB
TypeScript

import { AlertCircle } from 'lucide-react';
import { AttachmentPreviewItem } from './AttachmentPreviewItem';
import type { AttachmentPayload } from '@shared/types';
interface AttachmentPreviewListProps {
attachments: AttachmentPayload[];
onRemove: (id: string) => void;
error?: string | null;
/** When true, previews are overlaid with a disabled indicator (recipient doesn't support attachments). */
disabled?: boolean;
/** Hint text shown when disabled and attachments are present. */
disabledHint?: string;
}
export const AttachmentPreviewList = ({
attachments,
onRemove,
error,
disabled,
disabledHint,
}: AttachmentPreviewListProps): React.JSX.Element | null => {
if (attachments.length === 0 && !error) return null;
return (
<div className="space-y-1.5 px-1">
{attachments.length > 0 ? (
<div className="flex gap-2 overflow-x-auto py-1">
{attachments.map((att) => (
<AttachmentPreviewItem
key={att.id}
attachment={att}
onRemove={onRemove}
disabled={disabled}
/>
))}
</div>
) : null}
{disabled && disabledHint && attachments.length > 0 ? (
<div
className="flex items-center gap-1.5 rounded-md px-2.5 py-1.5"
style={{ backgroundColor: 'var(--warning-bg)', color: 'var(--warning-text)' }}
>
<AlertCircle size={13} className="shrink-0" />
<p className="text-[11px]">{disabledHint}</p>
</div>
) : null}
{error ? (
<div className="flex items-center gap-1.5 rounded-md bg-red-500/10 px-2.5 py-1.5">
<AlertCircle size={13} className="shrink-0 text-red-400" />
<p className="text-[11px] text-red-400">{error}</p>
</div>
) : null}
</div>
);
};