mirror of https://github.com/vector-im/riot-web
parent
0ef08945cf
commit
c65d8be7d8
|
@ -54,7 +54,7 @@ const LeftPanelWidget: React.FC<IProps> = ({ onResize }) => {
|
||||||
widgetConfig.sender,
|
widgetConfig.sender,
|
||||||
null,
|
null,
|
||||||
widgetConfig.id);
|
widgetConfig.id);
|
||||||
}, [cli, mWidgetsEvent, leftPanelWidgetId]);
|
}, [mWidgetsEvent, leftPanelWidgetId]);
|
||||||
|
|
||||||
const [height, setHeight] = useLocalStorageState("left-panel-widget-height", INITIAL_HEIGHT);
|
const [height, setHeight] = useLocalStorageState("left-panel-widget-height", INITIAL_HEIGHT);
|
||||||
const [expanded, setExpanded] = useLocalStorageState("left-panel-widget-expanded", true);
|
const [expanded, setExpanded] = useLocalStorageState("left-panel-widget-expanded", true);
|
||||||
|
@ -65,21 +65,6 @@ const LeftPanelWidget: React.FC<IProps> = ({ onResize }) => {
|
||||||
|
|
||||||
if (!app) return null;
|
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;
|
let content;
|
||||||
if (expanded) {
|
if (expanded) {
|
||||||
content = <Resizable
|
content = <Resizable
|
||||||
|
@ -112,10 +97,7 @@ const LeftPanelWidget: React.FC<IProps> = ({ onResize }) => {
|
||||||
return <div className="mx_LeftPanelWidget">
|
return <div className="mx_LeftPanelWidget">
|
||||||
<div
|
<div
|
||||||
onFocus={onFocus}
|
onFocus={onFocus}
|
||||||
className={classNames({
|
className="mx_LeftPanelWidget_headerContainer"
|
||||||
"mx_LeftPanelWidget_headerContainer": true,
|
|
||||||
"mx_LeftPanelWidget_headerContainer_withAux": !!auxButton,
|
|
||||||
})}
|
|
||||||
onKeyDown={(ev: React.KeyboardEvent) => {
|
onKeyDown={(ev: React.KeyboardEvent) => {
|
||||||
switch (ev.key) {
|
switch (ev.key) {
|
||||||
case Key.ARROW_LEFT:
|
case Key.ARROW_LEFT:
|
||||||
|
@ -149,7 +131,16 @@ const LeftPanelWidget: React.FC<IProps> = ({ onResize }) => {
|
||||||
})} />
|
})} />
|
||||||
<span>{ WidgetUtils.getWidgetName(app) }</span>
|
<span>{ WidgetUtils.getWidgetName(app) }</span>
|
||||||
</AccessibleButton>
|
</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>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,7 @@ export interface IWidget {
|
||||||
id: string;
|
id: string;
|
||||||
type: string;
|
type: string;
|
||||||
sender: string;
|
sender: string;
|
||||||
|
// eslint-disable-next-line camelcase
|
||||||
state_key: string;
|
state_key: string;
|
||||||
content: Partial<IApp>;
|
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 = {
|
const content = {
|
||||||
type: widgetType.preferred,
|
type: widgetType.preferred,
|
||||||
url: widgetUrl,
|
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;
|
let content;
|
||||||
|
|
||||||
const addingWidget = Boolean(widgetUrl);
|
const addingWidget = Boolean(widgetUrl);
|
||||||
|
@ -410,7 +424,13 @@ export default class WidgetUtils {
|
||||||
return client.setAccountData('m.widgets', userWidgets);
|
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) {
|
if (!senderUserId) {
|
||||||
throw new Error("Widgets must be created by someone - provide a senderUserId");
|
throw new Error("Widgets must be created by someone - provide a senderUserId");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue