This repository has been archived by the owner on Aug 11, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Basic typescript * Working typescript setup * cant use react-components from react-components * js type * Do not remove sideEffects flag * Fix linter errors * Use shared tsconfig * bring back typings :/ * lintfix * Fix prettier command * Lint all files before comit * Remove redundant config * Use autoreply constant * Move enum * update ts * add type override * Remove redundant type * Fix imports after moving * Removeunused import * Jest ts config * Use babel-jest to handle typescript in tests
- Loading branch information
Showing
32 changed files
with
197 additions
and
169 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 |
---|---|---|
@@ -1,35 +1,43 @@ | ||
{ | ||
"plugins": [ | ||
"react", | ||
"react-hooks" | ||
], | ||
"parserOptions": { | ||
"ecmaVersion": 2018, | ||
"sourceType": "module", | ||
"ecmaFeatures": { | ||
"jsx": true | ||
"parser": "@typescript-eslint/parser", | ||
"plugins": ["react", "react-hooks", "@typescript-eslint"], | ||
"parserOptions": { | ||
"ecmaVersion": 2018, | ||
"sourceType": "module", | ||
"ecmaFeatures": { | ||
"jsx": true | ||
} | ||
}, | ||
"env": { | ||
"browser": true, | ||
"commonjs": true, | ||
"es6": true, | ||
"jest": true, | ||
"node": true | ||
}, | ||
"settings": { | ||
"react": { | ||
"version": "detect" | ||
}, | ||
"import/resolver": { | ||
"node": { | ||
"extensions": [".js", ".ts", ".tsx"] | ||
} | ||
} | ||
}, | ||
"extends": ["plugin:@typescript-eslint/recommended", "eslint:recommended", "plugin:react/recommended"], | ||
"rules": { | ||
"@typescript-eslint/explicit-function-return-type": "off", | ||
"@typescript-eslint/no-explicit-any": "off", | ||
"@typescript-eslint/indent": "off", | ||
"react/display-name": "off", | ||
"react/prop-types": "warn", | ||
"react-hooks/rules-of-hooks": "error", | ||
"no-console": [ | ||
"error", | ||
{ | ||
"allow": ["warn", "error"] | ||
} | ||
] | ||
} | ||
}, | ||
"env": { | ||
"browser": true, | ||
"commonjs": true, | ||
"es6": true, | ||
"jest": true, | ||
"node": true | ||
}, | ||
"settings": { | ||
"react": { | ||
"version": "detect" | ||
} | ||
}, | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:react/recommended" | ||
], | ||
"rules": { | ||
"react/display-name": "off", | ||
"react/prop-types": "warn", | ||
"react-hooks/rules-of-hooks": "error", | ||
"no-console": ["error", { "allow": ["warn", "error"] }] | ||
} | ||
} |
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
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
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 |
---|---|---|
|
@@ -7,4 +7,4 @@ SubTitle.propTypes = { | |
children: PropTypes.node.isRequired | ||
}; | ||
|
||
export default SubTitle; | ||
export default SubTitle; |
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 |
---|---|---|
|
@@ -7,4 +7,4 @@ Title.propTypes = { | |
children: PropTypes.node.isRequired | ||
}; | ||
|
||
export default Title; | ||
export default Title; |
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
This file was deleted.
Oops, something went wrong.
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,36 @@ | ||
import * as React from 'react'; | ||
import { useState } from 'react'; | ||
import { updateAutoresponder } from 'proton-shared/lib/api/mailSettings'; | ||
import useToggle from '../../components/toggle/useToggle'; | ||
import useEventManager from '../eventManager/useEventManager'; | ||
import useApiWithoutResult from '../../hooks/useApiWithoutResult'; | ||
import Toggle from '../../components/toggle/Toggle'; | ||
import { AutoResponder } from 'proton-shared/lib/interfaces/AutoResponder'; | ||
|
||
interface Props { | ||
autoresponder: AutoResponder; | ||
} | ||
|
||
const AutoReplyToggle = ({ autoresponder, ...rest }: Props) => { | ||
const { state, toggle } = useToggle(!!autoresponder.IsEnabled); | ||
const { call } = useEventManager(); | ||
const { request } = useApiWithoutResult(updateAutoresponder); | ||
const [loading, setLoading] = useState(false); | ||
|
||
const handleToggle = async ({ target }: React.ChangeEvent<HTMLInputElement>) => { | ||
try { | ||
setLoading(true); | ||
await request({ ...autoresponder, IsEnabled: target.checked }); | ||
await call(); | ||
setLoading(false); | ||
toggle(); | ||
} catch (error) { | ||
setLoading(false); | ||
throw error; | ||
} | ||
}; | ||
|
||
return <Toggle {...rest} loading={loading} checked={state} onChange={handleToggle} />; | ||
}; | ||
|
||
export default AutoReplyToggle; |
This file was deleted.
Oops, something went wrong.
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,16 @@ | ||
import * as React from 'react'; | ||
|
||
interface Props { | ||
plain: boolean; | ||
label: React.ReactNode; | ||
children: React.ReactNode; | ||
} | ||
|
||
const InfoLine = ({ label, children, plain = false }: Props) => ( | ||
<tr className="mb1 w100 aligntop"> | ||
<td className="pr1">{label}</td> | ||
<td className={`w100 ${plain ? '' : 'bold'}`}>{children}</td> | ||
</tr> | ||
); | ||
|
||
export default InfoLine; |
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
Oops, something went wrong.