1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-09-16 18:06:55 +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", "name": "frankerfacez",
"author": "Dan Salvato LLC", "author": "Dan Salvato LLC",
"version": "4.9.1", "version": "4.9.2",
"description": "FrankerFaceZ is a Twitch enhancement suite.", "description": "FrankerFaceZ is a Twitch enhancement suite.",
"license": "Apache-2.0", "license": "Apache-2.0",
"scripts": { "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', { this.settings.add('chat.actions.rules-as-reasons', {
default: true, default: true,
ui: { 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 = [], const actions = [],
chat = this.resolve('site.chat'); chat = this.resolve('site.chat');
@ -465,7 +474,7 @@ export default class Actions extends Module {
const room = current_room && JSON.stringify(current_room); const room = current_room && JSON.stringify(current_room);
return (<div 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} data-room={room}
> >
{actions} {actions}

View file

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