Skip to content

Commit

Permalink
Merge pull request #2 from mrowe009/admin-overhaul
Browse files Browse the repository at this point in the history
Admin overhaul
  • Loading branch information
srowe0091 authored Apr 27, 2020
2 parents 893b976 + e07d0f5 commit 479891c
Show file tree
Hide file tree
Showing 30 changed files with 366 additions and 136 deletions.
5 changes: 0 additions & 5 deletions .huskyrc

This file was deleted.

6 changes: 4 additions & 2 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
semi: false,
"semi": false,
"printWidth": 120,
"singleQuote": true
"singleQuote": true,
"trailingComma": "none",
"arrowParens": "avoid"
}
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
### TODO:

- (Feature): Enhance toolbar to scroll away animate
- (Feature): Edit transactions - long hold
- (Feature): Edit transactions - long hold
- (Feature): Auto refresh user info when user added into group
- (Bug): Log user out when session expires during graphql request
Binary file added designs/idea5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added designs/idea6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
187 changes: 185 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
"android:copy": "ionic capacitor copy android",
"android:initial": "ionic capacitor add android"
},
"hooks": {
"pre-commit": "pretty-quick --staged"
},
"repository": {
"type": "git",
"url": "git+https://github.com/mrowe009/FinanceApp.git"
Expand Down Expand Up @@ -46,6 +49,7 @@
},
"devDependencies": {
"@capacitor/cli": "2.0.1",
"husky": "^4.2.5",
"prettier": "^2.0.4",
"pretty-quick": "^2.0.1"
},
Expand Down
3 changes: 3 additions & 0 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ const client = new ApolloClient({
}
})
}
// onError: ({ graphQLErrors }) => {
// // handle when session expires during GraphQL request
// }
})

const App = () => (
Expand Down
4 changes: 2 additions & 2 deletions src/components/AuthorizedRoute.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import { useAuthentication, useUser } from 'modules/authentication'

export const AuthorizedRoute = ({ path, admin, component }) => {
const { isAuthenticated } = useAuthentication()
const { role } = useUser()
const { isAdmin } = useUser()

if (!isAuthenticated) {
return <Redirect to={routes.login} />
}

if (admin && role !== 'ADMIN') {
if (admin && !isAdmin) {
return <Redirect to={routes.home} />
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/FullPageLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ export const RelativeLoader = () => {
</div>
</IonContent>
)
}
}
10 changes: 7 additions & 3 deletions src/components/Transaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const useTransactionStyles = createUseStyles(theme => ({
transaction: {
marginBottom: theme.spacing(2),
borderRadius: theme.spacing(1),
boxShadow: '0px 2px 5px -2px var(--black)',
boxShadow: '0px 2px 5px -2px var(--black)'
},
label: {
display: 'flex',
Expand Down Expand Up @@ -41,14 +41,18 @@ export const TransactionEntry = ({ id, amount, description, createdAt, onCheckbo
<IonLabel>
<span className={classes.label}>
<span>
<p>{description || (<span color="textSecondary">(blank)</span>)}</p>
<p>{description || <span color="textSecondary">(blank)</span>}</p>
<p color="textSecondary" variant="caption">
{formatDate(createdAt)}
</p>
</span>
<span>
<p>${(amount / 100).toFixed(2)}</p>
{group && <p color="textSecondary" variant="caption" align="right">group</p>}
{group && (
<p color="textSecondary" variant="caption" align="right">
group
</p>
)}
</span>
</span>
</IonLabel>
Expand Down
13 changes: 11 additions & 2 deletions src/elements/Input.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ const useAutoFocus = autoFocus => {
export const Input = ({ className, onChange, onBlur, autoFocus, ...rest }) => {
const classes = useInputStyles()
const element = useAutoFocus(autoFocus)
return <input ref={element} className={clsx(className, classes.input)} onBlur={onBlur} onChange={onChange} {...rest} />
return (
<input ref={element} className={clsx(className, classes.input)} onBlur={onBlur} onChange={onChange} {...rest} />
)
}

Input.propTypes = {
Expand All @@ -63,7 +65,14 @@ export const MaskedInput = ({ className, onChange, onBlur, format, value, autoFo
)

return (
<input ref={element} className={clsx(className, classes.input)} onBlur={onBlur} onChange={_onChange} value={_value} {...rest} />
<input
ref={element}
className={clsx(className, classes.input)}
onBlur={onBlur}
onChange={_onChange}
value={_value}
{...rest}
/>
)
}

Expand Down
2 changes: 1 addition & 1 deletion src/modules/admin/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ export const useUsersTabStyles = createUseStyles(theme => ({
wrapper: {
margin: theme.spacing(2, 2, 0)
}
}))
}))
Loading

0 comments on commit 479891c

Please sign in to comment.