1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-09-16 10:06:54 +00:00
* Added: Option to display Chat Room Actions above chat input, as they used to be positioned before 4.9.1.
This commit is contained in:
SirStendec 2019-08-13 16:22:04 -04:00
parent fe300125c7
commit 2142f132f5
3 changed files with 21 additions and 7 deletions

View file

@ -1,7 +1,7 @@
{
"name": "frankerfacez",
"author": "Dan Salvato LLC",
"version": "4.9.1",
"version": "4.9.2",
"description": "FrankerFaceZ is a Twitch enhancement suite.",
"license": "Apache-2.0",
"scripts": {

View file

@ -148,6 +148,15 @@ export default class Actions extends Module {
}
});
this.settings.add('chat.actions.room-above', {
default: false,
ui: {
path: 'Chat > Actions > Room >> General',
component: 'setting-check-box',
title: 'Display Room Actions above the chat input box.'
}
});
this.settings.add('chat.actions.rules-as-reasons', {
default: true,
ui: {
@ -420,7 +429,7 @@ export default class Actions extends Module {
}
renderRoom(mod_icons, current_user, current_room, createElement) {
renderRoom(mod_icons, current_user, current_room, is_above, createElement) {
const actions = [],
chat = this.resolve('site.chat');
@ -465,7 +474,7 @@ export default class Actions extends Module {
const room = current_room && JSON.stringify(current_room);
return (<div
class="ffz--room-actions ffz-action-data tw-flex tw-flex-grow-1 tw-mg-x-05 tw-align-items-center"
class={`ffz--room-actions ffz-action-data tw-flex tw-flex-grow-1 tw-align-items-center ${is_above ? 'tw-pd-y-05 tw-border-t' : 'tw-mg-x-05'}`}
data-room={room}
>
{actions}

View file

@ -133,6 +133,7 @@ export default class Input extends Module {
async onEnable() {
this.chat.context.on('changed:chat.actions.room', () => this.ChatInput.forceUpdate());
this.chat.context.on('changed:chat.actions.room-above', () => this.ChatInput.forceUpdate());
this.chat.context.on('changed:chat.tab-complete.emotes-without-colon', enabled => {
for (const inst of this.EmoteSuggestions.instances)
inst.canBeTriggeredByTab = enabled;
@ -155,8 +156,9 @@ export default class Input extends Module {
cls.prototype.render = function() {
const out = old_render.call(this);
try {
const container = findReactFragment(out, n => n.props && n.props.children && n.props.className === 'chat-input__buttons-container');
if ( ! container )
const above = t.chat.context.get('chat.actions.room-above'),
container = above ? out : findReactFragment(out, n => n.props && n.props.className === 'chat-input__buttons-container');
if ( ! container || ! container.props || ! container.props.children )
return out;
const props = this.props;
@ -180,8 +182,11 @@ export default class Input extends Module {
subsMode: props.subsOnlyMode
}
const actions = t.actions.renderRoom(t.chat.context.get('context.chat.showModIcons'), u, r, createElement);
container.props.children.splice(1, 0, actions || null);
const actions = t.actions.renderRoom(t.chat.context.get('context.chat.showModIcons'), u, r, above, createElement);
if ( above )
container.props.children.unshift(actions || null);
else
container.props.children.splice(1, 0, actions || null);
} catch(err) {
t.log.error(err);