-
Notifications
You must be signed in to change notification settings - Fork 0
[PB-6144]: feat/complete mail view #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| Copyright 2022 The Instrument Sans Project Authors (https://github.com/Instrument/instrument-sans) | ||
|
|
||
| This Font Software is licensed under the SIL Open Font License, Version 1.1. | ||
| This license is copied below, and is also available with a FAQ at: | ||
| http://scripts.sil.org/OFL | ||
|
|
||
|
|
||
| ----------------------------------------------------------- | ||
| SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 | ||
| ----------------------------------------------------------- | ||
|
|
||
| PREAMBLE | ||
| The goals of the Open Font License (OFL) are to stimulate worldwide | ||
| development of collaborative font projects, to support the font creation | ||
| efforts of academic and linguistic communities, and to provide a free and | ||
| open framework in which fonts may be shared and improved in partnership | ||
| with others. | ||
|
|
||
| The OFL allows the licensed fonts to be used, studied, modified and | ||
| redistributed freely as long as they are not sold by themselves. The | ||
| fonts, including any derivative works, can be bundled, embedded, | ||
| redistributed and/or sold with any software provided that any reserved | ||
| names are not used by derivative works. The fonts and derivatives, | ||
| however, cannot be released under any other type of license. The | ||
| requirement for fonts to remain under this license does not apply | ||
| to any document created using the fonts or their derivatives. | ||
|
|
||
| DEFINITIONS | ||
| "Font Software" refers to the set of files released by the Copyright | ||
| Holder(s) under this license and clearly marked as such. This may | ||
| include source files, build scripts and documentation. | ||
|
|
||
| "Reserved Font Name" refers to any names specified as such after the | ||
| copyright statement(s). | ||
|
|
||
| "Original Version" refers to the collection of Font Software components as | ||
| distributed by the Copyright Holder(s). | ||
|
|
||
| "Modified Version" refers to any derivative made by adding to, deleting, | ||
| or substituting -- in part or in whole -- any of the components of the | ||
| Original Version, by changing formats or by porting the Font Software to a | ||
| new environment. | ||
|
|
||
| "Author" refers to any designer, engineer, programmer, technical | ||
| writer or other person who contributed to the Font Software. | ||
|
|
||
| PERMISSION & CONDITIONS | ||
| Permission is hereby granted, free of charge, to any person obtaining | ||
| a copy of the Font Software, to use, study, copy, merge, embed, modify, | ||
| redistribute, and sell modified and unmodified copies of the Font | ||
| Software, subject to the following conditions: | ||
|
|
||
| 1) Neither the Font Software nor any of its individual components, | ||
| in Original or Modified Versions, may be sold by itself. | ||
|
|
||
| 2) Original or Modified Versions of the Font Software may be bundled, | ||
| redistributed and/or sold with any software, provided that each copy | ||
| contains the above copyright notice and this license. These can be | ||
| included either as stand-alone text files, human-readable headers or | ||
| in the appropriate machine-readable metadata fields within text or | ||
| binary files as long as those fields can be easily viewed by the user. | ||
|
|
||
| 3) No Modified Version of the Font Software may use the Reserved Font | ||
| Name(s) unless explicit written permission is granted by the corresponding | ||
| Copyright Holder. This restriction only applies to the primary font name as | ||
| presented to the users. | ||
|
|
||
| 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font | ||
| Software shall not be used to promote, endorse or advertise any | ||
| Modified Version, except to acknowledge the contribution(s) of the | ||
| Copyright Holder(s) and the Author(s) or with their explicit written | ||
| permission. | ||
|
|
||
| 5) The Font Software, modified or unmodified, in part or in whole, | ||
| must be distributed entirely under this license, and must not be | ||
| distributed under any other license. The requirement for fonts to | ||
| remain under this license does not apply to any document created | ||
| using the Font Software. | ||
|
|
||
| TERMINATION | ||
| This license becomes null and void if any of the above conditions are | ||
| not met. | ||
|
|
||
| DISCLAIMER | ||
| THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
| EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF | ||
| MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT | ||
| OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE | ||
| COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | ||
| INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL | ||
| DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
| FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM | ||
| OTHER DEALINGS IN THE FONT SOFTWARE. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| /* Instrument Sans font family */ | ||
|
|
||
| @font-face { | ||
| font-family: 'Instrument Sans'; | ||
| font-style: normal; | ||
| font-display: swap; | ||
| src: | ||
| local('Instrument Sans'), | ||
| url('./InstrumentSans-variable.woff2') format('woff2'); | ||
| } | ||
xabg2 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| import { UserCheap } from '@internxt/ui'; | ||
xabg2 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| import { useId, useRef, useState } from 'react'; | ||
| import { createPortal } from 'react-dom'; | ||
|
|
||
| interface UserChipProps { | ||
| avatar?: string; | ||
| name: string; | ||
| email: string; | ||
| } | ||
|
|
||
| const UserChip = ({ avatar, name, email }: UserChipProps) => { | ||
| const [position, setPosition] = useState<{ top: number; left: number } | null>(null); | ||
| const ref = useRef<HTMLDivElement>(null); | ||
| const tooltipId = useId(); | ||
|
|
||
| const handleMouseEnter = () => { | ||
| const rect = ref.current?.getBoundingClientRect(); | ||
| if (rect) setPosition({ top: rect.bottom, left: rect.left }); | ||
| }; | ||
|
|
||
| return ( | ||
| <div | ||
| ref={ref} | ||
| className="relative inline-block" | ||
| onMouseEnter={handleMouseEnter} | ||
| onMouseLeave={() => setPosition(null)} | ||
| role="tooltip" | ||
| aria-describedby={position ? tooltipId : undefined} | ||
| > | ||
xabg2 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| <span className="cursor-default rounded-md bg-gray-5 px-2 py-1 text-sm font-medium text-gray-60"> | ||
| {name.split(' ')[0]} | ||
| </span> | ||
|
|
||
| {position && | ||
| createPortal( | ||
| <div id={tooltipId} role="tooltip" className="fixed z-10" style={{ top: position.top, left: position.left }}> | ||
| <UserCheap avatar={avatar} fullName={name} email={email} /> | ||
| </div>, | ||
| document.body, | ||
| )} | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export default UserChip; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
src/features/mail/components/mail-preview/header/index.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| import UserChip from '@/components/user-chip'; | ||
| import { useTranslationContext } from '@/i18n'; | ||
| import { DateService } from '@/services/date'; | ||
| import { Avatar } from '@internxt/ui'; | ||
| import { PaperclipIcon } from '@phosphor-icons/react'; | ||
|
|
||
| export interface User { | ||
| email: string; | ||
| name: string; | ||
| avatar?: string; | ||
| } | ||
|
|
||
| interface HeaderProps { | ||
| sender: User; | ||
| date: string; | ||
| to: User[]; | ||
| cc: User[]; | ||
| bcc: User[]; | ||
| attachmentsLength?: number; | ||
| } | ||
|
|
||
| const RecipientLine = ({ label, users }: { label: string; users: User[] }) => { | ||
| if (users.length === 0) return null; | ||
|
|
||
| return ( | ||
| <span className="flex flex-row items-center gap-1 text-sm font-medium text-gray-100"> | ||
| {label}: | ||
| <span className="flex flex-row flex-wrap gap-1"> | ||
| {users.map((user, index) => ( | ||
| <UserChip key={`${user.email}-${index}`} avatar={user.avatar} name={user.name} email={user.email} /> | ||
| ))} | ||
| </span> | ||
| </span> | ||
| ); | ||
| }; | ||
|
|
||
| const PreviewHeader = ({ sender, date, to, cc, bcc, attachmentsLength }: HeaderProps) => { | ||
| const formattedDate = DateService.formatWithTime(date); | ||
| const { translate } = useTranslationContext(); | ||
|
|
||
| return ( | ||
| <div className="flex w-full flex-row items-start justify-between p-5"> | ||
| <div className="flex flex-row gap-3"> | ||
| <Avatar fullName={sender.name} src={sender.avatar} diameter={40} /> | ||
| <div className="flex flex-col gap-0.5"> | ||
| <p className="text-lg font-medium text-gray-100">{sender.name}</p> | ||
| <div className="flex flex-col gap-2"> | ||
| <RecipientLine label={translate('mail.preview.to')} users={to} /> | ||
| <RecipientLine label={translate('mail.preview.cc')} users={cc} /> | ||
| <RecipientLine label={translate('mail.preview.bcc')} users={bcc} /> | ||
| </div> | ||
| </div> | ||
| </div> | ||
|
|
||
| <div className="flex flex-col items-end gap-3 text-sm text-gray-500"> | ||
| <span className="whitespace-nowrap text-sm text-gray-80">{formattedDate}</span> | ||
| {(attachmentsLength ?? 0) > 0 ? ( | ||
| <span className="flex flex-row items-center gap-1"> | ||
| <PaperclipIcon size={16} /> | ||
| {attachmentsLength} | ||
| </span> | ||
| ) : null} | ||
| </div> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export default PreviewHeader; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.