Skip to content

Commit

Permalink
content: Show spinner for thumbnail placeholders
Browse files Browse the repository at this point in the history
This is a port of zulip/zulip#30477.  That PR isn't yet merged, but
it's been deployed on chat.zulip.org and I believe the styling is
unlikely to change.  (If it does get tweaked, we can always update.)

The placeholder `img` elements already come with a `src` pointing
to this same `loader-black.svg` file, but on the Zulip server.
So the effects of this change are:

 * The placeholder image is local instead of remote, which may
   improve the experience a bit on a slow connection.

 * In dark theme, we use an appropriately contrasting white spinner,
   instead of a black spinner that blends in with the background.

Fixes: zulip#5875
  • Loading branch information
gnprice committed Jul 17, 2024
1 parent f6dc144 commit 5bbbc2b
Show file tree
Hide file tree
Showing 5 changed files with 106 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/webview/css/cssNight.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,7 @@ body {
.highlight {
background-color: hsla(51, 100%, 64%, 0.42);
}
.message_inline_image img.image-loading-placeholder {
content: url("images/loader-white.svg");
}
`;
3 changes: 3 additions & 0 deletions src/webview/static/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,9 @@ time {
height: 160px;
object-fit: scale-down;
}
.message_inline_image img.image-loading-placeholder {
content: url("images/loader-black.svg");
}

.message_inline_video {
position: relative;
Expand Down
49 changes: 49 additions & 0 deletions src/webview/static/images/loader-black.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 49 additions & 0 deletions src/webview/static/images/loader-white.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions tools/build-webview
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ sync "src/webview/static" "${dest}" <<EOF
+ /base.css
+ /images/
+ /images/follow.svg
+ /images/loader-black.svg
+ /images/loader-white.svg
+ /images/play_button.svg
- *
EOF

0 comments on commit 5bbbc2b

Please sign in to comment.