Skip to content
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 list responsive #9912

Merged
merged 1 commit into from
Mar 13, 2025
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
20 changes: 0 additions & 20 deletions client/src/components/files/FileListItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -228,26 +228,6 @@ async function onOptionsClick(event: PointerEvent): Promise<void> {
}
}

.file-options {
ion-button::part(native) {
padding: 0;
}

.options-button {
--background-hover: none;

&__icon {
color: var(--parsec-color-light-secondary-grey);
}

&:hover {
.options-button__icon {
color: var(--parsec-color-light-primary-500);
}
}
}
}

.file-list-item-mobile {
overflow: hidden;
text-overflow: ellipsis;
Expand Down
143 changes: 74 additions & 69 deletions client/src/components/users/UserListItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<div class="user-selected">
<!-- eslint-disable vue/no-mutating-props -->
<ms-checkbox
:class="{ 'checkbox-mobile': isSmallDisplay }"
v-model="user.isSelected"
v-show="user.isSelected || isHovered || showCheckbox"
v-if="!user.isRevoked() && !user.isCurrent"
Expand All @@ -30,10 +31,12 @@
</div>

<!-- user name -->
<div class="user-name">
<div
class="user-name"
v-if="isLargeDisplay"
>
<ion-label class="user-name__label cell">
<user-avatar-name
class="main-cell"
:user-avatar="user.humanHandle.label"
:user-name="user.humanHandle.label"
/>
Expand All @@ -45,6 +48,38 @@
</span>
</ion-label>
</div>
<div
class="user-mobile"
v-if="isSmallDisplay"
>
<user-avatar-name
:user-avatar="user.humanHandle.label"
class="user-mobile-avatar"
:class="{
'hide-avatar': showCheckbox && !user.isRevoked() && !user.isCurrent,
'disable-avatar': user.isRevoked() || user.isCurrent,
}"
/>
<div class="user-mobile-text">
<ion-text class="button-medium user-mobile-text__name">{{ user.humanHandle.label }}</ion-text>
<ion-text class="cell user-mobile-text__email">
{{ user.humanHandle.email }}
</ion-text>
<div class="user-mobile-text__profile-status">
<tag-profile
:profile="user.currentProfile"
class="user-mobile-text__profile"
/>
<user-status-tag
:revoked="user.isRevoked()"
:frozen="user.isFrozen()"
:show-tooltip="true"
v-if="!user.isActive()"
class="user-mobile-text__status"
/>
</div>
</div>
</div>

<!-- user profile -->
<div class="user-profile">
Expand Down Expand Up @@ -80,7 +115,7 @@
<!-- options -->
<div class="user-options ion-item-child-clickable">
<ion-button
v-show="(isHovered || menuOpened) && !user.isCurrent"
v-show="(isHovered || menuOpened || isSmallDisplay) && !user.isCurrent"
fill="clear"
class="options-button"
@click.stop="onOptionsClick($event)"
Expand All @@ -96,17 +131,18 @@
</template>

<script setup lang="ts">
import { formatTimeSince, MsCheckbox } from 'megashark-lib';
import { formatTimeSince, MsCheckbox, useWindowSize } from 'megashark-lib';
import TagProfile from '@/components/users/TagProfile.vue';
import UserAvatarName from '@/components/users/UserAvatarName.vue';
import UserStatusTag from '@/components/users/UserStatusTag.vue';
import { UserModel } from '@/components/users/types';
import { IonButton, IonIcon, IonItem, IonLabel } from '@ionic/vue';
import { IonButton, IonIcon, IonItem, IonLabel, IonText } from '@ionic/vue';
import { ellipsisHorizontal } from 'ionicons/icons';
import { ref } from 'vue';

const isHovered = ref(false);
const menuOpened = ref(false);
const { isLargeDisplay, isSmallDisplay } = useWindowSize();

const props = defineProps<{
user: UserModel;
Expand Down Expand Up @@ -134,93 +170,62 @@ async function onOptionsClick(event: Event): Promise<void> {
</script>

<style scoped lang="scss">
.user-selected {
min-width: 4rem;
justify-content: end;
width: auto;
}

.user-name {
padding: 0.5rem 1rem;
width: auto;
flex-grow: 1;
min-width: 11.25rem;
max-width: 25rem;

&__label {
display: flex;
align-items: center;
gap: 0.5rem;
overflow: hidden;

.main-cell {
white-space: nowrap;
overflow: hidden;
}
}

&__you {
color: var(--parsec-color-light-primary-600);
}
}

.user-profile {
min-width: 11.5rem;
max-width: 10vw;
width: auto;
flex-grow: 2;
}

.user-email {
max-width: 16rem;
min-width: 16rem;
flex-grow: 0;
color: var(--parsec-color-light-secondary-grey);
overflow: hidden;

&__label {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}

.user-status {
min-width: 8rem;
width: auto;
flex-grow: 0;
color: var(--parsec-color-light-secondary-grey);
}
.user-mobile {
display: flex;
align-items: center;
width: 100%;
gap: 0.75rem;
padding: 0.75rem 0.5rem;

.user-join {
min-width: 11.25rem;
flex-grow: 0;
overflow: hidden;
color: var(--parsec-color-light-secondary-grey);
}
.user-mobile-avatar {
padding: 0.5rem;

.user-options {
min-width: 4rem;
width: auto;
flex-grow: 0;
margin-left: auto;
&.hide-avatar {
opacity: 0;
}

ion-button::part(native) {
padding: 0;
&.disable-avatar {
filter: grayscale(100%);
opacity: 0.6;
}
}

.options-button {
--background-hover: none;
&-text {
display: flex;
flex-direction: column;
gap: 0.375rem;

&__name {
color: var(--parsec-color-light-secondary-text);
}

&__icon {
&__email {
color: var(--parsec-color-light-secondary-grey);
}

&:hover {
.options-button__icon {
color: var(--parsec-color-light-primary-500);
}
&__profile-status {
display: flex;
gap: 0.5rem;
}
}
}

.user-status,
.user-join,
.user-email {
color: var(--parsec-color-light-secondary-grey);
}
</style>
Loading
Loading