Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
pull/21833/head
Michael Telatynski 2020-09-24 09:49:30 +01:00
parent 0ef08945cf
commit c65d8be7d8
2 changed files with 35 additions and 24 deletions

View File

@ -54,7 +54,7 @@ const LeftPanelWidget: React.FC<IProps> = ({ onResize }) => {
widgetConfig.sender,
null,
widgetConfig.id);
}, [cli, mWidgetsEvent, leftPanelWidgetId]);
}, [mWidgetsEvent, leftPanelWidgetId]);
const [height, setHeight] = useLocalStorageState("left-panel-widget-height", INITIAL_HEIGHT);
const [expanded, setExpanded] = useLocalStorageState("left-panel-widget-expanded", true);
@ -65,21 +65,6 @@ const LeftPanelWidget: React.FC<IProps> = ({ onResize }) => {
if (!app) return null;
let auxButton = null;
if (1) {
auxButton = (
<AccessibleTooltipButton
tabIndex={tabIndex}
onClick={() => {
console.log("@@ Maximise Left Panel Widget")
}}
className="mx_LeftPanelWidget_maximizeButton"
tooltipClassName="mx_LeftPanelWidget_maximizeButtonTooltip"
title={_t("Maximize")}
/>
);
}
let content;
if (expanded) {
content = <Resizable
@ -112,10 +97,7 @@ const LeftPanelWidget: React.FC<IProps> = ({ onResize }) => {
return <div className="mx_LeftPanelWidget">
<div
onFocus={onFocus}
className={classNames({
"mx_LeftPanelWidget_headerContainer": true,
"mx_LeftPanelWidget_headerContainer_withAux": !!auxButton,
})}
className="mx_LeftPanelWidget_headerContainer"
onKeyDown={(ev: React.KeyboardEvent) => {
switch (ev.key) {
case Key.ARROW_LEFT:
@ -149,7 +131,16 @@ const LeftPanelWidget: React.FC<IProps> = ({ onResize }) => {
})} />
<span>{ WidgetUtils.getWidgetName(app) }</span>
</AccessibleButton>
{ auxButton }
{/* Code for the maximise button for once we have full screen widgets */}
{/*<AccessibleTooltipButton
tabIndex={tabIndex}
onClick={() => {
}}
className="mx_LeftPanelWidget_maximizeButton"
tooltipClassName="mx_LeftPanelWidget_maximizeButtonTooltip"
title={_t("Maximize")}
/>*/}
</div>
</div>

View File

@ -41,6 +41,7 @@ export interface IWidget {
id: string;
type: string;
sender: string;
// eslint-disable-next-line camelcase
state_key: string;
content: Partial<IApp>;
}
@ -224,7 +225,13 @@ export default class WidgetUtils {
});
}
static setUserWidget(widgetId: string, widgetType: WidgetType, widgetUrl: string, widgetName: string, widgetData: object) {
static setUserWidget(
widgetId: string,
widgetType: WidgetType,
widgetUrl: string,
widgetName: string,
widgetData: object,
) {
const content = {
type: widgetType.preferred,
url: widgetUrl,
@ -268,7 +275,14 @@ export default class WidgetUtils {
});
}
static setRoomWidget(roomId: string, widgetId: string, widgetType: WidgetType, widgetUrl: string, widgetName: string, widgetData: object) {
static setRoomWidget(
roomId: string,
widgetId: string,
widgetType: WidgetType,
widgetUrl: string,
widgetName: string,
widgetData: object,
) {
let content;
const addingWidget = Boolean(widgetUrl);
@ -410,7 +424,13 @@ export default class WidgetUtils {
return client.setAccountData('m.widgets', userWidgets);
}
static makeAppConfig(appId: string, app: Partial<IApp>, senderUserId: string, roomId: string | null, eventId: string): IApp {
static makeAppConfig(
appId: string,
app: Partial<IApp>,
senderUserId: string,
roomId: string | null,
eventId: string,
): IApp {
if (!senderUserId) {
throw new Error("Widgets must be created by someone - provide a senderUserId");
}