Skip to content
This repository has been archived by the owner on Aug 10, 2023. It is now read-only.

Make sticker picker mobile friendlier and fix sending from Riot Mobile #296

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions web/app/shared/services/scalar/scalar-widget.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export class ScalarWidgetApi {
data: {
description: sticker.description,
content: {
body: sticker.description,
turt2live marked this conversation as resolved.
Show resolved Hide resolved
url: sticker.thumbnail.mxc,
info: {
mimetype: sticker.image.mimetype,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<div class="stickers">
<div class="sticker" *ngFor="let sticker of pack.stickers trackById"
(click)="sendSticker(sticker, pack)">
<img [src]="getThumbnailUrl(sticker.thumbnail.mxc, 48, 48)" width="48" height="48" class="image"
<img [src]="getThumbnailUrl(sticker.thumbnail.mxc, 48, 48)" class="image"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't lose the width and height because the media repo is not guaranteed to return the size we requested. It can return (much) larger images.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like that the thumbnails never load as 48x48 but as 240x240 on my end anyway. The CSS guarantees that the image always resizes itself to fit in the sticker square for all screen sizes as setting 48x48 statically made it very small on mobile. I can re-add height/width HTML back, but from trying it out quickly it doesn't have any effect as the CSS already overrides it.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, I'll take a look at this too then.

[alt]="sticker.name" [ngbTooltip]="sticker.name" placement="bottom"/>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,20 @@
margin-top: 15px;
margin-left: 3px;

@media screen and (max-resolution: 96dpi), (min-width: 740px) {
.title {
font-size: 3em;
}

.license {
font-size: 1.8em;
}

.author {
font-size: 1.8em;
}
}

.title {
font-weight: 700;
color: themed(stickerPickerTitleColor);
Expand Down Expand Up @@ -81,16 +95,31 @@
.stickers {
display: flex;
flex-wrap: wrap;
align-content: flex-start;
justify-content: space-between;

&:after {
content: "";
flex: auto;
flex-basis: 18%;
}

.sticker {
padding: 5px;
flex-grow: 1;
flex-basis: 18%;
max-width: 18%;
margin: 2px;
cursor: pointer;
border-radius: 3px;
background-color: themed(stickerPickerStickerBgColor);
box-shadow: 0 2px 6px themed(stickerPickerShadowColor);

img {
height: 100%;
width: 100%;
}
}
}
}
}
}
}