Skip to content

Commit

Permalink
chore: eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
lijiahao committed Sep 20, 2024
1 parent d359f98 commit b91dbe7
Show file tree
Hide file tree
Showing 16 changed files with 625 additions and 604 deletions.
2 changes: 2 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ module.exports = {
parser: '@typescript-eslint/parser',
plugins: ['react-refresh'],
rules: {
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-expressions": "off",
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
Expand Down
30 changes: 18 additions & 12 deletions renderer/components/ActionBar.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useState, useEffect } from "react";
import { useTranslation } from 'react-i18next';
import { useEffect } from "react";
import { useTranslation } from "react-i18next";
import {
Button,
Dropdown,
Expand All @@ -9,10 +9,10 @@ import {
} from "@nextui-org/react";

function ActionBar(props) {
let lastMovement = 0;
const { t } = useTranslation();

useEffect(() => {
let lastMovement = 0;
const mouseEvent = () => {
lastMovement = Date.now();
};
Expand Down Expand Up @@ -51,38 +51,44 @@ function ActionBar(props) {

const handleDisplay = () => {
props.onDisplay && props.onDisplay();
}
};

const handlePressNexus = () => {
props.onPressNexus && props.onPressNexus();
}
};

const handleLongPressNexus = () => {
props.onLongPressNexus && props.onLongPressNexus();
}
};

return (
<div id="actionBar">
<Dropdown>
<DropdownTrigger>
<Button variant="bordered" size="sm">
{t('Menu')}
{t("Menu")}
</Button>
</DropdownTrigger>
<DropdownMenu aria-label="Static Actions">
<DropdownItem key="performance" onClick={handleTogglePerformance}>
{t('Toggle Performance')}
{t("Toggle Performance")}
</DropdownItem>
<DropdownItem key="display" onClick={handleDisplay}>
{t("Display settings")}
</DropdownItem>
<DropdownItem key="pressNexus" onClick={handlePressNexus}>
{t("Press Nexus")}
</DropdownItem>
<DropdownItem key="longPressNexus" onClick={handleLongPressNexus}>
{t("Long press Nexus")}
</DropdownItem>
<DropdownItem key="display" onClick={handleDisplay}>{t('Display settings')}</DropdownItem>
<DropdownItem key="pressNexus" onClick={handlePressNexus}>{t('Press Nexus')}</DropdownItem>
<DropdownItem key="longPressNexus" onClick={handleLongPressNexus}>{t('Long press Nexus')}</DropdownItem>
<DropdownItem
key="disconnect"
className="text-danger"
color="danger"
onClick={handleDisconnect}
>
{t('Disconnect')}
{t("Disconnect")}
</DropdownItem>
</DropdownMenu>
</Dropdown>
Expand Down
40 changes: 22 additions & 18 deletions renderer/components/Alert.tsx
Original file line number Diff line number Diff line change
@@ -1,30 +1,34 @@
import {Modal, ModalContent, ModalHeader, ModalBody, ModalFooter, Button} from "@nextui-org/react";
import {
Modal,
ModalContent,
ModalHeader,
ModalBody,
ModalFooter,
Button,
} from "@nextui-org/react";

function Alert(props) {

const handleConfirm = () => {
props.onClose && props.onClose()
}
props.onClose && props.onClose();
};

return (
<Modal isOpen={true} scrollBehavior="inside" onClose={handleConfirm}>
<ModalContent>
{(onClose) => (
<>
<ModalHeader className="flex flex-col gap-1">{ props.title || 'Warning' }</ModalHeader>
<ModalBody className="scroll">
{ props.content }
</ModalBody>
<ModalFooter>
<Button color="primary" onPress={handleConfirm}>
Confirm
</Button>
</ModalFooter>
</>
)}
<>
<ModalHeader className="flex flex-col gap-1">
{props.title || "Warning"}
</ModalHeader>
<ModalBody className="scroll">{props.content}</ModalBody>
<ModalFooter>
<Button color="primary" onPress={handleConfirm}>
Confirm
</Button>
</ModalFooter>
</>
</ModalContent>
</Modal>
);
}

export default Alert
export default Alert;
21 changes: 14 additions & 7 deletions renderer/components/AuthModal.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
import React from 'react'
import {Modal, ModalContent, ModalHeader, ModalBody, ModalFooter, Button} from "@nextui-org/react"
import React from "react";
import {
Modal,
ModalContent,
ModalHeader,
ModalBody,
ModalFooter,
Button,
} from "@nextui-org/react";
// import { useTranslation } from 'react-i18next';

const AuthModal = ({ show, onConfirm }) => {
// const { t } = useTranslation()

const handleConfirm = () => {
onConfirm && onConfirm()
}
onConfirm && onConfirm();
};

return (
<Modal isOpen={show} hideCloseButton={true}>
Expand All @@ -25,7 +32,7 @@ const AuthModal = ({ show, onConfirm }) => {
</>
</ModalContent>
</Modal>
)
}
);
};

export default AuthModal
export default AuthModal;
Loading

0 comments on commit b91dbe7

Please sign in to comment.