From 998aa8f732bbf9d074abeb5916ceb5effd8afe5c Mon Sep 17 00:00:00 2001 From: Alexander Tumin Date: Sun, 18 Dec 2022 22:04:58 +0300 Subject: [PATCH 1/6] Allow custom emoji reactions --- .../emoji_reactions/emoji_reactions.vue | 27 ++++- src/components/notification/notification.vue | 15 ++- .../notifications/notifications.scss | 7 ++ src/components/react_button/react_button.js | 92 ++------------- src/components/react_button/react_button.vue | 108 ++++++------------ .../entity_normalizer.service.js | 1 + 6 files changed, 89 insertions(+), 161 deletions(-) diff --git a/src/components/emoji_reactions/emoji_reactions.vue b/src/components/emoji_reactions/emoji_reactions.vue index a63daa9743..12783114b3 100644 --- a/src/components/emoji_reactions/emoji_reactions.vue +++ b/src/components/emoji_reactions/emoji_reactions.vue @@ -2,7 +2,7 @@
@@ -46,9 +60,18 @@ .reaction-emoji { width: 1.25em; + height: 1.25em; margin-right: 0.25em; } + .reaction-emoji-content { + max-width: 1.25em; + max-height: 1.25em; + width: auto; + height: auto; + overflow: hidden; + } + &:focus { outline: none; } diff --git a/src/components/notification/notification.vue b/src/components/notification/notification.vue index e1ea42aded..4d801c5e9c 100644 --- a/src/components/notification/notification.vue +++ b/src/components/notification/notification.vue @@ -121,7 +121,16 @@ scope="global" keypath="notifications.reacted_with" > - {{ notification.emoji }} + + {{ notification.emoji }} @@ -153,9 +162,9 @@ @@ -49,6 +49,8 @@ margin-top: 0.25em; flex-wrap: wrap; + --emoji-size: calc(1.25em * var(--emojiReactionsScale, 1)); + .emoji-reaction { padding: 0 0.5em; margin-right: 0.5em; @@ -59,17 +61,24 @@ box-sizing: border-box; .reaction-emoji { - width: 1.25em; - height: 1.25em; + width: var(--emoji-size); + height: var(--emoji-size); margin-right: 0.25em; + line-height: var(--emoji-size); + display: flex; + justify-content: center; + align-items: center; } .reaction-emoji-content { - max-width: 1.25em; - max-height: 1.25em; + max-width: 100%; + max-height: 100%; width: auto; height: auto; + line-height: inherit; overflow: hidden; + font-size: calc(var(--emoji-size) * 0.8); + margin: 0; } &:focus { diff --git a/src/components/settings_modal/tabs/general_tab.vue b/src/components/settings_modal/tabs/general_tab.vue index 65248ac1ba..17afc5ba5e 100644 --- a/src/components/settings_modal/tabs/general_tab.vue +++ b/src/components/settings_modal/tabs/general_tab.vue @@ -271,6 +271,15 @@ {{ $t('settings.no_rich_text_description') }} +
  • + + {{ $t('settings.emoji_reactions_scale') }} + +
  • {{ $t('settings.attachments') }}

  • { body.classList.remove('hidden') } -const configColumns = ({ sidebarColumnWidth, contentColumnWidth, notifsColumnWidth }) => - ({ sidebarColumnWidth, contentColumnWidth, notifsColumnWidth }) +const configColumns = ({ sidebarColumnWidth, contentColumnWidth, notifsColumnWidth, emojiReactionsScale }) => + ({ sidebarColumnWidth, contentColumnWidth, notifsColumnWidth, emojiReactionsScale }) const defaultConfigColumns = configColumns(defaultState) From 493120b5456282756d05d9afaf66b11a2f87d8fc Mon Sep 17 00:00:00 2001 From: Alexander Tumin Date: Sat, 18 Mar 2023 20:48:36 +0300 Subject: [PATCH 5/6] Generalize IntegerSetting into NumberSetting, add Integer/Float wrappers --- .../settings_modal/helpers/float_setting.vue | 16 +++++++++ .../helpers/integer_setting.vue | 36 +++++++------------ .../{integer_setting.js => number_setting.js} | 22 +++++++++--- .../settings_modal/helpers/number_setting.vue | 27 ++++++++++++++ .../settings_modal/tabs/general_tab.js | 2 ++ .../settings_modal/tabs/general_tab.vue | 4 +-- 6 files changed, 77 insertions(+), 30 deletions(-) create mode 100644 src/components/settings_modal/helpers/float_setting.vue rename src/components/settings_modal/helpers/{integer_setting.js => number_setting.js} (58%) create mode 100644 src/components/settings_modal/helpers/number_setting.vue diff --git a/src/components/settings_modal/helpers/float_setting.vue b/src/components/settings_modal/helpers/float_setting.vue new file mode 100644 index 0000000000..15edb3c3ee --- /dev/null +++ b/src/components/settings_modal/helpers/float_setting.vue @@ -0,0 +1,16 @@ + + + diff --git a/src/components/settings_modal/helpers/integer_setting.vue b/src/components/settings_modal/helpers/integer_setting.vue index 695e26738f..43fa7e1a90 100644 --- a/src/components/settings_modal/helpers/integer_setting.vue +++ b/src/components/settings_modal/helpers/integer_setting.vue @@ -1,27 +1,17 @@ - + diff --git a/src/components/settings_modal/helpers/integer_setting.js b/src/components/settings_modal/helpers/number_setting.js similarity index 58% rename from src/components/settings_modal/helpers/integer_setting.js rename to src/components/settings_modal/helpers/number_setting.js index e64d0cee22..73c399481e 100644 --- a/src/components/settings_modal/helpers/integer_setting.js +++ b/src/components/settings_modal/helpers/number_setting.js @@ -8,6 +8,8 @@ export default { path: String, disabled: Boolean, min: Number, + step: Number, + truncate: Number, expert: [Number, String] }, computed: { @@ -15,8 +17,11 @@ export default { const [firstSegment, ...rest] = this.path.split('.') return [firstSegment + 'DefaultValue', ...rest].join('.') }, + parent () { + return this.$parent.$parent + }, state () { - const value = get(this.$parent, this.path) + const value = get(this.parent, this.path) if (value === undefined) { return this.defaultState } else { @@ -24,21 +29,28 @@ export default { } }, defaultState () { - return get(this.$parent, this.pathDefault) + return get(this.parent, this.pathDefault) }, isChanged () { return this.state !== this.defaultState }, matchesExpertLevel () { - return (this.expert || 0) <= this.$parent.expertLevel + return (this.expert || 0) <= this.parent.expertLevel } }, methods: { + truncateValue (value) { + if (!this.truncate) { + return value + } + + return Math.trunc(value / this.truncate) * this.truncate + }, update (e) { - set(this.$parent, this.path, parseInt(e.target.value)) + set(this.parent, this.path, this.truncateValue(parseFloat(e.target.value))) }, reset () { - set(this.$parent, this.path, this.defaultState) + set(this.parent, this.path, this.defaultState) } } } diff --git a/src/components/settings_modal/helpers/number_setting.vue b/src/components/settings_modal/helpers/number_setting.vue new file mode 100644 index 0000000000..3eab517818 --- /dev/null +++ b/src/components/settings_modal/helpers/number_setting.vue @@ -0,0 +1,27 @@ + + + diff --git a/src/components/settings_modal/tabs/general_tab.js b/src/components/settings_modal/tabs/general_tab.js index ea24d6adb8..be97710f23 100644 --- a/src/components/settings_modal/tabs/general_tab.js +++ b/src/components/settings_modal/tabs/general_tab.js @@ -2,6 +2,7 @@ import BooleanSetting from '../helpers/boolean_setting.vue' import ChoiceSetting from '../helpers/choice_setting.vue' import ScopeSelector from 'src/components/scope_selector/scope_selector.vue' import IntegerSetting from '../helpers/integer_setting.vue' +import FloatSetting from '../helpers/float_setting.vue' import SizeSetting, { defaultHorizontalUnits } from '../helpers/size_setting.vue' import InterfaceLanguageSwitcher from 'src/components/interface_language_switcher/interface_language_switcher.vue' @@ -62,6 +63,7 @@ const GeneralTab = { BooleanSetting, ChoiceSetting, IntegerSetting, + FloatSetting, SizeSetting, InterfaceLanguageSwitcher, ScopeSelector, diff --git a/src/components/settings_modal/tabs/general_tab.vue b/src/components/settings_modal/tabs/general_tab.vue index 17afc5ba5e..21e2d855a6 100644 --- a/src/components/settings_modal/tabs/general_tab.vue +++ b/src/components/settings_modal/tabs/general_tab.vue @@ -272,13 +272,13 @@
  • - {{ $t('settings.emoji_reactions_scale') }} - +
  • {{ $t('settings.attachments') }}

  • From 624da7240e72bacb3476d512691c17bafdb4dfed Mon Sep 17 00:00:00 2001 From: Poesty Li Date: Wed, 8 Mar 2023 14:07:46 +0000 Subject: [PATCH 6/6] Translated using Weblate (Chinese (Simplified)) Currently translated at 99.6% (984 of 987 strings) Translation: Pleroma/Pleroma-FE Translate-URL: https://translate.pleroma.social/projects/pleroma/pleroma-fe/zh_Hans/ --- src/i18n/zh.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/i18n/zh.json b/src/i18n/zh.json index 90f840a7ab..8ea4c1e09d 100644 --- a/src/i18n/zh.json +++ b/src/i18n/zh.json @@ -295,7 +295,7 @@ "change_password_error": "修改密码的时候出了点问题。", "changed_password": "成功修改了密码!", "collapse_subject": "折叠带主题的内容", - "composing": "写作", + "composing": "撰写", "confirm_new_password": "确认新密码", "current_avatar": "当前头像", "current_password": "当前密码", @@ -737,7 +737,8 @@ "mention_link_use_tooltip": "点击提及链接时显示用户卡片", "mention_link_show_avatar": "在链接旁边显示用户头像", "mention_link_show_avatar_quick": "在提及内容旁边显示用户头像", - "user_popover_avatar_action_open": "打开个人资料" + "user_popover_avatar_action_open": "打开个人资料", + "autocomplete_select_first": "当有自动完成的结果时,自动选择第一个候选项" }, "time": { "day": "{0} 天",