-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ui): Add eslint and prettier, reformat code and fix ts errors
- Loading branch information
Showing
25 changed files
with
2,965 additions
and
936 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
module.exports = { | ||
env: { | ||
browser: true, | ||
es2021: true, | ||
jest: true | ||
}, | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:react/recommended', | ||
'plugin:prettier/recommended' | ||
], | ||
overrides: [ | ||
{ | ||
env: { | ||
node: true | ||
}, | ||
files: ['.eslintrc.{js,cjs}'], | ||
parserOptions: { | ||
sourceType: 'script' | ||
} | ||
} | ||
], | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
ecmaVersion: 'latest', | ||
sourceType: 'module' | ||
}, | ||
plugins: ['@typescript-eslint', 'react'], | ||
rules: { | ||
'react/react-in-jsx-scope': 'off', | ||
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }] | ||
}, | ||
settings: { | ||
react: { | ||
version: 'detect' | ||
} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"semi": true, | ||
"tabWidth": 2, | ||
"printWidth": 100, | ||
"singleQuote": true, | ||
"trailingComma": "none", | ||
"jsxBracketSameLine": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,46 @@ | ||
import { useDeviceModel } from "../../hooks/useSoundcoreDevice"; | ||
import { ANCModes } from "../../types/tauri-backend"; | ||
import BaseANCModeCard, { ANCSliderProps } from "./base"; | ||
import { useDeviceModel } from '../../hooks/useSoundcoreDevice'; | ||
import { ANCModes } from '../../types/tauri-backend'; | ||
import BaseANCModeCard from './base'; | ||
|
||
export default function ANCModeCard() { | ||
let { data: model } = useDeviceModel(); | ||
let Component = (props: ANCSliderProps) => <div />; | ||
let ancButtons: Array<[string, ANCModes]> = []; | ||
let transButtons: Array<[string, ANCModes]> = []; | ||
|
||
switch (model) { | ||
case "A3935": | ||
case "A3951": | ||
Component = BaseANCModeCard; | ||
ancButtons = | ||
[ | ||
["Transport", { mode: "AncTransportMode" }], | ||
["Outdoor", { mode: "AncOutdoorMode" }], | ||
["Indoor", { mode: "AncIndoorMode" }], | ||
["Custom", { mode: "AncCustomValue", value: 0 }] | ||
]; | ||
transButtons = [ | ||
["Fully Trasparent", { mode: "TransparencyFullyTransparentMode" }], | ||
["Vocal Mode", { mode: "TransparencyVocalMode" }] | ||
]; | ||
break; | ||
case "A3027": | ||
case "A3028": | ||
case "A3029": | ||
Component = BaseANCModeCard; | ||
ancButtons = | ||
[ | ||
["Transport", { mode: "AncTransportMode" }], | ||
["Outdoor", { mode: "AncOutdoorMode" }], | ||
["Indoor", { mode: "AncIndoorMode" }], | ||
]; | ||
transButtons = [["Fully Trasparent", { mode: "TransparencyFullyTransparentMode"}]]; | ||
break; | ||
default: | ||
Component = () => <div>Not implemented</div>; | ||
break; | ||
} | ||
|
||
console.log("Model: " + model); | ||
|
||
return ( | ||
<Component ancModes={ancButtons} transModes={transButtons} /> | ||
) | ||
} | ||
const { data: model } = useDeviceModel(); | ||
let Component = () => <div />; | ||
let ancButtons: Array<[string, ANCModes]> = []; | ||
let transButtons: Array<[string, ANCModes]> = []; | ||
const defaultComponent = () => { | ||
return <div>Not implemented</div>; | ||
}; | ||
switch (model) { | ||
case 'A3935': | ||
case 'A3951': | ||
Component = BaseANCModeCard; | ||
ancButtons = [ | ||
['Transport', { mode: 'AncTransportMode' }], | ||
['Outdoor', { mode: 'AncOutdoorMode' }], | ||
['Indoor', { mode: 'AncIndoorMode' }], | ||
['Custom', { mode: 'AncCustomValue', value: 0 }] | ||
]; | ||
transButtons = [ | ||
['Fully Trasparent', { mode: 'TransparencyFullyTransparentMode' }], | ||
['Vocal Mode', { mode: 'TransparencyVocalMode' }] | ||
]; | ||
break; | ||
case 'A3027': | ||
case 'A3028': | ||
case 'A3029': | ||
Component = BaseANCModeCard; | ||
ancButtons = [ | ||
['Transport', { mode: 'AncTransportMode' }], | ||
['Outdoor', { mode: 'AncOutdoorMode' }], | ||
['Indoor', { mode: 'AncIndoorMode' }] | ||
]; | ||
transButtons = [['Fully Trasparent', { mode: 'TransparencyFullyTransparentMode' }]]; | ||
break; | ||
default: | ||
Component = defaultComponent; | ||
break; | ||
} | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-expect-error | ||
return <Component ancModes={ancButtons} transModes={transButtons} />; | ||
} |
Oops, something went wrong.