diff --git a/src/pages/popup/components/home/detail/EmailDetailPane.tsx b/src/pages/popup/components/home/detail/EmailDetailPane.tsx index ae258c6..1910bc3 100644 --- a/src/pages/popup/components/home/detail/EmailDetailPane.tsx +++ b/src/pages/popup/components/home/detail/EmailDetailPane.tsx @@ -23,6 +23,7 @@ import SaveButton from '@pages/popup/components/home/detail/SaveButton'; import CancelEditingButton from '@pages/popup/components/home/detail/CancelEditingButton'; import { CopyIcon } from '@pages/popup/components/home/icons/icons'; import EmailStateToggle from '@pages/popup/components/home/detail/EmailStateToggle'; +import NoEmailSelected from '@pages/popup/components/home/detail/NoEmailSelected'; export default function EmailDetailPane({ selectedEmail, @@ -88,6 +89,7 @@ export default function EmailDetailPane({ ); await setFavoriteEmailIds(updatedFavorites); setIsFavorited(false); + // remove the email from the favorites list } else { // Add the email to the favorites list const updatedFavoritedEmailIds = [ @@ -160,59 +162,74 @@ export default function EmailDetailPane({ emailDomain = selectedEmail.forDomain; } return ( -
-
- {/*Only allow the user to toggle the state of the email while not editing*/} - {!isEditing && ( - - )} - {isEditing ? ( - handleSetIsEditing(false)} /> - ) : ( - - )} - {isEditing ? ( - - ) : ( - - )} -
-
- - - - - {/* Tell the user the text was copied to their clipboard*/} - {showCopyAlert && ( -
-
- -
Copied to clipboard!
+
+
+ {/* If there is an email selected, show the details, otherwise show the NoEmailSelected component*/} + {selectedEmail ? ( + <> +
+ {/*Only allow the user to toggle the state of the email while not editing*/} + {!isEditing && ( + + )} + {isEditing ? ( + handleSetIsEditing(false)} + /> + ) : ( + + )} + {isEditing ? ( + + ) : ( + + )}
+
+ + + + + {/* Tell the user the text was copied to their clipboard*/} + {showCopyAlert && ( +
+
+ +
Copied to clipboard!
+
+
+ )} +
+ + ) : ( +
+
)}
diff --git a/src/pages/popup/components/home/detail/NoEmailSelected.tsx b/src/pages/popup/components/home/detail/NoEmailSelected.tsx new file mode 100644 index 0000000..ce77369 --- /dev/null +++ b/src/pages/popup/components/home/detail/NoEmailSelected.tsx @@ -0,0 +1,11 @@ +/** + * This component is displayed when no email is selected. (For example when there are no emails to display in the filtered email list) + */ +const NoEmailSelected: React.FC = () => { + return ( +
+ Nothing to see here.. +
+ ); +}; +export default NoEmailSelected;