diff --git a/be/apps/dashboard/src/modules/photos/components/library/PhotoUploadConfirmModal.tsx b/be/apps/dashboard/src/modules/photos/components/library/PhotoUploadConfirmModal.tsx index c497084d..ff50278a 100644 --- a/be/apps/dashboard/src/modules/photos/components/library/PhotoUploadConfirmModal.tsx +++ b/be/apps/dashboard/src/modules/photos/components/library/PhotoUploadConfirmModal.tsx @@ -25,4 +25,4 @@ export const PhotoUploadConfirmModal: ModalComponent 0) { event.preventDefault() - handleRemove(value.at(-1)) + const last = value.at(-1) + if (!last) { + return + } + handleRemove(last) } } @@ -58,9 +61,9 @@ export function AutoSelect({ options, value, onChange, placeholder, disabled }: return (
- @@ -70,13 +73,13 @@ export function AutoSelect({ options, value, onChange, placeholder, disabled }: key={tag} type="button" onClick={() => handleRemove(tag)} - className="bg-accent/10 text-accent hover:bg-accent/20 flex items-center gap-1 rounded-full px-2 py-0.5 text-[11px]" + className="bg-accent/10 text-accent hover:bg-accent/20 flex items-center gap-1 rounded px-2 py-0.5 text-[11px]" > {tag} - × + × ))} -
+
setQuery(event.target.value)} @@ -87,10 +90,10 @@ export function AutoSelect({ options, value, onChange, placeholder, disabled }: />
-
+
{(filteredOptions.length > 0 || showCreateOption) && !disabled ? ( - +

选择或创建标签

{filteredOptions.map((option) => ( @@ -117,7 +120,7 @@ export function AutoSelect({ options, value, onChange, placeholder, disabled }: ) : null}
- +
) : null} ) diff --git a/be/apps/dashboard/src/modules/photos/components/library/photo-upload/UploadFileList.tsx b/be/apps/dashboard/src/modules/photos/components/library/photo-upload/UploadFileList.tsx index f74433c9..06a338ac 100644 --- a/be/apps/dashboard/src/modules/photos/components/library/photo-upload/UploadFileList.tsx +++ b/be/apps/dashboard/src/modules/photos/components/library/photo-upload/UploadFileList.tsx @@ -1,8 +1,8 @@ +import { Button, ScrollArea } from '@afilmory/ui' import { Spring } from '@afilmory/utils' +import { X } from 'lucide-react' import { m } from 'motion/react' -import { LinearBorderPanel } from '~/components/common/GlassPanel' - import { FILE_STATUS_CLASS, FILE_STATUS_LABEL } from './constants' import type { FileProgressEntry } from './types' import { formatBytes } from './utils' @@ -10,9 +10,10 @@ import { formatBytes } from './utils' type UploadFileListProps = { entries: FileProgressEntry[] overallProgress: number + onRemoveEntry?: (entry: FileProgressEntry) => void } -export function UploadFileList({ entries, overallProgress }: UploadFileListProps) { +export function UploadFileList({ entries, overallProgress, onRemoveEntry }: UploadFileListProps) { return (
@@ -27,7 +28,8 @@ export function UploadFileList({ entries, overallProgress }: UploadFileListProps transition={Spring.presets.smooth} />
- + + (
  • @@ -46,9 +48,24 @@ export function UploadFileList({ entries, overallProgress }: UploadFileListProps

    {formatBytes(entry.size)}

    - - {FILE_STATUS_LABEL[entry.status]} - +
    + + {FILE_STATUS_LABEL[entry.status]} + + {onRemoveEntry ? ( + + ) : null} +
    ))} - +
    ) } diff --git a/be/apps/dashboard/src/modules/photos/components/library/photo-upload/steps/ReviewStep.tsx b/be/apps/dashboard/src/modules/photos/components/library/photo-upload/steps/ReviewStep.tsx index 49cc5673..a055d79b 100644 --- a/be/apps/dashboard/src/modules/photos/components/library/photo-upload/steps/ReviewStep.tsx +++ b/be/apps/dashboard/src/modules/photos/components/library/photo-upload/steps/ReviewStep.tsx @@ -30,6 +30,7 @@ export function ReviewStep() { const beginUpload = usePhotoUploadStore((state) => state.beginUpload) const closeModal = usePhotoUploadStore((state) => state.closeModal) const setSelectedTags = usePhotoUploadStore((state) => state.setSelectedTags) + const removeEntry = usePhotoUploadStore((state) => state.removeEntry) const tagOptions = useMemo( () => availableTags.map((tag) => ({ label: tag, value: tag.toLowerCase() })), @@ -42,7 +43,7 @@ export function ReviewStep() {

    确认上传这些文件?

    - 共选择 {filesCount} 项,预计占用 {formatBytes(totalSize)}。请先设置标签后开始上传。 + 共选择 {filesCount} 项,预计占用 {formatBytes(totalSize)}。

    @@ -63,10 +64,10 @@ export function ReviewStep() { options={tagOptions} value={selectedTags} onChange={setSelectedTags} - placeholder="输入后按 Enter 添加,或从建议中选择" + placeholder="标签:输入后按 Enter 添加,或从建议中选择" /> - +