π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Show progress while attaching images
Manav Rathi75c0a47d01a0
diff --git a/rust/apps/ensu/changes/attachment-progress.md b/rust/apps/ensu/changes/attachment-progress.mdnew file mode 100644index 0000000000..bbe23eb7f6--- /dev/null+++ b/rust/apps/ensu/changes/attachment-progress.md@@ -0,0 +1 @@+- Added a progress indicator while attaching images.diff --git a/web/apps/ensu/src/components/chat/ChatComposer.tsx b/web/apps/ensu/src/components/chat/ChatComposer.tsxindex 2e0f35572f..436be46e00 100644--- a/web/apps/ensu/src/components/chat/ChatComposer.tsx+++ b/web/apps/ensu/src/components/chat/ChatComposer.tsx@@ -9,6 +9,7 @@ import { HugeiconsIcon } from "@hugeicons/react";import {Box,Button,+ CircularProgress,IconButton,LinearProgress,Menu,@@ -63,6 +64,7 @@ export interface ChatComposerProps {handleCancelEdit: () => void;pendingDocuments: DocumentAttachment[];pendingImages: ImageAttachment[];+ isAttachingImages: boolean;pendingImagePreviews: Record<string, string>;removePendingDocument: (id: string) => void;removePendingImage: (id: string) => void;@@ -103,6 +105,7 @@ export const ChatComposer = memo(handleCancelEdit,pendingDocuments,pendingImages,+ isAttachingImages,pendingImagePreviews,removePendingDocument,removePendingImage,@@ -149,13 +152,22 @@ export const ChatComposer = memo(modelGateStatus === "downloading";const disableAttachmentButton =isGenerating ||+ isAttachingImages ||isModelPreparationActive ||isDownloading ||(showImageAttachment && isImageAttachmentLimitReached);const pendingImagePreviewRow =- pendingImages.length > 0 ? (- <Box sx={{ display: "flex", flexWrap: "wrap", gap: 1, pb: 1 }}>+ pendingImages.length > 0 || isAttachingImages ? (+ <Box+ sx={{+ display: "flex",+ flexWrap: "wrap",+ alignItems: "center",+ gap: 1,+ pb: 1,+ }}+ >{pendingImages.map((img) => {const preview = pendingImagePreviews[img.id];return (@@ -224,6 +236,19 @@ export const ChatComposer = memo(</Box>);})}+ {isAttachingImages && (+ <Stack+ direction="row"+ spacing={1}+ sx={{ alignItems: "center", color: "text.muted" }}+ role="status"+ >+ <CircularProgress size={16} color="inherit" />+ <Typography variant="small">+ Attaching images...+ </Typography>+ </Stack>+ )}</Box>) : null;@@ -536,6 +561,7 @@ export const ChatComposer = memo(pendingImages.length > 0}isDownloading={isDownloading}+ isAttachingImages={isAttachingImages}isGenerating={isGenerating}isModelPreparationActive={isModelPreparationActivediff --git a/web/apps/ensu/src/components/chat/ChatInput.tsx b/web/apps/ensu/src/components/chat/ChatInput.tsxindex c6a9aee48a..8855eed1f0 100644--- a/web/apps/ensu/src/components/chat/ChatInput.tsx+++ b/web/apps/ensu/src/components/chat/ChatInput.tsx@@ -28,6 +28,7 @@ interface ChatInputProps {handleStopGeneration: () => void;hasPendingAttachments: boolean;initialText: string;+ isAttachingImages: boolean;isDownloading: boolean;isGenerating: boolean;isModelPreparationActive: boolean;@@ -47,6 +48,7 @@ export const ChatInput = memo(handleStopGeneration,hasPendingAttachments,initialText,+ isAttachingImages,isDownloading,isGenerating,isModelPreparationActive,@@ -71,6 +73,7 @@ export const ChatInput = memo(const send = () => void handleSend(input);const disableSend =+ isAttachingImages ||isModelPreparationActive ||isDownloading ||(!isGenerating && !input.trim() && !hasPendingAttachments);diff --git a/web/apps/ensu/src/pages/chat.tsx b/web/apps/ensu/src/pages/chat.tsxindex 5468b78b77..b561ae803d 100644--- a/web/apps/ensu/src/pages/chat.tsx+++ b/web/apps/ensu/src/pages/chat.tsx@@ -598,8 +598,7 @@ const Page: React.FC = () => {Record<string, string>>({});const [isImageDragActive, setIsImageDragActive] = useState(false);- const [isProcessingDroppedImages, setIsProcessingDroppedImages] =- useState(false);+ const [isAttachingImages, setIsAttachingImages] = useState(false);const [imagePreview, setImagePreview] = useState<{url: string;name: string;@@ -3762,18 +3761,12 @@ const Page: React.FC = () => {showImageAttachment &&!isGenerating &&!isDownloading &&- !showModelGate;- const canAttachDroppedImages =- canHandleImageDrop &&- !isImageAttachmentLimitReached &&- !isProcessingDroppedImages;- const showImageDropOverlay =- canHandleImageDrop && (isImageDragActive || isProcessingDroppedImages);- const imageDropOverlayTitle = isProcessingDroppedImages- ? "Attaching images..."- : isImageAttachmentLimitReached- ? "Image limit reached"- : "Drop images to attach";+ !showModelGate &&+ !isAttachingImages;+ const showImageDropOverlay = canHandleImageDrop && isImageDragActive;+ const imageDropOverlayTitle = isImageAttachmentLimitReached+ ? "Image limit reached"+ : "Drop images to attach";const imageDropOverlayDescription = isImageAttachmentLimitReached? `You can attach up to ${MAX_IMAGE_ATTACHMENTS_PER_MESSAGE} images per message.`: "PNG, JPG, WebP, GIF, BMP, HEIC, HEIF, AVIF";@@ -3834,8 +3827,7 @@ const Page: React.FC = () => {return;}- const isDrop = source === "drop";- if (isDrop) setIsProcessingDroppedImages(true);+ setIsAttachingImages(true);try {const { invoke } = await import("@tauri-apps/api/core");@@ -3884,7 +3876,7 @@ const Page: React.FC = () => {);return;} finally {- if (isDrop) setIsProcessingDroppedImages(false);+ setIsAttachingImages(false);}},[@@ -3972,7 +3964,6 @@ const Page: React.FC = () => {});return;}- if (!canAttachDroppedImages) return;const imagePaths = event.payload.paths.filter((path) => {const lowerPath = path.toLowerCase();@@ -4011,7 +4002,6 @@ const Page: React.FC = () => {unlisten?.();};}, [- canAttachDroppedImages,canHandleImageDrop,isImageAttachmentLimitReached,isTauriRuntime,@@ -4063,6 +4053,7 @@ const Page: React.FC = () => {}, []);const handleSend = async (input: string) => {+ if (isAttachingImages) return;const trimmed = input.trim();const hasDocuments = pendingDocuments.length > 0;const hasImages = pendingImages.length > 0;@@ -4533,6 +4524,7 @@ const Page: React.FC = () => {handleCancelEdit={handleCancelEdit}pendingDocuments={pendingDocuments}pendingImages={pendingImages}+ isAttachingImages={isAttachingImages}pendingImagePreviews={pendingImagePreviews}removePendingDocument={removePendingDocument}removePendingImage={removePendingImage}