Skip to content

Commit 88d2569

Browse files
committed
Make the loading state more subtle
- instead of a label we show a animated gradient
1 parent 8f9bee7 commit 88d2569

File tree

5 files changed

+38
-9
lines changed

5 files changed

+38
-9
lines changed

locales/en-GB/app.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,6 @@
191191
"expand": "Expand",
192192
"mute_for_me": "Mute for me",
193193
"muted_for_me": "Muted for me",
194-
"volume": "Volume",
195-
"waiting_for_media": "Waiting for media..."
194+
"volume": "Volume"
196195
}
197196
}

src/tile/GridTile.module.css

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ borders don't support gradients */
1818
position: absolute;
1919
z-index: -1; /* Put it below the outline */
2020
opacity: 0; /* Hidden unless speaking */
21-
transition: opacity ease 0.15s;
21+
/* this only animates in one direction. In the other direction,
22+
the background will disappear and the opacity has no effect.*/
23+
transition: opacity ease 0.5s;
2224
inset: calc(-1 * var(--cpd-border-width-4));
2325
border-radius: var(--cpd-space-5x);
2426
background-blend-mode: overlay, normal;
@@ -48,6 +50,11 @@ borders don't support gradients */
4850
outline: var(--cpd-border-width-2) solid var(--cpd-color-bg-canvas-default) !important;
4951
}
5052

53+
.tile.loading {
54+
/* !important because loading border should take priority over hover */
55+
outline: var(--cpd-border-width-2) solid var(--cpd-color-bg-canvas-default) !important;
56+
}
57+
5158
.tile.handRaised::before {
5259
background: linear-gradient(
5360
119deg,
@@ -62,6 +69,31 @@ borders don't support gradients */
6269
opacity: 1;
6370
}
6471

72+
.tile.loading::before {
73+
background: linear-gradient(
74+
var(--angle),
75+
var(--cpd-color-green-900) 0%,
76+
var(--cpd-color-blue-200) 100%
77+
);
78+
opacity: 1;
79+
animation: rotate-gradient linear 2s infinite;
80+
}
81+
82+
@property --angle {
83+
syntax: "<angle>";
84+
inherits: false;
85+
initial-value: 0deg;
86+
}
87+
88+
@keyframes rotate-gradient {
89+
from {
90+
--angle: 0deg;
91+
}
92+
to {
93+
--angle: 360deg;
94+
}
95+
}
96+
6597
@media (hover: hover) {
6698
.tile:hover {
6799
outline: var(--cpd-border-width-2) solid

src/tile/GridTile.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ import {
4242
useDisplayName,
4343
LocalUserMediaViewModel,
4444
RemoteUserMediaViewModel,
45+
EncryptionStatus,
4546
} from "../state/MediaViewModel";
4647
import { Slider } from "../Slider";
4748
import { MediaView } from "./MediaView";
@@ -145,6 +146,7 @@ const UserMediaTile = forwardRef<HTMLDivElement, UserMediaTileProps>(
145146
className={classNames(className, styles.tile, {
146147
[styles.speaking]: showSpeaking,
147148
[styles.handRaised]: !showSpeaking && !!handRaised,
149+
[styles.loading]: encryptionStatus === EncryptionStatus.Connecting,
148150
})}
149151
nameTagLeadingIcon={
150152
<AudioIcon

src/tile/MediaView.test.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,9 @@ describe("MediaView", () => {
7474
render(
7575
<MediaView {...baseProps} video={undefined} localParticipant={false} />,
7676
);
77+
const tile = screen.getByTestId("videoTile");
7778
expect(screen.getByRole("img", { name: "some name" })).toBeVisible();
78-
expect(screen.getByText("video_tile.waiting_for_media")).toBeVisible();
79+
expect(tile.classList).toContain("loading");
7980
});
8081
});
8182

src/tile/MediaView.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,6 @@ export const MediaView = forwardRef<HTMLDivElement, Props>(
120120
/>
121121
)}
122122
</div>
123-
{!video && !localParticipant && (
124-
<div className={styles.status}>
125-
{t("video_tile.waiting_for_media")}
126-
</div>
127-
)}
128123
{/* TODO: Bring this back once encryption status is less broken */}
129124
{/*encryptionStatus !== EncryptionStatus.Okay && (
130125
<div className={styles.status}>

0 commit comments

Comments
 (0)