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

Introduce skeleton preview of profile page #620

Closed
wants to merge 1 commit into from
Closed
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
23 changes: 23 additions & 0 deletions src/components/_mixins/SkeletonMixin.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<script>
export default {
mounted() {
this.$nextTick(() => {
this.nextSkeletonHeight = getComputedStyle(this.$el).getPropertyValue(
'height',
);
});
},
updated() {
this.$nextTick(() => {
if (this.skeleton) {
this.$el.style.height = this.nextSkeletonHeight;
} else {
this.$el.style.height = null;
this.nextSkeletonHeight = getComputedStyle(this.$el).getPropertyValue(
'height',
);
}
});
},
};
</script>
18 changes: 17 additions & 1 deletion src/components/profile/Profile.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
<template>
<main class="profile">
<main v-if="skeleton" class="profile profile--skeleton">
<div class="profile__section" aria-hidden="true">
<ViewPersonalInfo :skeleton="true" />
</div>
<ProfileNav :links="profileNav" aria-hidden="true"></ProfileNav>
<ProfileSection :skeleton="true" aria-hidden="true" />
<p class="visually-hidden">{{ fluent('loading-profile') }}</p>
</main>
<main v-else class="profile">
<div
:class="
'profile__section' +
Expand Down Expand Up @@ -287,6 +295,7 @@ export default {
primaryUsername: Object,
viewAs: Boolean,
allowStaffOnlyFields: Boolean,
skeleton: Boolean,
},
mixins: [AccountsMixin],
components: {
Expand Down Expand Up @@ -452,4 +461,11 @@ export default {
top: -7em;
}
}

.profile__section--skeleton .profile__section-header h2 {
height: 1.4em;
}
.profile__section--skeleton p {
height: 1.4em;
}
</style>
36 changes: 34 additions & 2 deletions src/components/profile/ProfilePreview.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
<template>
<div class="profile-preview" ref="profilePreviewElement" tabindex="-1">
<div v-if="skeleton" class="profile-preview profile-preview__skeleton">
<div class="profile-preview__image">
<div
class="button button--icon-only button--secondary profile-preview__close"
>
<svg
aria-hidden="true"
role="presentation"
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
focusable="false"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<line x1="18" y1="6" x2="6" y2="18" />
<line x1="6" y1="6" x2="18" y2="18" />
</svg>
</div>
<UserPicture :size="100" :avatar="{ picture: 'empty:' }" />
</div>
</div>
<div v-else class="profile-preview" ref="profilePreviewElement" tabindex="-1">
<button
v-if="desktopView"
@click="$emit('close')"
Expand Down Expand Up @@ -66,6 +92,7 @@

<script>
import CompanyMixin from '@/components/_mixins/CompanyMixin.vue';
import SkeletonMixin from '@/components/_mixins/SkeletonMixin.vue';
import ContactMe from '@/components/ui/ContactMe.vue';
import UserPicture from '@/components/ui/UserPicture.vue';
import ProfileDescription from './ProfileDescription.vue';
Expand All @@ -75,7 +102,7 @@ import ProfileTeamLocation from './ProfileTeamLocation.vue';
import Icon from '@/components/ui/Icon.vue';

export default {
mixins: [CompanyMixin],
mixins: [CompanyMixin, SkeletonMixin],
name: 'ProfilePreview',
props: {
staffInformation: Object,
Expand All @@ -93,6 +120,7 @@ export default {
uris: Object,
userId: Object,
desktopView: Boolean,
skeleton: Boolean,
},
components: {
ContactMe,
Expand Down Expand Up @@ -127,6 +155,10 @@ export default {
position: relative;
border-radius: var(--cardRadius);
}
.profile-preview__skeleton {
width: 30em;
height: 40em;
}
.profile-preview .profile__name {
display: block;
margin-bottom: 0.5em;
Expand Down
2 changes: 2 additions & 0 deletions src/components/profile/ProfileSection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export default {
messageNoLdap: String,
isLdap: Boolean,
editing: Boolean,
skeleton: Boolean,
},
components: { EditButton, EmptyCard, PanelSection },
computed: {
Expand All @@ -58,6 +59,7 @@ export default {
profile__section: true,
'profile__section--editing': this.editing,
'profile__section--disabled': !this.editing && this.empty,
'profile__section--skeleton': this.skeleton,
};
},
needsLdap() {
Expand Down
11 changes: 10 additions & 1 deletion src/components/profile/view/ViewPersonalInfo.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
<template>
<div class="profile__intro">
<div v-if="skeleton" class="profile__intro">
<div class="profile__intro-photo">
<div class="profile__headshot">
<UserPicture :avatar="{ picture: 'empty:' }" :size="264"></UserPicture>
</div>
</div>
</div>
<div v-else class="profile__intro">
<EditButton
v-if="userOnOwnProfile && editable"
:sendTo="{
Expand Down Expand Up @@ -99,6 +106,7 @@
<script>
import CompanyMixin from '@/components/_mixins/CompanyMixin.vue';
import OfficesMixin from '@/components/_mixins/OfficesMixin.vue';
import SkeletonMixin from '@/components/_mixins/SkeletonMixin.vue';
import ContactMe from '@/components/ui/ContactMe.vue';
import EditButton from '@/components/ui/EditButton.vue';
import Icon from '@/components/ui/Icon.vue';
Expand Down Expand Up @@ -135,6 +143,7 @@ export default {
userOnOwnProfile: Boolean,
editable: Boolean,
accessInformation: Object,
skeleton: Boolean,
},
components: {
ContactMe,
Expand Down
8 changes: 5 additions & 3 deletions src/locales/en-US/strings.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ onboarding_modal_username = Getting started
.staff_1 = As a member of Mozilla staff, you were automatically assigned a username when we created your profile. You haven’t changed it so far. Due to the platform now being publicly accessible, we would like you to either choose a username to your liking or confirm the newly auto-generated one below.
.staff_2 = Your username is <strong>publicly visible</strong> and included in your profile URL.
.paragraph_1 = Before you explore your profile, we would like you to choose a username or confirm the one we generated for you.<br /> Your username is <strong>publicly visible</strong> and included in your profile URL.
.paragraph_2 = <strong>Pro tip:</strong> Use the same username across systems for easy discovery (e.g. Slack, Discourse).
.paragraph_2 = <strong>Pro tip:</strong> Use the same username across systems for easy discovery (e.g. Slack, Discourse).
.restriction = Minimum length is 3, allowed characters are: a-z, 0-9, _ and -.
.username_exists = Username {$username} exists already, please choose another username.
.username_invalid_chars = Username must not contain spaces or uppercase characters
Expand Down Expand Up @@ -145,6 +145,8 @@ orgchart_full-profile = View full profile

profile = Profile

profile_loading = Loading profile…

profile_preview = Preview As
profile_preview_active = Previewing profile as
profile_preview_myself = Myself
Expand Down Expand Up @@ -438,11 +440,11 @@ access-group_request = Request Invitation
access-group_request-cancel = Cancel Request
access-group-nav-bar = Access Groups
access-group_membership-management = Membership Management
.mozillians = <strong>{$mozilliansCount}</strong> {$mozilliansCount ->
.mozillians = <strong>{$mozilliansCount}</strong> {$mozilliansCount ->
[one] mozillian
*[other] mozillians
}
.members-will = <strong>{$membersCount}</strong> {$membersCount ->
.members-will = <strong>{$membersCount}</strong> {$membersCount ->
[one] member
*[other] members
} will
Expand Down
10 changes: 6 additions & 4 deletions src/pages/PageOrgchart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,13 @@
:query="previewProfileQuery"
:variables="{ username }"
:tag="null"
:notifyOnNetworkStatusChange="true"
>
<template slot-scope="{ result: { data } }">
<template slot-scope="{ result: { loading, data } }">
<div class="org-chart__preview">
<ProfilePreview v-if="loading" :skeleton="true"></ProfilePreview>
<ProfilePreview
v-if="data && desktopView"
v-else-if="data && desktopView"
v-bind="data.profile"
:desktopView="desktopView"
@close="closeProfile"
Expand Down Expand Up @@ -490,7 +492,7 @@ export default {
.org-chart {
padding: 2em;
display: grid;
grid-template-columns: minmax(25em, 45em) auto;
grid-template-columns: 1fr auto;
grid-template-rows: auto 1fr;
align-items: start;
grid-gap: 2em;
Expand All @@ -509,6 +511,7 @@ export default {
.org-chart__preview {
grid-row: 1 / 2;
grid-column: 2 / 3;
max-width: 30em;
}
}
@media (min-height: 36em) and (min-width: 57.5em) {
Expand All @@ -521,7 +524,6 @@ export default {

.org-root {
width: 100%;
max-width: 45em;
background-image: linear-gradient(
var(--gray-10) 0,
var(--gray-10) 50%,
Expand Down
2 changes: 1 addition & 1 deletion src/pages/PageProfile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
:viewAsFilter="viewAs"
:viewAsActive="variables.viewAsActive"
></PreviewAs>
<LoadingSpinner v-if="loading"></LoadingSpinner>
<Profile v-if="loading" :skeleton="true" />
<template v-else-if="data && data.profile !== null">
<Profile
v-bind="data.profile"
Expand Down