Rename properties related to Stickers (#7662)
Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
cbc671b19f
commit
344b506184
2 changed files with 25 additions and 25 deletions
|
@ -255,7 +255,7 @@ interface IState {
|
|||
me?: RoomMember;
|
||||
narrowMode?: boolean;
|
||||
isMenuOpen: boolean;
|
||||
showStickers: boolean;
|
||||
isStickerPickerOpen: boolean;
|
||||
showStickersButton: boolean;
|
||||
showLocationButton: boolean;
|
||||
}
|
||||
|
@ -286,7 +286,7 @@ export default class MessageComposer extends React.Component<IProps, IState> {
|
|||
haveRecording: false,
|
||||
recordingTimeLeftSeconds: null, // when set to a number, shows a toast
|
||||
isMenuOpen: false,
|
||||
showStickers: false,
|
||||
isStickerPickerOpen: false,
|
||||
showStickersButton: SettingsStore.getValue("MessageComposerInput.showStickersButton"),
|
||||
showLocationButton: (
|
||||
!window.electron &&
|
||||
|
@ -315,7 +315,7 @@ export default class MessageComposer extends React.Component<IProps, IState> {
|
|||
this.setState({
|
||||
narrowMode,
|
||||
isMenuOpen: !narrowMode ? false : this.state.isMenuOpen,
|
||||
showStickers: false,
|
||||
isStickerPickerOpen: false,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
@ -499,8 +499,8 @@ export default class MessageComposer extends React.Component<IProps, IState> {
|
|||
}
|
||||
};
|
||||
|
||||
private showStickers = (showStickers: boolean) => {
|
||||
this.setState({ showStickers });
|
||||
private setStickerPickerOpen = (isStickerPickerOpen: boolean) => {
|
||||
this.setState({ isStickerPickerOpen });
|
||||
};
|
||||
|
||||
private toggleButtonMenu = (): void => {
|
||||
|
@ -547,7 +547,7 @@ export default class MessageComposer extends React.Component<IProps, IState> {
|
|||
if (this.state.showStickersButton) {
|
||||
let title: string;
|
||||
if (!this.state.narrowMode) {
|
||||
title = this.state.showStickers ? _t("Hide Stickers") : _t("Show Stickers");
|
||||
title = this.state.isStickerPickerOpen ? _t("Hide Stickers") : _t("Show Stickers");
|
||||
}
|
||||
|
||||
buttons.push(
|
||||
|
@ -555,7 +555,7 @@ export default class MessageComposer extends React.Component<IProps, IState> {
|
|||
id='stickersButton'
|
||||
key="controls_stickers"
|
||||
className="mx_MessageComposer_button mx_MessageComposer_stickers"
|
||||
onClick={() => this.showStickers(!this.state.showStickers)}
|
||||
onClick={() => this.setStickerPickerOpen(!this.state.isStickerPickerOpen)}
|
||||
title={title}
|
||||
label={this.state.narrowMode ? _t("Send a sticker") : null}
|
||||
/>,
|
||||
|
@ -692,8 +692,8 @@ export default class MessageComposer extends React.Component<IProps, IState> {
|
|||
<Stickerpicker
|
||||
room={this.props.room}
|
||||
threadId={threadId}
|
||||
showStickers={this.state.showStickers}
|
||||
setShowStickers={this.showStickers}
|
||||
isStickerPickerOpen={this.state.isStickerPickerOpen}
|
||||
setStickerPickerOpen={this.setStickerPickerOpen}
|
||||
menuPosition={menuPosition}
|
||||
key="stickers"
|
||||
/>,
|
||||
|
|
|
@ -48,9 +48,9 @@ const PERSISTED_ELEMENT_KEY = "stickerPicker";
|
|||
interface IProps {
|
||||
room: Room;
|
||||
threadId?: string | null;
|
||||
showStickers: boolean;
|
||||
isStickerPickerOpen: boolean;
|
||||
menuPosition?: any;
|
||||
setShowStickers: (showStickers: boolean) => void;
|
||||
setStickerPickerOpen: (isStickerPickerOpen: boolean) => void;
|
||||
}
|
||||
|
||||
interface IState {
|
||||
|
@ -113,7 +113,7 @@ export default class Stickerpicker extends React.PureComponent<IProps, IState> {
|
|||
if (scalarClient) {
|
||||
scalarClient.disableWidgetAssets(WidgetType.STICKERPICKER, this.state.widgetId).then(() => {
|
||||
logger.log('Assets disabled');
|
||||
}).catch((err) => {
|
||||
}).catch(() => {
|
||||
logger.error('Failed to disable assets');
|
||||
});
|
||||
} else {
|
||||
|
@ -123,7 +123,7 @@ export default class Stickerpicker extends React.PureComponent<IProps, IState> {
|
|||
logger.warn('No widget ID specified, not disabling assets');
|
||||
}
|
||||
|
||||
this.props.setShowStickers(false);
|
||||
this.props.setStickerPickerOpen(false);
|
||||
WidgetUtils.removeStickerpickerWidgets().then(() => {
|
||||
this.forceUpdate();
|
||||
}).catch((e) => {
|
||||
|
@ -155,8 +155,8 @@ export default class Stickerpicker extends React.PureComponent<IProps, IState> {
|
|||
}
|
||||
}
|
||||
|
||||
public componentDidUpdate(prevProps: IProps, prevState: IState): void {
|
||||
this.sendVisibilityToWidget(this.props.showStickers);
|
||||
public componentDidUpdate(): void {
|
||||
this.sendVisibilityToWidget(this.props.isStickerPickerOpen);
|
||||
}
|
||||
|
||||
private imError(errorMsg: string, e: Error): void {
|
||||
|
@ -164,7 +164,7 @@ export default class Stickerpicker extends React.PureComponent<IProps, IState> {
|
|||
this.setState({
|
||||
imError: _t(errorMsg),
|
||||
});
|
||||
this.props.setShowStickers(false);
|
||||
this.props.setStickerPickerOpen(false);
|
||||
}
|
||||
|
||||
private updateWidget = (): void => {
|
||||
|
@ -204,17 +204,17 @@ export default class Stickerpicker extends React.PureComponent<IProps, IState> {
|
|||
this.forceUpdate();
|
||||
break;
|
||||
case "stickerpicker_close":
|
||||
this.props.setShowStickers(false);
|
||||
this.props.setStickerPickerOpen(false);
|
||||
break;
|
||||
case "show_left_panel":
|
||||
case "hide_left_panel":
|
||||
this.props.setShowStickers(false);
|
||||
this.props.setStickerPickerOpen(false);
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
private onRightPanelStoreUpdate = () => {
|
||||
this.props.setShowStickers(false);
|
||||
this.props.setStickerPickerOpen(false);
|
||||
};
|
||||
|
||||
private defaultStickerpickerContent(): JSX.Element {
|
||||
|
@ -355,7 +355,7 @@ export default class Stickerpicker extends React.PureComponent<IProps, IState> {
|
|||
|
||||
const y = (buttonRect.top + (buttonRect.height / 2) + window.pageYOffset) - 19;
|
||||
|
||||
this.props.setShowStickers(true);
|
||||
this.props.setStickerPickerOpen(true);
|
||||
this.setState({
|
||||
stickerpickerX: x,
|
||||
stickerpickerY: y,
|
||||
|
@ -367,8 +367,8 @@ export default class Stickerpicker extends React.PureComponent<IProps, IState> {
|
|||
* Called when the window is resized
|
||||
*/
|
||||
private onResize = (): void => {
|
||||
if (this.props.showStickers) {
|
||||
this.props.setShowStickers(false);
|
||||
if (this.props.isStickerPickerOpen) {
|
||||
this.props.setStickerPickerOpen(false);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -376,8 +376,8 @@ export default class Stickerpicker extends React.PureComponent<IProps, IState> {
|
|||
* The stickers picker was hidden
|
||||
*/
|
||||
private onFinished = (): void => {
|
||||
if (this.props.showStickers) {
|
||||
this.props.setShowStickers(false);
|
||||
if (this.props.isStickerPickerOpen) {
|
||||
this.props.setStickerPickerOpen(false);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -402,7 +402,7 @@ export default class Stickerpicker extends React.PureComponent<IProps, IState> {
|
|||
};
|
||||
|
||||
public render(): JSX.Element {
|
||||
if (!this.props.showStickers) return null;
|
||||
if (!this.props.isStickerPickerOpen) return null;
|
||||
|
||||
return <ContextMenu
|
||||
chevronOffset={this.state.stickerpickerChevronOffset}
|
||||
|
|
Loading…
Reference in a new issue