Skip to content

Commit

Permalink
Merge branch 'development' into fixMacrosDeleteDialog
Browse files Browse the repository at this point in the history
  • Loading branch information
alexpargon committed Oct 4, 2024
2 parents 2891a77 + 7bc4d61 commit dbf5d9c
Show file tree
Hide file tree
Showing 10 changed files with 135 additions and 55 deletions.
2 changes: 2 additions & 0 deletions src/main/managers/Store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const schema: Schema<StorageType> = {
backupFrequency: { type: "number" },
language: { type: "string" },
darkMode: { type: "string" },
hideBluetoothExperimental: { type: "boolean" },
showDefaults: { type: "boolean" },
isStandardView: { type: "boolean" },
autoUpdate: { type: "boolean" },
Expand All @@ -21,6 +22,7 @@ const schema: Schema<StorageType> = {
backupFrequency: 0,
language: "english",
darkMode: "system",
hideBluetoothExperimental: false,
showDefaults: false,
isStandardView: true,
autoUpdate: undefined,
Expand Down
4 changes: 2 additions & 2 deletions src/main/utils/udev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import fs from "fs";
import * as sudo from "sudo-prompt";
import log from "electron-log/main";

const udevRulesToWrite =`\
const udevRulesToWrite = `\
# Dygma Raise
SUBSYSTEMS=="usb", ATTRS{idVendor}=="1209", ATTRS{idProduct}=="2200", MODE="0660", TAG+="uaccess"
# bootloader mode
Expand Down Expand Up @@ -44,7 +44,7 @@ const installUdev = (mainWindow: BrowserWindow) => {
};
const dialogOpts: MessageBoxOptions = {
type: "question",
buttons: ["Cancel", "Install"],
buttons: ["Ignore", "Install"],
cancelId: 0,
defaultId: 1,
title: "Udev rules Installation",
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/components/atoms/AlertDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { cn } from "@Renderer/utils";
import { buttonVariants } from "@Renderer/components/atoms/Button";

interface ButtonVariantProps {
buttonVariant: "default" | "destructive" | "outline" | "link" | "secondary" | "ghost";
buttonVariant: "default" | "primary" | "destructive" | "outline" | "link" | "secondary" | "ghost";
}

const AlertDialog = AlertDialogPrimitive.Root;
Expand Down
8 changes: 6 additions & 2 deletions src/renderer/i18n/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -719,9 +719,13 @@ const English = {
useWithoutKeyboard: "Use without keyboard",
noDevicesFound: "No keyboards found!",
noDevicesFoundDescription: "[Black metal plays in background]",
dialogDeleteTitle: "Are you absolutely sure?",
dialogDeleteDescription:
"This action can't be undone and will remove the keyboard from your Device List, deleting the names of your layers, macros and superkeys. The rest of your configuration will remain on the keyboard.",
dialogDeleteTitle: "",
dialogBluetoothExperimentalTitle: "IMPORTANT",
dialogBluetoothExperimentalDescription:
"Bazecor over Bluetooth is still an experimental feature; it doesn't work on all computers yet, and changes might not always be saved correctly to your keyboard.",
dialogBluetoothExperimentalDisclaimer: "If you experience these issues, please connect your neuron via USB to your computer.",
ReOrderList: "Re-order list",
},
keyboardSelect: {
Expand Down Expand Up @@ -794,7 +798,7 @@ const English = {
errorDuringProcessTitle: "Firmware update error!",
errorDuringProcessDescription: "Something went wrong! Please, retry the flashing procedure. 🫠",
flashCardTitle1: "Press and hold the top left key to start the firmware update.",
flashCardTitleDefy1: "Press the top left key to start the firmware update.",
flashCardTitleDefy1: "Don't hold the key, just press & release to start the firmware update.",
flashCardTitle2: "Release the key when the software prompts",
flashCardHelp: "Why do I need to press and hold a key when updating the device firmware?",
flashCardHelpDefy: "Why do I need to press a key when updating the device firmware?",
Expand Down
63 changes: 61 additions & 2 deletions src/renderer/modules/DeviceManager/CardDevice.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { forwardRef } from "react";
import React, { forwardRef, useState } from "react";
import { SortableKnob } from "react-easy-sort";
import log from "electron-log/renderer";

Expand All @@ -8,6 +8,18 @@ import { DeviceListType } from "@Renderer/types/DeviceManager";
import { DevicePreview } from "@Renderer/modules/DevicePreview";
import { Button } from "@Renderer/components/atoms/Button";
import { i18n } from "@Renderer/i18n";
import Store from "@Renderer/utils/Store";
import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
} from "@Renderer/components/atoms/AlertDialog";
import { Switch } from "@Renderer/components/atoms/Switch";

interface CardDeviceProps {
device: DeviceListType;
Expand All @@ -16,8 +28,12 @@ interface CardDeviceProps {
handleConnection: (value: number, action: "connect" | "disconnect") => Promise<void>;
}

const store = Store.getStore();

const CardDevice = forwardRef<HTMLDivElement, CardDeviceProps>((props, ref) => {
const { device, filterBy, openDialog, handleConnection } = props;
const [open, setOpen] = useState(false);
const [notShow, setNotShow] = useState<boolean>(store.get("settings.hideBluetoothExperimental"));

const filterAttribute = (filter: any) => {
switch (filter) {
Expand All @@ -42,6 +58,11 @@ const CardDevice = forwardRef<HTMLDivElement, CardDeviceProps>((props, ref) => {
}
};

const handleSetNotShow = (newValue: boolean) => {
setNotShow(newValue);
store.set("settings.hideBluetoothExperimental", newValue);
};

return (
<div
ref={ref}
Expand Down Expand Up @@ -98,7 +119,11 @@ const CardDevice = forwardRef<HTMLDivElement, CardDeviceProps>((props, ref) => {
<div className="card-footer bg-transparent border-none p-0.5 mt-auto">
<div className="card-footer--inner flex justify-between items-center rounded-[18px] p-4 bg-gray-25/80 dark:bg-gray-700/70 backdrop-blur-sm">
{device.available ? (
<Button variant={`${device.connected ? "outline" : "primary"}`} className="h-[52px]" onClick={handleSetIsConnected}>
<Button
variant={`${device.connected ? "outline" : "primary"}`}
className="h-[52px]"
onClick={!device.connected && device.device.type === "hid" && !notShow ? () => setOpen(true) : handleSetIsConnected}
>
{device.connected ? i18n.keyboardSelect.disconnect : "Configure"}
</Button>
) : (
Expand Down Expand Up @@ -127,6 +152,40 @@ const CardDevice = forwardRef<HTMLDivElement, CardDeviceProps>((props, ref) => {
</div> */}
</div>
</div>
<AlertDialog
open={open}
onOpenChange={(isOpen: boolean) => {
if (isOpen === true) return;
setOpen(false);
}}
>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>{i18n.deviceManager.dialogBluetoothExperimentalTitle}</AlertDialogTitle>
<AlertDialogDescription>{i18n.deviceManager.dialogBluetoothExperimentalDescription}</AlertDialogDescription>
<AlertDialogDescription>{i18n.deviceManager.dialogBluetoothExperimentalDisclaimer}</AlertDialogDescription>
<div className="flex items-center w-full justify-between py-2 mt-3 bg-gray-50 dark:bg-gray-700 rounded-md px-2">
<label htmlFor="customSwitch" className="m-0 text-sm font-semibold tracking-tight">
{`Don't ask me again`}
</label>
<Switch
id="customSwitch"
defaultChecked={false}
checked={notShow}
onCheckedChange={() => handleSetNotShow(!notShow)}
variant="default"
size="sm"
/>
</div>
</AlertDialogHeader>
<AlertDialogFooter className="!justify-between">
<AlertDialogCancel buttonVariant="outline">{`I'll use USB`}</AlertDialogCancel>
<AlertDialogAction onClick={handleSetIsConnected} buttonVariant="primary">
{`Ok, let's go!`}
</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
</div>
);
});
Expand Down
7 changes: 6 additions & 1 deletion src/renderer/modules/KeysTabs/LayersTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,9 @@ const LayersTab = ({
<p className="description text-ssm font-medium text-gray-400 dark:text-gray-200">
Tap the key to perform a normal keypress (like space or enter) or hold it to shift to the selected
layer. This allows for efficient layer access without sacrificing key real estate.
<br />
<br />
Add key on tap only works for layers 1 to 8.
</p>
</>
}
Expand Down Expand Up @@ -438,7 +441,9 @@ const LayersTab = ({
Tap the key to enter the selected layer for a single keypress; after that keypress, the software
automatically returns to the previous layer. You can also hold the key to stay in the layer while you
hold it. Double-tap it to lock into the layer; go back to the previous layer by tapping the key again.
It&apos;s crucial that the same key in the target layer is set up as TRANSPARENT.
<br />
<br />
OneShot layers only work for layers 1 to 8.
</p>
</>
}
Expand Down
1 change: 1 addition & 0 deletions src/renderer/types/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export interface StorageType {
backupFrequency: number;
language: string;
darkMode: string;
hideBluetoothExperimental?: boolean;
showDefaults: boolean;
isStandardView: boolean;
};
Expand Down
2 changes: 2 additions & 0 deletions src/renderer/utils/Store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const schema: Schema<StorageType> = {
backupFrequency: { type: "number" },
language: { type: "string" },
darkMode: { type: "string" },
hideBluetoothExperimental: { type: "boolean" },
showDefaults: { type: "boolean" },
isStandardView: { type: "boolean" },
autoUpdate: { type: "boolean" },
Expand All @@ -21,6 +22,7 @@ const schema: Schema<StorageType> = {
backupFrequency: 0,
language: "english",
darkMode: "system",
hideBluetoothExperimental: false,
showDefaults: false,
isStandardView: true,
autoUpdate: undefined,
Expand Down
Loading

0 comments on commit dbf5d9c

Please sign in to comment.