-
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.
Merge branch 'cli' of https://github.com/williamluke4/Nitro into cli
- Loading branch information
Showing
51 changed files
with
1,228 additions
and
689 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,6 +1,3 @@ | ||
{ | ||
"extends": [ | ||
"oclif", | ||
"oclif-typescript" | ||
] | ||
"extends": ["oclif", "oclif-typescript"] | ||
} |
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,30 +1,28 @@ | ||
module.exports = { | ||
parser: '@typescript-eslint/parser', // Specifies the ESLint parser | ||
extends: [ | ||
module.exports = { | ||
parser: "@typescript-eslint/parser", // Specifies the ESLint parser | ||
extends: [ | ||
"eslint:recommended", | ||
'plugin:@typescript-eslint/recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin | ||
'prettier/@typescript-eslint', // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier | ||
'plugin:prettier/recommended', // Enables eslint-plugin-prettier and displays prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array. | ||
"plugin:@typescript-eslint/recommended", // Uses the recommended rules from the @typescript-eslint/eslint-plugin | ||
"prettier/@typescript-eslint", // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier | ||
"plugin:prettier/recommended", // Enables eslint-plugin-prettier and displays prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array. | ||
"plugin:react/recommended", | ||
], | ||
"env": { | ||
"node": true, | ||
"commonjs": true | ||
env: { | ||
node: true, | ||
commonjs: true, | ||
}, | ||
plugins:[ | ||
"react-hooks" | ||
], | ||
parserOptions: { | ||
"ecmaFeatures": { | ||
"jsx": true | ||
plugins: ["react-hooks"], | ||
parserOptions: { | ||
ecmaFeatures: { | ||
jsx: true, | ||
}, | ||
ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features | ||
sourceType: 'module', // Allows for the use of imports | ||
ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features | ||
sourceType: "module", // Allows for the use of imports | ||
}, | ||
rules: { | ||
"react/prop-types": 0, | ||
"@typescript-eslint/explicit-function-return-type": 0, | ||
"react-hooks/rules-of-hooks": "error", | ||
"react-hooks/exhaustive-deps": "warn" | ||
} | ||
}; | ||
"react-hooks/exhaustive-deps": "warn", | ||
}, | ||
}; |
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,7 +1,7 @@ | ||
module.exports = { | ||
semi: true, | ||
trailingComma: 'all', | ||
singleQuote: true, | ||
printWidth: 120, | ||
tabWidth: 2, | ||
}; | ||
module.exports = { | ||
semi: true, | ||
trailingComma: "all", | ||
singleQuote: true, | ||
printWidth: 120, | ||
tabWidth: 2, | ||
}; |
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,76 +1,98 @@ | ||
import React from 'react'; | ||
import { makeStyles } from '@material-ui/core/styles'; | ||
import Avatar from '@material-ui/core/Avatar'; | ||
import { Typography, Button, Paper, List, ListItem, Popover } from '@material-ui/core'; | ||
import { useAuth } from 'use-auth0'; | ||
import ExitToApp from '@material-ui/icons/ExitToApp'; | ||
import React from "react"; | ||
import { makeStyles } from "@material-ui/core/styles"; | ||
import Avatar from "@material-ui/core/Avatar"; | ||
import { | ||
Typography, | ||
Button, | ||
Paper, | ||
List, | ||
ListItem, | ||
Popover, | ||
} from "@material-ui/core"; | ||
import { useAuth } from "use-auth0"; | ||
import ExitToApp from "@material-ui/icons/ExitToApp"; | ||
|
||
const useStyles = makeStyles({ | ||
avatar: { | ||
marginRight: 10 | ||
marginRight: 10, | ||
}, | ||
root: { | ||
marginLeft: "auto", | ||
display: 'flex', | ||
display: "flex", | ||
padding: "10px 10px", | ||
}, | ||
text: { | ||
margin: 'auto' | ||
margin: "auto", | ||
}, | ||
dropDownIcon: { | ||
marginRight: 8 | ||
} | ||
marginRight: 8, | ||
}, | ||
}); | ||
|
||
export function User() { | ||
const classes = useStyles(); | ||
const { isAuthenticated, login, logout, user } = useAuth(); | ||
const [anchorEl, setAnchorEl] = React.useState<HTMLButtonElement | null>(null); | ||
const handleOpen = (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => { | ||
setAnchorEl(event.currentTarget) | ||
} | ||
const [anchorEl, setAnchorEl] = React.useState<HTMLButtonElement | null>( | ||
null | ||
); | ||
const handleOpen = ( | ||
event: React.MouseEvent<HTMLButtonElement, MouseEvent> | ||
) => { | ||
setAnchorEl(event.currentTarget); | ||
}; | ||
const handleClose = () => { | ||
setAnchorEl(null); | ||
} | ||
}; | ||
const open = Boolean(anchorEl); | ||
const id = open ? 'simple-popover' : undefined; | ||
if(isAuthenticated() && user){ | ||
const id = open ? "simple-popover" : undefined; | ||
if (isAuthenticated() && user) { | ||
return ( | ||
<> | ||
<Button aria-describedby={id} className={classes.root} onClick={handleOpen} color="secondary"> | ||
<Avatar alt={user.name} src={user.picture} className={classes.avatar} /> | ||
<Typography className={classes.text} variant="body2">{user.name}</Typography> | ||
</Button> | ||
<Popover | ||
id={id} | ||
open={open} | ||
anchorEl={anchorEl} | ||
onClose={handleClose} | ||
anchorOrigin={{ | ||
vertical: 'bottom', | ||
horizontal: 'right', | ||
}} | ||
transformOrigin={{ | ||
vertical: 'top', | ||
horizontal: 'right', | ||
}} | ||
> | ||
<Paper> | ||
<List> | ||
<ListItem button onClick={logout}> | ||
<ExitToApp className={classes.dropDownIcon}/> | ||
Logout | ||
</ListItem> | ||
</List> | ||
</Paper> | ||
<Button | ||
aria-describedby={id} | ||
className={classes.root} | ||
onClick={handleOpen} | ||
color="secondary" | ||
> | ||
<Avatar | ||
alt={user.name} | ||
src={user.picture} | ||
className={classes.avatar} | ||
/> | ||
<Typography className={classes.text} variant="body2"> | ||
{user.name} | ||
</Typography> | ||
</Button> | ||
<Popover | ||
id={id} | ||
open={open} | ||
anchorEl={anchorEl} | ||
onClose={handleClose} | ||
anchorOrigin={{ | ||
vertical: "bottom", | ||
horizontal: "right", | ||
}} | ||
transformOrigin={{ | ||
vertical: "top", | ||
horizontal: "right", | ||
}} | ||
> | ||
<Paper> | ||
<List> | ||
<ListItem button onClick={logout}> | ||
<ExitToApp className={classes.dropDownIcon} /> | ||
Logout | ||
</ListItem> | ||
</List> | ||
</Paper> | ||
</Popover> | ||
</> | ||
); | ||
} else { | ||
return( | ||
return ( | ||
<Button color="secondary" className={classes.root} onClick={login}> | ||
Login | ||
Login | ||
</Button> | ||
) | ||
} | ||
} | ||
); | ||
} | ||
} |
Oops, something went wrong.