summaryrefslogtreecommitdiff
path: root/apps/web/src/actions/keybindings/migrations/v6-to-v7.ts
blob: 46a99ac139073a06584709f5fa6729085fc061eb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import type { KeybindingConfig } from "@/actions/keybinding";

interface V6State {
	keybindings: KeybindingConfig;
	isCustomized: boolean;
}

export function v6ToV7({ state }: { state: unknown }): unknown {
	const v6 = state as V6State;
	const keybindings = { ...v6.keybindings };

	for (const key of Object.keys(keybindings) as Array<keyof KeybindingConfig>) {
		if (keybindings[key] === ("split-element" as never)) {
			keybindings[key] = "split";
		}
	}

	return { ...v6, keybindings };
}