Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Implement hero image and initial checklist version
Browse files Browse the repository at this point in the history
  • Loading branch information
justjanne committed Jul 22, 2022
1 parent 850bbb0 commit a8d7944
Show file tree
Hide file tree
Showing 19 changed files with 811 additions and 5 deletions.
4 changes: 4 additions & 0 deletions res/css/_components.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,10 @@
@import "./views/toasts/_IncomingCallToast.pcss";
@import "./views/toasts/_NonUrgentEchoFailureToast.pcss";
@import "./views/typography/_Heading.pcss";
@import "./views/user-onboarding/_UserOnboardingHeader.pcss";
@import "./views/user-onboarding/_UserOnboardingList.pcss";
@import "./views/user-onboarding/_UserOnboardingPage.pcss";
@import "./views/user-onboarding/_UserOnboardingTask.pcss";
@import "./views/verification/_VerificationShowSas.pcss";
@import "./views/voip/CallView/_CallViewButtons.pcss";
@import "./views/voip/_CallPreview.pcss";
Expand Down
2 changes: 2 additions & 0 deletions res/css/_spacing.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ $spacing-24: 24px;
$spacing-28: 28px;
$spacing-32: 32px;
$spacing-40: 40px;
$spacing-48: 48px;
$spacing-64: 64px;
59 changes: 59 additions & 0 deletions res/css/views/user-onboarding/_UserOnboardingHeader.pcss
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
Copyright 2022 The Matrix.org Foundation C.I.C.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

.mx_UserOnboardingHeader {
display: flex;
flex-direction: row;
padding: $spacing-32;
border-radius: 16px;
background: $system;
gap: $spacing-64;

@media (max-width: 1280px) {
margin: $spacing-32;
}

.mx_UserOnboardingHeader_content {
display: flex;
flex-direction: column;
flex-basis: 50%;
flex-shrink: 1;
flex-grow: 1;
min-width: 0;
gap: $spacing-24;
margin-right: auto;

.mx_AccessibleButton {
margin-top: auto;
align-self: flex-start;
padding: $spacing-12 $spacing-24;
}
}

.mx_UserOnboardingHeader_image {
flex-basis: 30%;
flex-shrink: 1;
flex-grow: 1;
align-self: center;
height: calc(100% + $spacing-64 + $spacing-64);
aspect-ratio: 4 / 3;
object-fit: contain;
min-width: 0;
min-height: 0;
margin-top: -$spacing-64;
margin-bottom: -$spacing-64;
}
}
100 changes: 100 additions & 0 deletions res/css/views/user-onboarding/_UserOnboardingList.pcss
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
/*
Copyright 2022 The Matrix.org Foundation C.I.C.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

.mx_UserOnboardingList {
display: flex;
flex-direction: column;

.mx_UserOnboardingList_header {
display: flex;
flex-direction: row;
gap: 12px;
align-items: center;

animation-duration: 300ms;
animation-timing-function: cubic-bezier(0, 0, 0.58, 1);
animation-name: mx_UserOnboardingList_slideIn;
animation-fill-mode: backwards;
will-change: opacity;
animation-delay: 800ms;

.mx_UserOnboardingList_hint {
color: $secondary-content;
}
}

.mx_UserOnboardingList_progress {
display: flex;
flex-direction: column;

animation-duration: 300ms;
animation-timing-function: cubic-bezier(0, 0, 0.58, 1);
animation-name: mx_UserOnboardingList_slideIn;
animation-fill-mode: backwards;
will-change: opacity;
animation-delay: 1500ms;

.mx_ProgressBar {
width: auto;
margin-top: $spacing-16;
height: 16px;

@mixin ProgressBarBorderRadius 16px;
}

.mx_UserOnboardingFeedback {
margin-top: $spacing-16;
}
}

.mx_UserOnboardingList_list {
display: grid;
grid-template-columns: max-content 1fr max-content;

appearance: none;
list-style: none;
margin: $spacing-32 0 0;
padding: 0;

grid-gap: $spacing-24;

animation-duration: 300ms;
animation-timing-function: cubic-bezier(0, 0, 0.58, 1);
animation-name: mx_UserOnboardingList_slideIn;
animation-fill-mode: backwards;
will-change: opacity;
animation-delay: 2200ms;
}
}

.mx_UserOnboardingList_slideIn {
animation-duration: 300ms;
animation-timing-function: cubic-bezier(0, 0, 0.58, 1);
animation-name: mx_UserOnboardingList_slideIn;
animation-fill-mode: backwards;
will-change: opacity;
}

@keyframes mx_UserOnboardingList_slideIn {
0% {
transform: translate(0, 8px);
opacity: 0;
}
100% {
transform: translate(0, 0);
opacity: 1;
}
}
34 changes: 34 additions & 0 deletions res/css/views/user-onboarding/_UserOnboardingPage.pcss
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
Copyright 2022 The Matrix.org Foundation C.I.C.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

.mx_UserOnboardingPage {
width: 100%;
height: 100%;

align-self: stretch;
margin-bottom: auto;

display: flex;
flex-direction: column;
box-sizing: border-box;

gap: $spacing-64;
padding: $spacing-64 100px;

@media (max-width: 1280px) {
padding: $spacing-48 $spacing-32;
}
}
106 changes: 106 additions & 0 deletions res/css/views/user-onboarding/_UserOnboardingTask.pcss
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
/*
Copyright 2022 The Matrix.org Foundation C.I.C.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

.mx_UserOnboardingTask {
display: contents;

.mx_UserOnboardingTask_number {
grid-column: 1;
color: $secondary-content;
width: 32px;
height: 32px;
text-align: center;
border: 2px solid $quinary-content;
border-radius: 32px;
line-height: 32px;
align-self: center;
position: relative;
}

.mx_UserOnboardingTask_content {
grid-column: 2;
display: flex;
flex-direction: column;
flex-grow: 1;
flex-shrink: 1;

transition: all 500ms;

.mx_UserOnboardingTask_description {
font-size: $font-12px;
}
}

.mx_UserOnboardingTask_action.mx_AccessibleButton {
grid-column: 3;
min-width: 180px;
}

&.mx_UserOnboardingTask_completed {
.mx_UserOnboardingTask_number {
&::before {
content: "";
position: absolute;
inset: -2px;
background: $accent;
border-radius: 32px;

animation-duration: 300ms;
animation-fill-mode: both;
animation-name: mx_UserOnboardingTask_spring;
will-change: opacity, transform;
}

&::after {
background-color: $background;
content: "";
mask-repeat: no-repeat;
mask-position: center;
mask-size: contain;
width: 16px;
height: 16px;
position: absolute;
left: calc(50% - 8px);
top: calc(50% - 8px);
mask-image: url("$(res)/img/element-icons/check-white.svg");

animation-duration: 300ms;
animation-fill-mode: both;
animation-name: mx_UserOnboardingTask_spring;
will-change: opacity, transform;
}
}

.mx_UserOnboardingTask_content {
opacity: 0.6;
}
}
}

@keyframes mx_UserOnboardingTask_spring {
0% {
opacity: 0;
transform: scale(0.6);
}
50% {
opacity: 1;
transform: scale(1.2);
}
100% {
opacity: 1;
transform: scale(1);
}
}
Binary file added res/img/user-onboarding/CommunityMessaging.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 res/img/user-onboarding/PersonalMessaging.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 res/img/user-onboarding/WorkMessaging.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions src/MatrixClientPeg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@ export interface IMatrixClientPeg {
*/
userRegisteredWithinLastHours(hours: number): boolean;

/**
* If the current user has been registered by this device then this
* returns a boolean of whether it was after a given timestamp.
*/
userRegisteredAfter(date: Date): boolean;

/**
* Replace this MatrixClientPeg's client with a client instance that has
* homeserver / identity server URLs and active credentials
Expand Down Expand Up @@ -168,6 +174,15 @@ class MatrixClientPegClass implements IMatrixClientPeg {
}
}

public userRegisteredAfter(timestamp: Date): boolean {
try {
const registrationTime = parseInt(window.localStorage.getItem("mx_registration_time"), 10);
return timestamp.getTime() <= registrationTime;
} catch (e) {
return false;
}
}

public replaceUsingCreds(creds: IMatrixClientCreds): void {
this.currentClientCreds = creds;
this.createClient(creds);
Expand Down
4 changes: 2 additions & 2 deletions src/components/structures/LoggedInView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import { SettingLevel } from "../../settings/SettingLevel";
import ResizeHandle from '../views/elements/ResizeHandle';
import { CollapseDistributor, Resizer } from '../../resizer';
import MatrixClientContext from "../../contexts/MatrixClientContext";
import HomePage from "./HomePage";
import ResizeNotifier from "../../utils/ResizeNotifier";
import PlatformPeg from "../../PlatformPeg";
import { DefaultTagID } from "../../stores/room-list/models";
Expand Down Expand Up @@ -71,6 +70,7 @@ import { SwitchSpacePayload } from "../../dispatcher/payloads/SwitchSpacePayload
import LegacyGroupView from "./LegacyGroupView";
import { IConfigOptions } from "../../IConfigOptions";
import LeftPanelLiveShareWarning from '../views/beacon/LeftPanelLiveShareWarning';
import { UserOnboardingPage } from '../views/user-onboarding/UserOnboardingPage';

// We need to fetch each pinned message individually (if we don't already have it)
// so each pinned message may trigger a request. Limit the number per room for sanity.
Expand Down Expand Up @@ -635,7 +635,7 @@ class LoggedInView extends React.Component<IProps, IState> {
break;

case PageTypes.HomePage:
pageElement = <HomePage justRegistered={this.props.justRegistered} />;
pageElement = <UserOnboardingPage justRegistered={this.props.justRegistered} />;
break;

case PageTypes.UserView:
Expand Down
4 changes: 2 additions & 2 deletions src/components/structures/UserView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ import { RoomMember } from "matrix-js-sdk/src/models/room-member";
import { MatrixClientPeg } from "../../MatrixClientPeg";
import Modal from '../../Modal';
import { _t } from '../../languageHandler';
import HomePage from "./HomePage";
import ErrorDialog from "../views/dialogs/ErrorDialog";
import MainSplit from "./MainSplit";
import RightPanel from "./RightPanel";
import Spinner from "../views/elements/Spinner";
import ResizeNotifier from "../../utils/ResizeNotifier";
import { RightPanelPhases } from "../../stores/right-panel/RightPanelStorePhases";
import { UserOnboardingPage } from "../views/user-onboarding/UserOnboardingPage";

interface IProps {
userId?: string;
Expand Down Expand Up @@ -92,7 +92,7 @@ export default class UserView extends React.Component<IProps, IState> {
resizeNotifier={this.props.resizeNotifier}
/>;
return (<MainSplit panel={panel} resizeNotifier={this.props.resizeNotifier}>
<HomePage />
<UserOnboardingPage />
</MainSplit>);
} else {
return (<div />);
Expand Down
Loading

0 comments on commit a8d7944

Please sign in to comment.