Allow custom emoji reactions: add option to scale reaction buttons

This commit is contained in:
Alexander Tumin 2023-03-17 23:30:46 +03:00
parent 832019b2c2
commit 3403f6a1ed
5 changed files with 32 additions and 11 deletions

View File

@ -12,20 +12,20 @@
@mouseenter="fetchEmojiReactionsByIfMissing()" @mouseenter="fetchEmojiReactionsByIfMissing()"
> >
<span <span
v-if="reaction.url"
class="reaction-emoji" class="reaction-emoji"
> >
<img <img
v-if="reaction.url"
:src="reaction.url" :src="reaction.url"
:title="reaction.name" :title="reaction.name"
class="reaction-emoji-content" class="reaction-emoji-content"
width="1em" width="1em"
> >
<span
v-else
class="reaction-emoji reaction-emoji-content"
>{{ reaction.name }}</span>
</span> </span>
<span
v-else
class="reaction-emoji reaction-emoji-content"
>{{ reaction.name }}</span>
<span>{{ reaction.count }}</span> <span>{{ reaction.count }}</span>
</button> </button>
</UserListPopover> </UserListPopover>
@ -49,6 +49,8 @@
margin-top: 0.25em; margin-top: 0.25em;
flex-wrap: wrap; flex-wrap: wrap;
--emoji-size: calc(1.25em * var(--emojiReactionsScale, 1));
.emoji-reaction { .emoji-reaction {
padding: 0 0.5em; padding: 0 0.5em;
margin-right: 0.5em; margin-right: 0.5em;
@ -59,17 +61,24 @@
box-sizing: border-box; box-sizing: border-box;
.reaction-emoji { .reaction-emoji {
width: 1.25em; width: var(--emoji-size);
height: 1.25em; height: var(--emoji-size);
margin-right: 0.25em; margin-right: 0.25em;
line-height: var(--emoji-size);
display: flex;
justify-content: center;
align-items: center;
} }
.reaction-emoji-content { .reaction-emoji-content {
max-width: 1.25em; max-width: 100%;
max-height: 1.25em; max-height: 100%;
width: auto; width: auto;
height: auto; height: auto;
line-height: inherit;
overflow: hidden; overflow: hidden;
font-size: calc(var(--emoji-size) * 0.8);
margin: 0;
} }
&:focus { &:focus {

View File

@ -271,6 +271,15 @@
{{ $t('settings.no_rich_text_description') }} {{ $t('settings.no_rich_text_description') }}
</BooleanSetting> </BooleanSetting>
</li> </li>
<li>
<IntegerSetting
v-if="user"
path="emojiReactionsScale"
expert="1"
>
{{ $t('settings.emoji_reactions_scale') }}
</IntegerSetting>
</li>
<h3>{{ $t('settings.attachments') }}</h3> <h3>{{ $t('settings.attachments') }}</h3>
<li> <li>
<BooleanSetting <BooleanSetting

View File

@ -467,6 +467,7 @@
"pad_emoji": "Pad emoji with spaces when adding from picker", "pad_emoji": "Pad emoji with spaces when adding from picker",
"autocomplete_select_first": "Automatically select the first candidate when autocomplete results are available", "autocomplete_select_first": "Automatically select the first candidate when autocomplete results are available",
"emoji_reactions_on_timeline": "Show emoji reactions on timeline", "emoji_reactions_on_timeline": "Show emoji reactions on timeline",
"emoji_reactions_scale": "Reactions scale factor",
"export_theme": "Save preset", "export_theme": "Save preset",
"filtering": "Filtering", "filtering": "Filtering",
"wordfilter": "Wordfilter", "wordfilter": "Wordfilter",

View File

@ -97,6 +97,7 @@ export const defaultState = {
sidebarColumnWidth: '25rem', sidebarColumnWidth: '25rem',
contentColumnWidth: '45rem', contentColumnWidth: '45rem',
notifsColumnWidth: '25rem', notifsColumnWidth: '25rem',
emojiReactionsScale: 1.0,
navbarColumnStretch: false, navbarColumnStretch: false,
greentext: undefined, // instance default greentext: undefined, // instance default
useAtIcon: undefined, // instance default useAtIcon: undefined, // instance default
@ -185,6 +186,7 @@ const config = {
case 'sidebarColumnWidth': case 'sidebarColumnWidth':
case 'contentColumnWidth': case 'contentColumnWidth':
case 'notifsColumnWidth': case 'notifsColumnWidth':
case 'emojiReactionsScale':
applyConfig(state) applyConfig(state)
break break
case 'customTheme': case 'customTheme':

View File

@ -21,8 +21,8 @@ export const applyTheme = (input) => {
body.classList.remove('hidden') body.classList.remove('hidden')
} }
const configColumns = ({ sidebarColumnWidth, contentColumnWidth, notifsColumnWidth }) => const configColumns = ({ sidebarColumnWidth, contentColumnWidth, notifsColumnWidth, emojiReactionsScale }) =>
({ sidebarColumnWidth, contentColumnWidth, notifsColumnWidth }) ({ sidebarColumnWidth, contentColumnWidth, notifsColumnWidth, emojiReactionsScale })
const defaultConfigColumns = configColumns(defaultState) const defaultConfigColumns = configColumns(defaultState)