This commit is contained in:
HannahPadd
2026-04-01 08:07:35 +02:00
parent f938d7e49c
commit 13f2abb7ab
7 changed files with 67 additions and 68 deletions

View File

@@ -87,11 +87,15 @@ export const KeybindRecorder = forwardRef<
return (
<div key={i} className="flex flex-row">
<div
className={classNames('flex p-2 rounded-lg min-w-[50px] min-h-[50px] text-main-title justify-center items-center bg-background-80 mobile:text-sm', {
'keyslot-invalid ring-2 ring-status-critical': isInvalid,
'keyslot-animate ring-2 ring-accent': isActive && !isInvalid,
'ring-accent': !isInvalid && !isInvalid
})}
className={classNames(
'flex p-2 rounded-lg min-w-[50px] min-h-[50px] text-main-title justify-center items-center bg-background-80 mobile:text-sm',
{
'keyslot-invalid ring-2 ring-status-critical': isInvalid,
'keyslot-animate ring-2 ring-accent':
isActive && !isInvalid,
'ring-accent': !isInvalid && !isInvalid,
}
)}
>
{key ?? ''}
</div>

View File

@@ -55,15 +55,15 @@ export function KeybindRecorderModal({
variant="tertiary"
onClick={() => {
resetField(name);
onClose()
onClose();
}}
/>
<Button
id="settings-keybinds-recorder-modal-unbind-button"
variant="tertiary"
onClick={() => {
onUnbind()
onClose()
onUnbind();
onClose();
}}
/>
</div>

View File

@@ -1,4 +1,3 @@
.keybind-row {
display: grid;
grid-column: 1 / -1;
@@ -8,9 +7,6 @@
gap: 10px;
}
@keyframes keyslot {
0%,
100% {

View File

@@ -25,7 +25,7 @@ function KeyBindKeyList({ keybind }: { keybind: string[] }) {
</div>
);
});
};
}
export function KeybindsRow({
id,

View File

@@ -1,4 +1,3 @@
.keybind-settings {
display: grid;

View File

@@ -45,7 +45,6 @@ export function KeybindSettings() {
const currentIndex = useRef<number | null>(null);
const { installInfo } = useAppContext();
const { control, resetField, handleSubmit, reset, setValue, getValues } =
useForm<KeybindForm>({
defaultValues: defaultKeybindsState,
@@ -147,7 +146,7 @@ export function KeybindSettings() {
<Typography key={i}>{line}</Typography>
))}
</div>
{installInfo?.isWayland ? (
{installInfo?.isWayland ? (
<div className="flex flex-col gap-4">
<Typography id="settings-keybinds-wayland-description" />
<div>
@@ -159,58 +158,61 @@ export function KeybindSettings() {
/>
</div>
</div>
) : electron.isElectron && electron.data().os.type === 'windows' && (
<>
<div className="keybind-settings">
<Typography
id="keybind_config-keybind_name"
variant="section-title"
/>
<Typography
id="keybind_config-keybind_value"
variant="section-title"
/>
<Typography
id="keybind_config-keybind_delay"
variant="section-title"
/>
{createKeybindRows()}
</div>
<div className="flex justify-end">
<Button
id="settings-keybinds_reset-all-button"
onClick={() => {
reset(defaultKeybindsState);
) : (
electron.isElectron &&
electron.data().os.type === 'windows' && (
<>
<div className="keybind-settings">
<Typography
id="keybind_config-keybind_name"
variant="section-title"
/>
<Typography
id="keybind_config-keybind_value"
variant="section-title"
/>
<Typography
id="keybind_config-keybind_delay"
variant="section-title"
/>
{createKeybindRows()}
</div>
<div className="flex justify-end">
<Button
id="settings-keybinds_reset-all-button"
onClick={() => {
reset(defaultKeybindsState);
handleSubmit(onSubmit)();
}}
variant="primary"
/>
</div>
<KeybindRecorderModal
id={
currentIndex.current != null
? fields[currentIndex.current].name
: ''
}
control={control}
resetField={resetField}
name={
currentIndex.current != null
? `keybinds.${currentIndex.current}.binding`
: ''
}
isVisisble={isOpen}
onClose={() => {
setIsOpen(false);
handleSubmit(onSubmit)();
}}
variant="primary"
onUnbind={() => {
if (currentIndex.current != null)
setValue(`keybinds.${currentIndex.current}.binding`, []);
}}
/>
</div>
<KeybindRecorderModal
id={
currentIndex.current != null
? fields[currentIndex.current].name
: ''
}
control={control}
resetField={resetField}
name={
currentIndex.current != null
? `keybinds.${currentIndex.current}.binding`
: ''
}
isVisisble={isOpen}
onClose={() => {
setIsOpen(false);
handleSubmit(onSubmit)();
}}
onUnbind={() => {
if (currentIndex.current != null)
setValue(`keybinds.${currentIndex.current}.binding`, []);
}}
/>
</>
</>
)
)}
</div>
</SettingsPagePaneLayout>

View File

@@ -59,7 +59,6 @@ export function useProvideAppContext(): AppContext {
}
});
useEffect(() => {
updateSentryContext(devices);
}, [devices]);
@@ -80,7 +79,7 @@ export function useProvideAppContext(): AppContext {
};
}, [config?.uuid]);
useEffect(() => {
useEffect(() => {
sendRPCPacket(RpcMessage.InstalledInfoRequest, new InstalledInfoResponseT());
}, []);
@@ -91,7 +90,6 @@ export function useProvideAppContext(): AppContext {
}
);
useLayoutEffect(() => {
changeLocales([config?.lang || DEFAULT_LOCALE]);
}, []);