mirror of
https://github.com/stoatchat/for-legacy-web.git
synced 2026-03-09 10:15:26 +00:00
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:
@@ -11,6 +11,7 @@ import { typing, TypingAction } from "./typing";
|
||||
import { drafts, DraftAction } from "./drafts";
|
||||
import { sync, SyncAction } from "./sync";
|
||||
import { experiments, ExperimentsAction } from "./experiments";
|
||||
import { lastOpened, LastOpenedAction } from "./last_opened";
|
||||
|
||||
export default combineReducers({
|
||||
config,
|
||||
@@ -23,6 +24,7 @@ export default combineReducers({
|
||||
drafts,
|
||||
sync,
|
||||
experiments,
|
||||
lastOpened
|
||||
});
|
||||
|
||||
export type Action =
|
||||
@@ -36,6 +38,7 @@ export type Action =
|
||||
| DraftAction
|
||||
| SyncAction
|
||||
| ExperimentsAction
|
||||
| LastOpenedAction
|
||||
| { type: "__INIT"; state: State };
|
||||
|
||||
export type WithDispatcher = { dispatcher: (action: Action) => void };
|
||||
|
||||
29
src/redux/reducers/last_opened.ts
Normal file
29
src/redux/reducers/last_opened.ts
Normal 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user