Fix: Icons collapsing in flex.

Feature: Remember what channel was opened last.
Channels: ESC to focus message box / cancel editing.
This commit is contained in:
Paul
2021-06-24 16:22:45 +01:00
parent 7e3668b393
commit 2d761d1e97
12 changed files with 137 additions and 34 deletions

View File

@@ -0,0 +1,29 @@
export interface LastOpened {
[key: string]: string
}
export type LastOpenedAction =
| { type: undefined }
| {
type: "LAST_OPENED_SET";
parent: string;
child: string;
}
| {
type: "RESET";
};
export function lastOpened(state = {} as LastOpened, action: LastOpenedAction): LastOpened {
switch (action.type) {
case "LAST_OPENED_SET": {
return {
...state,
[action.parent]: action.child
}
}
case "RESET":
return {};
default:
return state;
}
}