diff --git a/src/App.scss b/src/App.scss index 2d10f1e7..310962b8 100644 --- a/src/App.scss +++ b/src/App.scss @@ -661,6 +661,18 @@ nav { color: var(--alertErrorPanelText, $fallback--text); } } + + &.warning { + background-color: $fallback--alertWarning; + background-color: var(--alertWarning, $fallback--alertWarning); + color: $fallback--text; + color: var(--alertWarningText, $fallback--text); + + .panel-heading & { + color: $fallback--text; + color: var(--alertWarningPanelText, $fallback--text); + } + } } .faint { diff --git a/src/_variables.scss b/src/_variables.scss index 150e4fb5..e18101f0 100644 --- a/src/_variables.scss +++ b/src/_variables.scss @@ -17,6 +17,7 @@ $fallback--cGreen: #0fa00f; $fallback--cOrange: orange; $fallback--alertError: rgba(211,16,20,.5); +$fallback--alertWarning: rgba(111,111,20,.5); $fallback--panelRadius: 10px; $fallback--checkboxRadius: 2px; diff --git a/src/boot/after_store.js b/src/boot/after_store.js index 490ac4d0..80a55849 100644 --- a/src/boot/after_store.js +++ b/src/boot/after_store.js @@ -173,58 +173,6 @@ const getStickers = async ({ store }) => { } } -const getStaticEmoji = async ({ store }) => { - try { - const res = await window.fetch('/static/emoji.json') - if (res.ok) { - const values = await res.json() - const emoji = Object.keys(values).map((key) => { - return { - displayText: key, - imageUrl: false, - replacement: values[key] - } - }).sort((a, b) => a.displayText - b.displayText) - store.dispatch('setInstanceOption', { name: 'emoji', value: emoji }) - } else { - throw (res) - } - } catch (e) { - console.warn("Can't load static emoji") - console.warn(e) - } -} - -// This is also used to indicate if we have a 'pleroma backend' or not. -// Somewhat weird, should probably be somewhere else. -const getCustomEmoji = async ({ store }) => { - try { - const res = await window.fetch('/api/pleroma/emoji.json') - if (res.ok) { - const result = await res.json() - const values = Array.isArray(result) ? Object.assign({}, ...result) : result - const emoji = Object.entries(values).map(([key, value]) => { - const imageUrl = value.image_url - return { - displayText: key, - imageUrl: imageUrl ? store.state.instance.server + imageUrl : value, - tags: imageUrl ? value.tags.sort((a, b) => a > b ? 1 : 0) : ['utf'], - replacement: `:${key}: ` - } - // Technically could use tags but those are kinda useless right now, should have been "pack" field, that would be more useful - }).sort((a, b) => a.displayText.toLowerCase() > b.displayText.toLowerCase() ? 1 : 0) - store.dispatch('setInstanceOption', { name: 'customEmoji', value: emoji }) - store.dispatch('setInstanceOption', { name: 'pleromaBackend', value: true }) - } else { - throw (res) - } - } catch (e) { - store.dispatch('setInstanceOption', { name: 'pleromaBackend', value: false }) - console.warn("Can't load custom emojis, maybe not a Pleroma instance?") - console.warn(e) - } -} - const getAppSecret = async ({ store }) => { const { state, commit } = store const { oauth, instance } = state @@ -259,6 +207,7 @@ const getNodeInfo = async ({ store }) => { const software = data.software store.dispatch('setInstanceOption', { name: 'backendVersion', value: software.version }) + store.dispatch('setInstanceOption', { name: 'pleromaBackend', value: software.name === 'pleroma' }) const frontendVersion = window.___pleromafe_commit_hash store.dispatch('setInstanceOption', { name: 'frontendVersion', value: frontendVersion }) @@ -315,8 +264,6 @@ const afterStoreSetup = async ({ store, i18n }) => { getTOS({ store }), getInstancePanel({ store }), getStickers({ store }), - getStaticEmoji({ store }), - getCustomEmoji({ store }), getNodeInfo({ store }) ]) diff --git a/src/components/emoji_input/emoji_input.js b/src/components/emoji_input/emoji_input.js index 366951c0..001a22e9 100644 --- a/src/components/emoji_input/emoji_input.js +++ b/src/components/emoji_input/emoji_input.js @@ -165,6 +165,7 @@ const EmojiInput = { methods: { triggerShowPicker () { this.showPicker = true + this.$refs.picker.startEmojiLoad() this.$nextTick(() => { this.scrollIntoView() }) @@ -181,6 +182,7 @@ const EmojiInput = { this.showPicker = !this.showPicker if (this.showPicker) { this.scrollIntoView() + this.$refs.picker.startEmojiLoad() } }, replace (replacement) { @@ -306,6 +308,16 @@ const EmojiInput = { } else { scrollerRef.scrollTop = targetScroll } + + this.$nextTick(() => { + const { offsetHeight } = this.input.elm + const { picker } = this.$refs + const pickerBottom = picker.$el.getBoundingClientRect().bottom + if (pickerBottom > window.innerHeight) { + picker.$el.style.top = 'auto' + picker.$el.style.bottom = offsetHeight + 'px' + } + }) }, onTransition (e) { this.resize() @@ -419,11 +431,14 @@ const EmojiInput = { this.caret = selectionStart }, resize () { - const { panel } = this.$refs + const { panel, picker } = this.$refs if (!panel) return const { offsetHeight, offsetTop } = this.input.elm - this.$refs.panel.style.top = (offsetTop + offsetHeight) + 'px' - this.$refs.picker.$el.style.top = (offsetTop + offsetHeight) + 'px' + const offsetBottom = offsetTop + offsetHeight + + panel.style.top = offsetBottom + 'px' + picker.$el.style.top = offsetBottom + 'px' + picker.$el.style.bottom = 'auto' } } } diff --git a/src/components/emoji_input/emoji_input.vue b/src/components/emoji_input/emoji_input.vue index 13530e8b..a7215670 100644 --- a/src/components/emoji_input/emoji_input.vue +++ b/src/components/emoji_input/emoji_input.vue @@ -2,6 +2,7 @@