diff --git a/apps/mail/components/create/editor.tsx b/apps/mail/components/create/editor.tsx index fe2ffcdbef..9ef26d3380 100644 --- a/apps/mail/components/create/editor.tsx +++ b/apps/mail/components/create/editor.tsx @@ -33,6 +33,7 @@ import { DialogHeader, DialogTitle, } from '@/components/ui/dialog'; +import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip'; import { AnyExtension, Editor as TiptapEditor, useCurrentEditor } from '@tiptap/react'; import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover'; import { TextButtons } from '@/components/create/selectors/text-buttons'; @@ -48,6 +49,7 @@ import { AutoComplete } from './editor-autocomplete'; import { cn, truncateFileName } from '@/lib/utils'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; +import { useTranslations } from 'next-intl'; import { Markdown } from 'tiptap-markdown'; import { useReducer, useRef } from 'react'; import { useState } from 'react'; @@ -118,6 +120,7 @@ const MenuBar = ({ onAttachmentsChange?: (attachments: File[]) => void; }) => { const { editor } = useCurrentEditor(); + const t = useTranslations(); const [linkDialogOpen, setLinkDialogOpen] = useState(false); const [linkUrl, setLinkUrl] = useState(''); const [attachments, setAttachments] = useState([]); @@ -189,166 +192,249 @@ const MenuBar = ({ return ( <> -
-
-
- - - -
+ +
+
+
+ + + + + {t('pages.createEmail.editor.menuBar.heading1')} + + + + + + {t('pages.createEmail.editor.menuBar.heading2')} + + + + + + {t('pages.createEmail.editor.menuBar.heading3')} + +
- -
- - - - - -
+ +
+ + + + + {t('pages.createEmail.editor.menuBar.bold')} + + + + + + {t('pages.createEmail.editor.menuBar.italic')} + + + + + + + {t('pages.createEmail.editor.menuBar.strikethrough')} + + + + + + + {t('pages.createEmail.editor.menuBar.underline')} + + + + + + {t('pages.createEmail.editor.menuBar.link')} + +
- - -
- - - - {attachments.length > 0 ? ( - - - - - -
-
-

- Attachments ({attachments.length}) -

- -
- -
-
- {attachments.map((file, index) => ( -
- -
-

- {truncateFileName(file.name, 20)} -

-

- {(file.size / (1024 * 1024)).toFixed(2)} MB -

+ + + + {t('pages.createEmail.editor.menuBar.bulletList')} + + + + + + {t('pages.createEmail.editor.menuBar.orderedList')} + + + {attachments.length > 0 ? ( + + + + + + + + + {t('pages.createEmail.editor.menuBar.viewAttachments')} + + + +
+
+

+ {t('pages.createEmail.attachments', { count: attachments.length })} +

+ +
+ +
+
+ {attachments.map((file, index) => ( +
+ +
+

+ {truncateFileName(file.name, 20)} +

+

+ {t('common.units.mb', { + amount: (file.size / (1024 * 1024)).toFixed(2), + })} +

+
-
- ))} + ))} +
-
- - - ) : ( - - )} + + + ) : ( + + + + + + {t('pages.createEmail.editor.menuBar.attachFiles')} + + + )} +
-
+ - Add Link - - Add a URL to create a link. The link will open in a new tab. - + {t('pages.createEmail.addLink')} + {t('pages.createEmail.addUrlToCreateALink')}
@@ -365,10 +451,10 @@ const MenuBar = ({
diff --git a/apps/mail/locales/en.json b/apps/mail/locales/en.json index a0ccb64afe..118498879f 100644 --- a/apps/mail/locales/en.json +++ b/apps/mail/locales/en.json @@ -30,7 +30,9 @@ "failedToRemoveFromFavorites": "Failed to remove from favorites", "failedToModifyFavorites": "Failed to modify favorites", "markingAsRead": "Marking as read...", - "markingAsUnread": "Marking as unread..." + "markingAsUnread": "Marking as unread...", + "cancel": "Cancel", + "save": "Save" }, "themes": { "dark": "Dark", @@ -251,6 +253,9 @@ "createNewLabel": "Create New Label", "noLabelsAvailable": "No labels available", "loadMore": "Load more" + }, + "units": { + "mb": "{amount} MB" } }, "navigation": { @@ -358,11 +363,30 @@ "createEmail": { "body": "Body", "example": "zero@0.email", - "attachments": "Attachments", + "attachments": "Attachments ({count})", + "addMore": "Add more", "dropFilesToAttach": "Drop files to attach", "writeYourMessageHere": "Write your message here...", "emailSentSuccessfully": "Email sent successfully", - "failedToSendEmail": "Failed to send email. Please try again." + "failedToSendEmail": "Failed to send email. Please try again.", + "addLink": "Add Link", + "addUrlToCreateALink": "Add URL to create a link. The link will open in a new tab.", + "editor": { + "menuBar": { + "heading1": "Heading 1", + "heading2": "Heading 2", + "heading3": "Heading 3", + "bold": "Bold", + "italic": "Italic", + "strikethrough": "Strikethrough", + "underline": "Underline", + "link": "Link", + "bulletList": "Bullet List", + "orderedList": "Ordered List", + "viewAttachments": "View Attachments", + "attachFiles": "Attach Files" + } + } } } }