-
Notifications
You must be signed in to change notification settings - Fork 34
[PB-6433]: feature/design for request access to shared item flow #1966
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| import { Tray } from '@phosphor-icons/react'; | ||
| import { useTranslationContext } from 'app/i18n/provider/TranslationProvider'; | ||
|
|
||
| const AccessRequestsEmptyState = () => { | ||
| const { translate } = useTranslationContext(); | ||
| return ( | ||
| <div className="flex flex-col items-center justify-center h-full"> | ||
| <Tray size={64} className="text-primary" /> | ||
| <p className="text-lg font-medium text-gray-100">{translate('modals.shareModal.requests.empty')}</p> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export default AccessRequestsEmptyState; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| import AccessRequestsEmptyState from './empty'; | ||
| import AccessRequestsList from './list'; | ||
|
|
||
| const AccessRequests = () => { | ||
| const mockedRequests = [ | ||
| { | ||
| user: { | ||
| name: 'John Doe', | ||
| email: '4V0oX@example.com', | ||
| avatar: 'https://i.pravatar.cc/150?u=a042581f4e29026024d', | ||
| }, | ||
| message: 'Hello there', | ||
| onDecline: () => {}, | ||
| onAccept: () => {}, | ||
| }, | ||
| ]; | ||
|
|
||
| if (mockedRequests.length === 0) { | ||
| return ( | ||
| <div className="flex flex-1 flex-col justify-center"> | ||
| <AccessRequestsEmptyState /> | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| return ( | ||
| <div className="flex min-h-[430px] flex-col items-center w-full"> | ||
| <AccessRequestsList accessRequestList={mockedRequests} /> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export default AccessRequests; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| import { Avatar, Button } from '@internxt/ui'; | ||
| import { useTranslationContext } from 'app/i18n/provider/TranslationProvider'; | ||
|
|
||
| interface AccessRequestItem { | ||
| user: { | ||
| name: string; | ||
| email: string; | ||
| avatar: string; | ||
| }; | ||
| message?: string; | ||
| onDecline: () => void; | ||
| onAccept: () => void; | ||
| } | ||
|
|
||
| const RequestCheap = ({ user, message, onDecline, onAccept }: AccessRequestItem) => { | ||
| const { translate } = useTranslationContext(); | ||
| return ( | ||
| <div className="flex flex-col gap-3.5 border-b border-gray-10 pb-3.5 last:border-b-0 last:pb-0"> | ||
| <div className="flex flex-row justify-between"> | ||
| {/* User info */} | ||
| <div className="flex flex-row"> | ||
| <Avatar diameter={32} fullName={user.name} src={user.avatar} /> | ||
| <div className="flex flex-col"> | ||
| <p className="font-medium text-gray-100">{user.name}</p> | ||
| <p className="text-sm text-gray-50">{user.email}</p> | ||
| </div> | ||
| </div> | ||
|
|
||
| <div className="flex flex-row gap-2"> | ||
| <Button variant="secondary" onClick={onDecline}> | ||
| {translate('modals.shareModal.requests.actions.deny')} | ||
| </Button> | ||
| {/* TODO: Add a dropdown to select the user role */} | ||
|
Check warning on line 33 in src/app/drive/components/ShareDialog/components/AccessRequests/list/index.tsx
|
||
| <Button variant="primary" onClick={onAccept}> | ||
| {translate('modals.shareModal.requests.actions.accept')} | ||
| </Button> | ||
| </div> | ||
| </div> | ||
|
|
||
| <div className="flex bg-gray-5 p-4 rounded-lg"> | ||
| <p>{message}</p> | ||
| </div> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| const AccessRequestsList = ({ accessRequestList }: { accessRequestList: AccessRequestItem[] }) => { | ||
| return ( | ||
| <div className="flex flex-col w-full"> | ||
| {accessRequestList.map((request, index) => ( | ||
| <RequestCheap key={index} {...request} /> | ||
|
Check warning on line 51 in src/app/drive/components/ShareDialog/components/AccessRequests/list/index.tsx
|
||
| ))} | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export default AccessRequestsList; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| import { UserSettings } from '@internxt/sdk/dist/shared/types/userSettings'; | ||
| import { useTranslationContext } from 'app/i18n/provider/TranslationProvider'; | ||
| import { Button } from '@internxt/ui'; | ||
|
|
||
| interface RequestAccessUserCardProps { | ||
| user: UserSettings | undefined; | ||
| onChangeAccount: () => void; | ||
| } | ||
|
|
||
| const TEXTAREA_MAX_LENGTH = 1000; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this constant is not used in the component |
||
|
|
||
| const UserCheapCard = ({ user, onChangeAccount }: Readonly<RequestAccessUserCardProps>): JSX.Element => { | ||
| const { translate } = useTranslationContext(); | ||
|
|
||
| return ( | ||
| <div className="request-access-user-container mt-4 w-full rounded-2xl bg-surface p-5 text-gray-100 transition-all duration-100 ease-out sm:shadow-subtle-hard"> | ||
| <div className="flex w-full items-center justify-between"> | ||
| <div className="mr-4 flex-1"> | ||
| <p className="text-sm font-medium">{translate('modals.shareModal.requestAccess.logged')}</p> | ||
| <p | ||
| className="font-regular mt-0.5 flex-1 truncate text-base text-gray-50" | ||
| style={{ maxWidth: '167px' }} | ||
| title={user?.email} | ||
| > | ||
| {user?.email} | ||
| </p> | ||
| </div> | ||
| <Button variant="secondary" className="cursor-pointer" onClick={onChangeAccount}> | ||
| {translate('modals.shareModal.requestAccess.change')} | ||
| </Button> | ||
| </div> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export default UserCheapCard; | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have some sonar cloud warnings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. The design/components are added but not used (so we do not break the current flow for now). This way, we just need to add the logic and this design later and that's it.
They will be fixed later when completing the task.