-
Notifications
You must be signed in to change notification settings - Fork 40
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
[MS] User details modal #6000
Merged
Merged
[MS] User details modal #6000
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 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,190 @@ | ||
<!-- Parsec Cloud (https://parsec.cloud) Copyright (c) BUSL-1.1 2016-present Scille SAS --> | ||
|
||
<template> | ||
<ion-page class="modal"> | ||
<ms-modal | ||
:title="$t('UsersPage.UserDetailsModal.title')" | ||
:close-button="{ visible: true }" | ||
> | ||
<div class="details"> | ||
<div class="details-name"> | ||
<ion-text class="button-small"> | ||
{{ $t('UsersPage.UserDetailsModal.subtitles.name') }} | ||
</ion-text> | ||
<ion-text class="details-name__fullname subtitles-normal"> | ||
{{ user.humanHandle.label }} | ||
</ion-text> | ||
</div> | ||
<div class="details-joined"> | ||
<ion-text class="button-small"> | ||
{{ $t('UsersPage.UserDetailsModal.subtitles.joined') }} | ||
</ion-text> | ||
<ion-text class="details-joined__date body-lg"> | ||
{{ timeSince(user.createdOn, '--', 'short') }} | ||
</ion-text> | ||
</div> | ||
</div> | ||
<div> | ||
<ion-chip | ||
v-if="user.isRevoked()" | ||
color="danger" | ||
> | ||
<ion-icon | ||
:icon="ellipse" | ||
class="revoked" | ||
/> | ||
<ion-label> | ||
{{ $t('UsersPage.UserDetailsModal.subtitles.revoked') }} | ||
</ion-label> | ||
</ion-chip> | ||
</div> | ||
<ion-list> | ||
<ion-text class="button-small"> | ||
{{ $t('UsersPage.UserDetailsModal.subtitles.commonWorkspaces') }} | ||
</ion-text> | ||
<ion-card | ||
v-for="workspace in workspaces" | ||
:key="workspace.id" | ||
:disabled="user.isRevoked()" | ||
class="workspace-card" | ||
> | ||
<ion-card-content> | ||
<ion-avatar class="card-content-icons"> | ||
<ion-icon | ||
class="card-content-icons__item" | ||
:icon="business" | ||
/> | ||
<ion-icon | ||
class="cloud-overlay" | ||
:class="workspace.availableOffline ? 'cloud-overlay-ok' : 'cloud-overlay-ko'" | ||
:icon="workspace.availableOffline ? cloudDone : cloudOffline" | ||
/> | ||
<ion-text class="workspace-name cell"> | ||
{{ workspace.name }} | ||
</ion-text> | ||
<workspace-tag-role :role="workspace.role" /> | ||
</ion-avatar> | ||
</ion-card-content> | ||
</ion-card> | ||
</ion-list> | ||
<ion-button | ||
class="close-button" | ||
@click="cancel" | ||
> | ||
{{ $t('UsersPage.UserDetailsModal.actions.close') }} | ||
</ion-button> | ||
</ms-modal> | ||
</ion-page> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { Formatters, FormattersKey } from '@/common/injectionKeys'; | ||
import { MsModal } from '@/components/core'; | ||
import { MsModalResult } from '@/components/core/ms-modal/types'; | ||
import WorkspaceTagRole from '@/components/workspaces/WorkspaceTagRole.vue'; | ||
import { UserInfo, WorkspaceRole } from '@/parsec'; | ||
import { | ||
IonAvatar, | ||
IonButton, | ||
IonCard, | ||
IonCardContent, | ||
IonChip, | ||
IonIcon, | ||
IonLabel, | ||
IonList, | ||
IonPage, | ||
IonText, | ||
modalController, | ||
} from '@ionic/vue'; | ||
import { business, cloudDone, cloudOffline, ellipse } from 'ionicons/icons'; | ||
import { defineProps, inject } from 'vue'; | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ||
const { timeSince } = inject(FormattersKey)! as Formatters; | ||
const workspaces = [ | ||
{ | ||
id: 'fake1', | ||
name: 'Workspace1', | ||
role: WorkspaceRole.Owner, | ||
availableOffline: true, | ||
}, | ||
{ | ||
id: 'fake2', | ||
name: 'Workspace2', | ||
role: WorkspaceRole.Contributor, | ||
availableOffline: false, | ||
}, | ||
]; | ||
|
||
defineProps<{ | ||
user: UserInfo; | ||
}>(); | ||
|
||
async function cancel(): Promise<boolean> { | ||
return await modalController.dismiss(null, MsModalResult.Cancel); | ||
} | ||
</script> | ||
|
||
<style lang="scss" scoped> | ||
.details { | ||
display: flex; | ||
margin-bottom: 1rem; | ||
.details-name { | ||
display: flex; | ||
flex-direction: column; | ||
width: 50%; | ||
gap: 0.5rem; | ||
} | ||
.details-joined { | ||
display: flex; | ||
flex-direction: column; | ||
width: 50%; | ||
gap: 0.5rem; | ||
} | ||
} | ||
.workspace-name { | ||
margin-left: 1rem; | ||
margin-right: auto; | ||
} | ||
.close-button { | ||
display: flex; | ||
margin-left: auto; | ||
width: fit-content; | ||
} | ||
.card-content-icons { | ||
margin: 0 auto 0.5rem; | ||
position: relative; | ||
height: fit-content; | ||
display: flex; | ||
justify-content: left; | ||
align-items: center; | ||
color: var(--parsec-color-light-primary-900); | ||
width: 100%; | ||
|
||
&__item { | ||
font-size: 2rem; | ||
} | ||
|
||
.cloud-overlay { | ||
position: absolute; | ||
font-size: 1rem; | ||
bottom: -10px; | ||
left: 4%; | ||
padding: 2px; | ||
background: white; | ||
border-radius: 50%; | ||
} | ||
|
||
.cloud-overlay-ok { | ||
color: var(--parsec-color-light-primary-500); | ||
} | ||
|
||
.cloud-overlay-ko { | ||
color: var(--parsec-color-light-secondary-text); | ||
} | ||
} | ||
.revoked { | ||
font-size: 0.5rem; | ||
margin-right: 0.5rem; | ||
} | ||
</style> |
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,35 @@ | ||
// Parsec Cloud (https://parsec.cloud) Copyright (c) BUSL-1.1 2016-present Scille SAS | ||
|
||
describe('Check user details modal', () => { | ||
beforeEach(() => { | ||
cy.visitApp(); | ||
cy.login('Boby', 'P@ssw0rd.'); | ||
cy.get('.organization-card__manageBtn').click(); | ||
cy.get('.users-container').find('.user-list-item').eq(2).find('.options-button').invoke('show').click(); | ||
cy.get('.user-context-menu').find('.menu-list').find('ion-item').as('menuItems'); | ||
cy.get('@menuItems').eq(3).contains('View details').click(); | ||
}); | ||
|
||
afterEach(() => { | ||
cy.dropTestbed(); | ||
}); | ||
|
||
it('Tests user details modal', () => { | ||
cy.get('.user-details-modal').as('modal').find('ion-header').contains('User details'); | ||
cy.get('@modal').find('.ms-modal-content').as('modal-content').find('ion-text').eq(0).contains('Name'); | ||
// cspell:disable-next-line | ||
cy.get('@modal-content').find('ion-text').eq(1).contains('Jaheira'); | ||
cy.get('@modal-content').find('ion-text').eq(2).contains('Joined'); | ||
cy.get('@modal-content').find('ion-text').eq(3).contains('one second ago'); | ||
cy.get('@modal-content').find('ion-text').eq(4).contains('Shared workspaces'); | ||
cy.get('@modal-content').find('ion-list').find('ion-card').as('workspace-cards').should('have.length', 2); | ||
cy.get('@workspace-cards').eq(0).find('ion-text').contains('Workspace1'); | ||
cy.get('@workspace-cards').eq(0).find('ion-icon').should('exist'); | ||
cy.get('@workspace-cards').eq(0).find('ion-label').contains('Owner'); | ||
cy.get('@workspace-cards').eq(1).find('ion-text').contains('Workspace2'); | ||
cy.get('@workspace-cards').eq(1).find('ion-icon').should('exist'); | ||
cy.get('@workspace-cards').eq(1).find('ion-label').contains('Contributor'); | ||
cy.get('@modal-content').find('ion-button').contains('Close').click(); | ||
Ironicbay marked this conversation as resolved.
Show resolved
Hide resolved
|
||
cy.get('@modal').should('not.exist'); | ||
}); | ||
}); |
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.
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.
where is it coming from? copy/paste? is there a specific reflexion behind these values?
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.
These values are taken from the mockups, I was unsure if setting them explicitly was necessary or not (and now that you mention it, the
height
value is different in therevoked
mockup so I'm guessing it's not)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 in lots of cases the modal will fits its content and it will be good enough.
@fabienSvtr a thought on this?
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.
We need to open an issue to harmonise all modal width. For this PR you can let the specific value.
I recently updated the Figma with width variables for that.