-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(core): add team workspace related UI
- Loading branch information
Showing
56 changed files
with
2,828 additions
and
934 deletions.
There are no files selected for viewing
Binary file added
BIN
+218 KB
...ontend/component/src/components/affine-other-page-layout/assets/dot-bg.dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+257 KB
...ntend/component/src/components/affine-other-page-layout/assets/dot-bg.light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+366 KB
...nd/component/src/components/affine-other-page-layout/assets/other-page.dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+374 KB
...d/component/src/components/affine-other-page-layout/assets/other-page.light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
1 change: 1 addition & 0 deletions
1
packages/frontend/component/src/components/member-components/index.tsx
This file contains 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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
export * from './accept-invite-page'; | ||
export * from './invite-modal'; | ||
export * from './invite-team-modal'; | ||
export * from './member-limit-modal'; | ||
export * from './pagination'; |
53 changes: 53 additions & 0 deletions
53
...es/frontend/component/src/components/member-components/invite-team-modal/email-invite.tsx
This file contains 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,53 @@ | ||
import { useI18n } from '@affine/i18n'; | ||
import { ExportIcon } from '@blocksuite/icons/rc'; | ||
import { cssVar } from '@toeverything/theme'; | ||
|
||
import { Button } from '../../../ui/button'; | ||
import Input from '../../../ui/input'; | ||
import * as styles from './styles.css'; | ||
|
||
export const EmailInvite = ({ | ||
inviteEmail, | ||
setInviteEmail, | ||
handleConfirm, | ||
isMutating, | ||
isValidEmail, | ||
}: { | ||
inviteEmail: string; | ||
setInviteEmail: (value: string) => void; | ||
handleConfirm: () => void; | ||
isMutating: boolean; | ||
isValidEmail: boolean; | ||
}) => { | ||
const t = useI18n(); | ||
return ( | ||
<> | ||
<div className={styles.modalSubTitle}> | ||
{t['com.affine.payment.member.team.invite.email-invite']()} | ||
</div> | ||
<div> | ||
<Input | ||
inputStyle={{ fontSize: cssVar('fontXs') }} | ||
disabled={isMutating} | ||
placeholder={t[ | ||
'com.affine.payment.member.team.invite.email-placeholder' | ||
]()} | ||
value={inviteEmail} | ||
onChange={setInviteEmail} | ||
onEnter={handleConfirm} | ||
size="large" | ||
/> | ||
{!isValidEmail ? ( | ||
<div className={styles.errorHint}> | ||
{t['com.affine.auth.sign.email.error']()} | ||
</div> | ||
) : null} | ||
</div> | ||
<div> | ||
<Button className={styles.importButton} prefix={<ExportIcon />}> | ||
{t['com.affine.payment.member.team.invite.import-csv']()} | ||
</Button> | ||
</div> | ||
</> | ||
); | ||
}; |
97 changes: 97 additions & 0 deletions
97
packages/frontend/component/src/components/member-components/invite-team-modal/index.tsx
This file contains 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,97 @@ | ||
import { emailRegex } from '@affine/component/auth-components'; | ||
import { Permission } from '@affine/graphql'; | ||
import { useI18n } from '@affine/i18n'; | ||
import { useCallback, useEffect, useState } from 'react'; | ||
|
||
import { ConfirmModal } from '../../../ui/modal'; | ||
import { notify } from '../../../ui/notification'; | ||
import { type InviteMethodType, ModalContent } from './modal-content'; | ||
import * as styles from './styles.css'; | ||
|
||
export interface InviteTeamMemberModalProps { | ||
open: boolean; | ||
setOpen: (value: boolean) => void; | ||
onConfirm: (params: { email: string; permission: Permission }) => void; | ||
isMutating: boolean; | ||
copyTextToClipboard: (text: string) => Promise<boolean>; | ||
} | ||
|
||
export const InviteTeamMemberModal = ({ | ||
open, | ||
setOpen, | ||
onConfirm, | ||
isMutating, | ||
copyTextToClipboard, | ||
}: InviteTeamMemberModalProps) => { | ||
const t = useI18n(); | ||
const [inviteEmail, setInviteEmail] = useState(''); | ||
const [permission] = useState(Permission.Write); | ||
const [isValidEmail, setIsValidEmail] = useState(true); | ||
const [inviteMethod, setInviteMethod] = useState<InviteMethodType>('email'); | ||
|
||
const handleConfirm = useCallback(() => { | ||
if (inviteMethod === 'link') { | ||
setOpen(false); | ||
return; | ||
} | ||
if (!emailRegex.test(inviteEmail)) { | ||
setIsValidEmail(false); | ||
return; | ||
} | ||
setIsValidEmail(true); | ||
|
||
onConfirm({ | ||
email: inviteEmail, | ||
permission, | ||
}); | ||
notify.success({ | ||
title: t['com.affine.payment.member.team.invite.notify.title'](), | ||
message: t['com.affine.payment.member.team.invite.notify.message'](), | ||
}); | ||
}, [inviteEmail, inviteMethod, onConfirm, permission, setOpen, t]); | ||
|
||
useEffect(() => { | ||
if (!open) { | ||
setInviteEmail(''); | ||
setIsValidEmail(true); | ||
} | ||
}, [open]); | ||
|
||
return ( | ||
<ConfirmModal | ||
width={480} | ||
open={open} | ||
onOpenChange={setOpen} | ||
title={t['com.affine.payment.member.team.invite.title']()} | ||
cancelText={t['com.affine.inviteModal.button.cancel']()} | ||
contentOptions={{ | ||
['data-testid' as string]: 'invite-modal', | ||
style: { | ||
padding: '20px 24px', | ||
}, | ||
}} | ||
confirmText={ | ||
inviteMethod === 'email' | ||
? t['com.affine.payment.member.team.invite.send-invites']() | ||
: t['com.affine.payment.member.team.invite.done']() | ||
} | ||
confirmButtonOptions={{ | ||
loading: isMutating, | ||
variant: 'primary', | ||
}} | ||
onConfirm={handleConfirm} | ||
childrenContentClassName={styles.contentStyle} | ||
> | ||
<ModalContent | ||
inviteEmail={inviteEmail} | ||
setInviteEmail={setInviteEmail} | ||
handleConfirm={handleConfirm} | ||
isMutating={isMutating} | ||
isValidEmail={isValidEmail} | ||
inviteMethod={inviteMethod} | ||
onInviteMethodChange={setInviteMethod} | ||
copyTextToClipboard={copyTextToClipboard} | ||
/> | ||
</ConfirmModal> | ||
); | ||
}; |
Oops, something went wrong.