Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/logo.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link href="/src/style.css" rel="stylesheet" />
<link href="/src/index.css" rel="stylesheet" />
<title>Internxt Mail</title>
</head>
<body>
Expand Down
41 changes: 37 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"dependencies": {
"@internxt/css-config": "^1.1.0",
"@internxt/sdk": "^1.15.1",
"@internxt/ui": "=0.1.10",
"@internxt/ui": "^0.1.11",
"@phosphor-icons/react": "^2.1.10",
"@reduxjs/toolkit": "^2.11.2",
"@tailwindcss/vite": "^4.2.1",
Expand All @@ -36,7 +36,8 @@
"@tiptap/react": "^3.20.0",
"@tiptap/starter-kit": "^3.20.0",
"axios": "^1.13.6",
"dayjs": "^1.11.19",
"dayjs": "^1.11.20",
"dompurify": "^3.3.3",
"i18next": "^25.8.13",
"prettysize": "^2.0.0",
"react": "^19.2.0",
Expand All @@ -57,6 +58,7 @@
"@internxt/prettier-config": "internxt/prettier-config#v1.0.2",
"@testing-library/dom": "^10.4.1",
"@testing-library/react": "^16.3.2",
"@types/dompurify": "^3.0.5",
"@types/node": "^25.3.3",
"@types/react": "^19.2.7",
"@types/react-dom": "^19.2.3",
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
93 changes: 93 additions & 0 deletions src/assets/fonts/InstrumentSans/OFL.txt
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.
10 changes: 10 additions & 0 deletions src/assets/fonts/InstrumentSans/font.css
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');
}
45 changes: 45 additions & 0 deletions src/components/user-chip/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { UserCheap } from '@internxt/ui';
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}
>
<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;
24 changes: 13 additions & 11 deletions src/features/mail/MailView.tsx
Original file line number Diff line number Diff line change
@@ -1,28 +1,30 @@
import { useTranslationContext } from '@/i18n';
import Header from './components/header';
import { Tray } from '@internxt/ui';
import { TrayEmptyState } from './components/trayEmptyState';
import type { FolderType } from '@/types/mail';
import { getMockedMail } from '@/test-utils/fixtures';
import PreviewMail from './components/mail-preview';
import type { User } from './components/mail-preview/header';
import TrayList from './components/tray';

interface MailViewProps {
folder: FolderType;
}

const MailView = ({ folder }: MailViewProps) => {
const { translate } = useTranslationContext();
const mockedMail = getMockedMail();
const from = mockedMail.from[0];
const to = mockedMail.to;
const cc = mockedMail.cc;
const bcc = mockedMail.bcc;

const folderName = translate(`mail.${folder}`);

return (
<div className="flex flex-row w-full h-full">
<div className="flex flex-col border-r border-gray-5 h-full">
<div className="flex z-10">
<Header folderName={folderName} />
</div>
<div className="flex-1 w-full overflow-hidden">
<Tray loading={true} mails={[]} emptyState={<TrayEmptyState folderName={folderName} />} />
</div>
</div>
{/* Tray */}
<TrayList folderName={folderName} />
{/* Mail Preview */}
<PreviewMail bcc={bcc} cc={cc as User[]} from={from} to={to} mail={mockedMail} />
</div>
);
};
Expand Down
68 changes: 68 additions & 0 deletions src/features/mail/components/mail-preview/header/index.tsx
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;
Loading
Loading