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

Commit 5c9acc3

Browse files
authored
Merge pull request #5383 from matrix-org/t3chguy/fix/15604
Tweaks to toasts and post-registration landing
2 parents e092929 + 3a6420b commit 5c9acc3

File tree

19 files changed

+284
-60
lines changed

19 files changed

+284
-60
lines changed

res/css/structures/_HomePage.scss

Lines changed: 49 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -50,56 +50,88 @@ limitations under the License.
5050
color: $muted-fg-color;
5151
}
5252

53+
.mx_HomePage_userAvatar {
54+
position: relative;
55+
width: min-content;
56+
margin: 0 auto;
57+
58+
&::before, &::after {
59+
content: '';
60+
position: absolute;
61+
62+
height: 26px;
63+
width: 26px;
64+
65+
right: -6px;
66+
bottom: -6px;
67+
}
68+
69+
&::before {
70+
background-color: $primary-bg-color;
71+
border-radius: 50%;
72+
z-index: 1;
73+
}
74+
75+
&::after {
76+
background-color: $secondary-fg-color;
77+
mask-position: center;
78+
mask-repeat: no-repeat;
79+
mask-image: url('$(res)/img/element-icons/camera.svg');
80+
mask-size: 16px;
81+
z-index: 2;
82+
}
83+
84+
&.mx_HomePage_userAvatar_busy::after {
85+
background: url("$(res)/img/spinner.gif") no-repeat center;
86+
background-size: 80%;
87+
mask: unset;
88+
}
89+
}
90+
5391
.mx_HomePage_default_buttons {
5492
margin: 80px auto 0;
5593
width: fit-content;
5694

5795
.mx_AccessibleButton {
5896
padding: 73px 8px 15px; // top: 20px top padding + 40px icon + 13px margin
5997

60-
width: 104px; // 120px - 2* 8px
61-
margin: 0 39px; // 55px - 2* 8px
98+
width: 160px;
99+
height: 132px;
100+
margin: 0 20px;
62101
position: relative;
63102
display: inline-block;
64103
border-radius: 8px;
65104
vertical-align: top;
66105
word-break: break-word;
106+
box-sizing: border-box;
67107

68108
font-weight: 600;
69109
font-size: $font-15px;
70110
line-height: $font-20px;
71-
color: $muted-fg-color;
72-
73-
&:hover {
74-
color: $accent-color;
75-
background: rgba($accent-color, 0.06);
76-
77-
&::before {
78-
background-color: $accent-color;
79-
}
80-
}
111+
color: #fff; // on all themes
112+
background-color: $accent-color;
81113

82114
&::before {
83115
top: 20px;
84-
left: 40px; // (120px-40px)/2
116+
left: 60px; // (160px-40px)/2
85117
width: 40px;
86118
height: 40px;
87119

88120
content: '';
89121
position: absolute;
90-
background-color: $muted-fg-color;
122+
background-color: #fff; // on all themes
91123
mask-repeat: no-repeat;
92124
mask-size: contain;
93125
}
94126

95127
&.mx_HomePage_button_sendDm::before {
96-
mask-image: url('$(res)/img/feather-customised/message-circle.svg');
128+
mask-image: url('$(res)/img/element-icons/feedback.svg');
97129
}
98130
&.mx_HomePage_button_explore::before {
99-
mask-image: url('$(res)/img/feather-customised/explore.svg');
131+
mask-image: url('$(res)/img/element-icons/roomlist/explore.svg');
100132
}
101133
&.mx_HomePage_button_createGroup::before {
102-
mask-image: url('$(res)/img/feather-customised/group.svg');
134+
mask-image: url('$(res)/img/element-icons/community-members.svg');
103135
}
104136
}
105137
}

res/css/views/rooms/_RoomSublist.scss

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,3 +383,22 @@ limitations under the License.
383383
.mx_RoomSublist_addRoomTooltip {
384384
margin-top: -3px;
385385
}
386+
387+
.mx_RoomSublist_skeletonUI {
388+
position: relative;
389+
margin-left: 4px;
390+
height: 288px;
391+
392+
&::before {
393+
background: $roomsublist-skeleton-ui-bg;
394+
395+
width: 100%;
396+
height: 100%;
397+
398+
content: '';
399+
position: absolute;
400+
mask-repeat: repeat-y;
401+
mask-size: auto 48px;
402+
mask-image: url('$(res)/img/element-icons/roomlist/skeleton-ui.svg');
403+
}
404+
}

res/img/element-icons/camera.svg

Lines changed: 10 additions & 0 deletions
Loading
Lines changed: 5 additions & 0 deletions
Loading

res/themes/dark/css/_dark.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ $roomlist-filter-active-bg-color: $bg-color;
117117
$roomlist-bg-color: rgba(33, 38, 44, 0.90);
118118
$roomlist-header-color: $tertiary-fg-color;
119119
$roomsublist-divider-color: $primary-fg-color;
120+
$roomsublist-skeleton-ui-bg: linear-gradient(180deg, #3e444c 0%, #3e444c00 100%);
120121

121122
$groupFilterPanel-divider-color: $roomlist-header-color;
122123

res/themes/legacy-dark/css/_legacy-dark.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ $roomlist-filter-active-bg-color: $roomlist-button-bg-color;
114114
$roomlist-bg-color: $header-panel-bg-color;
115115

116116
$roomsublist-divider-color: $primary-fg-color;
117+
$roomsublist-skeleton-ui-bg: linear-gradient(180deg, #3e444c 0%, #3e444c00 100%);
117118

118119
$groupFilterPanel-divider-color: $roomlist-header-color;
119120

res/themes/legacy-light/css/_legacy-light.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ $roomlist-filter-active-bg-color: $roomlist-button-bg-color;
181181
$roomlist-bg-color: $header-panel-bg-color;
182182
$roomlist-header-color: $primary-fg-color;
183183
$roomsublist-divider-color: $primary-fg-color;
184+
$roomsublist-skeleton-ui-bg: linear-gradient(180deg, #ffffff 0%, #ffffff00 100%);
184185

185186
$groupFilterPanel-divider-color: $roomlist-header-color;
186187

res/themes/light/css/_light.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ $roomlist-filter-active-bg-color: #ffffff;
175175
$roomlist-bg-color: rgba(245, 245, 245, 0.90);
176176
$roomlist-header-color: $tertiary-fg-color;
177177
$roomsublist-divider-color: $primary-fg-color;
178+
$roomsublist-skeleton-ui-bg: linear-gradient(180deg, #ffffff 0%, #ffffff00 100%);
178179

179180
$groupFilterPanel-divider-color: $roomlist-header-color;
180181

src/BasePlatform.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import {ActionPayload} from "./dispatcher/payloads";
2424
import {CheckUpdatesPayload} from "./dispatcher/payloads/CheckUpdatesPayload";
2525
import {Action} from "./dispatcher/actions";
2626
import {hideToast as hideUpdateToast} from "./toasts/UpdateToast";
27+
import {MatrixClientPeg} from "./MatrixClientPeg";
2728

2829
export const SSO_HOMESERVER_URL_KEY = "mx_sso_hs_url";
2930
export const SSO_ID_SERVER_URL_KEY = "mx_sso_is_url";
@@ -105,6 +106,9 @@ export default abstract class BasePlatform {
105106
* @param newVersion the version string to check
106107
*/
107108
protected shouldShowUpdate(newVersion: string): boolean {
109+
// If the user registered on this client in the last 24 hours then do not show them the update toast
110+
if (MatrixClientPeg.userRegisteredWithinLastHours(24)) return false;
111+
108112
try {
109113
const [version, deferUntil] = JSON.parse(localStorage.getItem(UPDATE_DEFER_KEY));
110114
return newVersion !== version || Date.now() > deferUntil;

src/MatrixClientPeg.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,12 @@ export interface IMatrixClientPeg {
100100
*/
101101
currentUserIsJustRegistered(): boolean;
102102

103+
/**
104+
* If the current user has been registered by this device then this
105+
* returns a boolean of whether it was within the last N hours given.
106+
*/
107+
userRegisteredWithinLastHours(hours: number): boolean;
108+
103109
/**
104110
* Replace this MatrixClientPeg's client with a client instance that has
105111
* homeserver / identity server URLs and active credentials
@@ -150,6 +156,9 @@ class _MatrixClientPeg implements IMatrixClientPeg {
150156

151157
public setJustRegisteredUserId(uid: string): void {
152158
this.justRegisteredUserId = uid;
159+
if (uid) {
160+
window.localStorage.setItem("mx_registration_time", String(new Date().getTime()));
161+
}
153162
}
154163

155164
public currentUserIsJustRegistered(): boolean {
@@ -159,6 +168,15 @@ class _MatrixClientPeg implements IMatrixClientPeg {
159168
);
160169
}
161170

171+
public userRegisteredWithinLastHours(hours: number): boolean {
172+
try {
173+
const date = new Date(window.localStorage.getItem("mx_registration_time"));
174+
return ((new Date().getTime() - date.getTime()) / 36e5) <= hours;
175+
} catch (e) {
176+
return false;
177+
}
178+
}
179+
162180
public replaceUsingCreds(creds: IMatrixClientCreds): void {
163181
this.currentClientCreds = creds;
164182
this.createClient(creds);

0 commit comments

Comments
 (0)