From 71f74f585c1793b3081c22a65b2a735909f019cc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?L=C3=A9o?= <leopold.chappuis@savoirfairelinux.com>
Date: Tue, 28 Jan 2025 14:07:49 -0500
Subject: [PATCH] conversation-preferences: display message when no file is
 uploaded

Change-Id: Idb40dde8c2108743b24c4d16d88a2a7f789e06ad
---
 client/src/components/ConversationPreferences.tsx | 11 ++++++++++-
 server/locale/en/translation.json                 |  1 +
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/client/src/components/ConversationPreferences.tsx b/client/src/components/ConversationPreferences.tsx
index 05268bcb..54f26312 100644
--- a/client/src/components/ConversationPreferences.tsx
+++ b/client/src/components/ConversationPreferences.tsx
@@ -31,6 +31,7 @@ import {
   Input,
   Popper,
   Switch,
+  Typography,
   useMediaQuery,
   useTheme,
 } from '@mui/material'
@@ -555,7 +556,7 @@ const Files = () => {
   const { conversationId } = useConversationContext()
   const filesQuery = useGetAllFilesQuery(conversationId)
   const files = filesQuery.data
-
+  const { t } = useTranslation()
   const theme = useTheme()
   const isMobile = useMediaQuery(theme.breakpoints.only('xs'))
 
@@ -563,6 +564,14 @@ const Files = () => {
     ;<ProcessingRequest open={true} />
   }
 
+  if (filesQuery.isSuccess && files.length === 0) {
+    return (
+      <Box>
+        <Typography>{t('no_files_found')}</Typography>
+      </Box>
+    )
+  }
+
   return (
     <Box
       sx={{
diff --git a/server/locale/en/translation.json b/server/locale/en/translation.json
index 018aca38..38103930 100644
--- a/server/locale/en/translation.json
+++ b/server/locale/en/translation.json
@@ -199,6 +199,7 @@
   "mute_conversation": "Mute conversation",
   "nameserver_already_set": "The name server is already set.",
   "next": "Next",
+  "no_files_found": "No files yet.",
   "ongoing_call_muted": "Ongoing call (muted)",
   "ongoing_call_unmuted": "Ongoing call",
   "openid": "OpenID",
-- 
GitLab