type Actions (#7862)
* type ViewHomPage action Signed-off-by: Kerry Archibald <kerrya@element.io> * type spacestore actions Signed-off-by: Kerry Archibald <kerrya@element.io> * lint Signed-off-by: Kerry Archibald <kerrya@element.io> * add action types Signed-off-by: Kerry Archibald <kerrya@element.io> * use new action types in stores Signed-off-by: Kerry Archibald <kerrya@element.io> * remove debug change Signed-off-by: Kerry Archibald <kerrya@element.io> * stricter keyboard shortcut types Signed-off-by: Kerry Archibald <kerrya@element.io> * action comments Signed-off-by: Kerry Archibald <kerrya@element.io>
This commit is contained in:
parent
57595bc593
commit
5b8d440406
33 changed files with 304 additions and 73 deletions
|
@ -31,6 +31,7 @@ import SettingsStore from "../../../settings/SettingsStore";
|
|||
import { UIFeature } from "../../../settings/UIFeature";
|
||||
import { replaceableComponent } from "../../../utils/replaceableComponent";
|
||||
import BaseDialog from "./BaseDialog";
|
||||
import { Action } from '../../../dispatcher/actions';
|
||||
|
||||
export const ROOM_GENERAL_TAB = "ROOM_GENERAL_TAB";
|
||||
export const ROOM_SECURITY_TAB = "ROOM_SECURITY_TAB";
|
||||
|
@ -75,7 +76,7 @@ export default class RoomSettingsDialog extends React.Component<IProps, IState>
|
|||
private onAction = (payload): void => {
|
||||
// When view changes below us, close the room settings
|
||||
// whilst the modal is open this can only be triggered when someone hits Leave Room
|
||||
if (payload.action === 'view_home_page') {
|
||||
if (payload.action === Action.ViewHomePage) {
|
||||
this.props.onFinished(true);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -30,6 +30,7 @@ import SettingsStore from "../../../settings/SettingsStore";
|
|||
import { UIFeature } from "../../../settings/UIFeature";
|
||||
import AdvancedRoomSettingsTab from "../settings/tabs/room/AdvancedRoomSettingsTab";
|
||||
import RolesRoomSettingsTab from "../settings/tabs/room/RolesRoomSettingsTab";
|
||||
import { Action } from '../../../dispatcher/actions';
|
||||
|
||||
export enum SpaceSettingsTab {
|
||||
General = "SPACE_GENERAL_TAB",
|
||||
|
@ -44,8 +45,8 @@ interface IProps extends IDialogProps {
|
|||
}
|
||||
|
||||
const SpaceSettingsDialog: React.FC<IProps> = ({ matrixClient: cli, space, onFinished }) => {
|
||||
useDispatcher(defaultDispatcher, ({ action, ...params }) => {
|
||||
if (action === "after_leave_room" && params.room_id === space.roomId) {
|
||||
useDispatcher(defaultDispatcher, (payload) => {
|
||||
if (payload.action === Action.AfterLeaveRoom && payload.room_id === space.roomId) {
|
||||
onFinished(false);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -49,6 +49,7 @@ import RoomViewStore from '../../../stores/RoomViewStore';
|
|||
import WidgetUtils from '../../../utils/WidgetUtils';
|
||||
import MatrixClientContext from "../../../contexts/MatrixClientContext";
|
||||
import { ActionPayload } from "../../../dispatcher/payloads";
|
||||
import { Action } from '../../../dispatcher/actions';
|
||||
|
||||
interface IProps {
|
||||
app: IApp;
|
||||
|
@ -447,7 +448,7 @@ export default class AppTile extends React.Component<IProps, IState> {
|
|||
}
|
||||
break;
|
||||
|
||||
case "after_leave_room":
|
||||
case Action.AfterLeaveRoom:
|
||||
if (payload.room_id === this.props.room?.roomId) {
|
||||
// call this before we get it echoed down /sync, so it doesn't hang around as long and look jarring
|
||||
this.onUserLeftRoom();
|
||||
|
|
|
@ -24,13 +24,14 @@ import {
|
|||
ICategory,
|
||||
CATEGORIES,
|
||||
CategoryName,
|
||||
KeyBindingConfig,
|
||||
} from "../../../../../accessibility/KeyboardShortcuts";
|
||||
import SdkConfig from "../../../../../SdkConfig";
|
||||
import { isMac, Key } from "../../../../../Keyboard";
|
||||
import { _t } from "../../../../../languageHandler";
|
||||
|
||||
// TODO: This should return KeyCombo but it has ctrlOrCmd instead of ctrlOrCmdKey
|
||||
const getKeyboardShortcutValue = (name: string) => {
|
||||
const getKeyboardShortcutValue = (name: string): KeyBindingConfig => {
|
||||
return getKeyboardShortcuts()[name]?.default;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue