diff --git a/src/app/ui/attach-dropdown.tsx b/src/app/ui/attach-dropdown.tsx
index e4bb239..8087f31 100644
--- a/src/app/ui/attach-dropdown.tsx
+++ b/src/app/ui/attach-dropdown.tsx
@@ -105,7 +105,13 @@ export default function AttachDropdown({ onSelect }: AttachDropdownProps) {
setIsOpen(!isOpen);
};
- const handleSelect = (file: fileDataType) => {
+ const handleSelect = (file: fileDataType | null) => {
+ if (!file) {
+ setSelectedFiles([]);
+ onSelect([]);
+ setIsOpen(false);
+ return;
+ }
const alreadySelected = selectedFiles.some(
(selectedFile) => selectedFile.file_id === file.file_id
);
@@ -215,6 +221,17 @@ export default function AttachDropdown({ onSelect }: AttachDropdownProps) {
+ handleSelect(null)}
+ >
+
+ No Selection
+ |
+
{filteredOptions.map((option) => (
setIsVisible(true)}
+ onMouseLeave={() => setIsVisible(false)}
+ >
+ {children}
+ {isVisible && (
+
+ )}
+
+ );
+}
diff --git a/src/app/ui/select-dropdown.tsx b/src/app/ui/select-dropdown.tsx
index a1c3a8d..293b777 100644
--- a/src/app/ui/select-dropdown.tsx
+++ b/src/app/ui/select-dropdown.tsx
@@ -120,12 +120,18 @@ export default function SelectDropdown({
};
const handleSelect = (
- file_id: string,
- file_url: string,
- file_name: string
+ file_id: string | null,
+ file_url: string | null,
+ file_name: string | null
) => {
+ if (!file_id || !file_url || !file_name) {
+ onSelect("", "");
+ setSelectedFileName(`Select a ${fileExtension} file`);
+ setIsOpen(false);
+ return;
+ }
onSelect(file_id, file_url);
- console.log("Selected file:", file_id);
+ // console.log("Selected file:", file_id);
setSelectedFileName(file_name);
setIsOpen(false);
};
@@ -217,6 +223,17 @@ export default function SelectDropdown({
+ handleSelect(null, null, null)}
+ >
+
+ No Selection
+ |
+
{filteredOptions.map((option) => (
(null);
const [isSubmitting, setIsSubmitting] = useState(false);
- const [selectedHtmlFile, setSelectedHtmlFile] = useState("");
- const [selectedXlsxFile, setSelectedXlsxFile] = useState("");
- const [htmlPreviewLink, setHtmlPreviewLink] = useState("");
- const [xlsxPreviewLink, setXlsxPreviewLink] = useState("");
+ const [selectedHtmlFile, setSelectedHtmlFile] = useState("");
+ const [selectedXlsxFile, setSelectedXlsxFile] = useState("");
+ const [htmlPreviewLink, setHtmlPreviewLink] = useState("");
+ const [xlsxPreviewLink, setXlsxPreviewLink] = useState("");
const [errors, setErrors] = useState<{ [key: string]: string }>({});
const [showHtmlUpload, setShowHtmlUpload] = useState(false);
const [showXlsxUpload, setShowXlsxUpload] = useState(false);
@@ -105,7 +106,10 @@ export default function SendEmailForm() {
setIsSubmitting(false);
};
- const handleHtmlSelect = (file_id: string, file_url: string) => {
+ const handleHtmlSelect = (
+ file_id: string | null,
+ file_url: string | null
+ ) => {
setSelectedHtmlFile(file_id);
setHtmlPreviewLink(file_url);
};
@@ -188,8 +192,11 @@ export default function SendEmailForm() {
Required
-