-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 🔥 [EXL-76] account settings page ready
account settings page ready
- Loading branch information
tal-rofe
committed
Sep 14, 2022
1 parent
7aa8e02
commit 1e987fd
Showing
79 changed files
with
1,425 additions
and
644 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
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 |
---|---|---|
@@ -1,5 +1,9 @@ | ||
import type { User } from '@prisma/client'; | ||
|
||
export interface IAutoAuthLoggedUser extends Pick<User, 'id' | 'name'> {} | ||
export interface IAutoAuthLoggedUser extends Pick<User, 'id' | 'name' | 'createdAt'> {} | ||
|
||
export interface IAutoAuthLoggedUserResponse extends Pick<User, 'id' | 'name'> { | ||
readonly createdAt: number; | ||
} | ||
|
||
export interface IExternalLoggedUser extends Pick<User, 'id' | 'authType'> {} |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
56 changes: 56 additions & 0 deletions
56
apps/frontend/src/components/containers/AccountSettings/Account/Account.module.scss
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,56 @@ | ||
@use 'sass:map'; | ||
|
||
@import '../../../../styles/variables.scss'; | ||
|
||
.container { | ||
display: flex; | ||
flex-direction: column; | ||
width: 708px; | ||
} | ||
|
||
.actionSection { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: flex-start; | ||
|
||
&:not(:last-child) { | ||
margin-bottom: map.get($sizes, spacing-xxl); | ||
} | ||
|
||
&__header { | ||
font-size: 2.4rem; | ||
font-weight: normal; | ||
color: map.get($colors, greys-onyx); | ||
|
||
&--delete { | ||
color: map.get($colors, reds-persian-plum); | ||
} | ||
} | ||
|
||
&__divider { | ||
width: 100%; | ||
height: 2px; | ||
margin-block: map.get($sizes, spacing-l); | ||
background-color: map.get($colors, greys-platinum); | ||
} | ||
|
||
&__subHeader { | ||
margin-bottom: map.get($sizes, spacing-m); | ||
font-size: 1.5rem; | ||
color: map.get($colors, greys-independence-grey); | ||
} | ||
|
||
&__button { | ||
padding: map.get($sizes, spacing-m) map.get($sizes, spacing-l); | ||
font-size: 1.5rem; | ||
color: map.get($colors, greys-onyx); | ||
background-color: map.get($colors, whites-ghost-white); | ||
border: 2px solid map.get($colors, greys-platinum); | ||
border-radius: 6px; | ||
|
||
&--delete { | ||
font-weight: 500; | ||
color: map.get($colors, reds-persian-plum); | ||
} | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
apps/frontend/src/components/containers/AccountSettings/Account/Account.tsx
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,45 @@ | ||
import React, { useState } from 'react'; | ||
import { connect } from 'react-redux'; | ||
import type { PayloadAction } from '@reduxjs/toolkit'; | ||
import { useNavigate } from 'react-router-dom'; | ||
|
||
import { authActions } from '@/store/reducers/auth'; | ||
|
||
import AccountView from './Account.view'; | ||
|
||
interface IPropsFromDispatch { | ||
readonly setUnauthenticated: () => PayloadAction; | ||
} | ||
|
||
interface IProps extends IPropsFromDispatch {} | ||
|
||
const Account: React.FC<IProps> = (props: React.PropsWithChildren<IProps>) => { | ||
const navigate = useNavigate(); | ||
|
||
const [isDeleteAccountModalOnViewState, setIsDeleteAccountModalOnViewState] = useState<boolean>(false); | ||
|
||
const onSignOutClick = () => { | ||
props.setUnauthenticated(); | ||
|
||
navigate('/auth'); | ||
}; | ||
|
||
const onOpenDeleteAccountModal = () => setIsDeleteAccountModalOnViewState(() => true); | ||
const onCloseDeleteAccountModal = () => setIsDeleteAccountModalOnViewState(() => false); | ||
|
||
return ( | ||
<AccountView | ||
isDeleteAccountModalOnView={isDeleteAccountModalOnViewState} | ||
onSignOutClick={onSignOutClick} | ||
onOpenDeleteAccountModal={onOpenDeleteAccountModal} | ||
onCloseDeleteAccountModal={onCloseDeleteAccountModal} | ||
/> | ||
); | ||
}; | ||
|
||
Account.displayName = 'Account'; | ||
Account.defaultProps = {}; | ||
|
||
export default connect(null, { | ||
setUnauthenticated: authActions.setUnauthenticated, | ||
})(React.memo(Account)); |
75 changes: 75 additions & 0 deletions
75
apps/frontend/src/components/containers/AccountSettings/Account/Account.view.tsx
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,75 @@ | ||
import React from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
|
||
import { concatClasses } from '@/utils/component'; | ||
|
||
import DeleteAccountModal from './DeleteAccountModal'; | ||
|
||
import classes from './Account.module.scss'; | ||
|
||
interface IProps { | ||
readonly isDeleteAccountModalOnView: boolean; | ||
readonly onSignOutClick: VoidFunction; | ||
readonly onOpenDeleteAccountModal: VoidFunction; | ||
readonly onCloseDeleteAccountModal: VoidFunction; | ||
} | ||
|
||
const AccountView: React.FC<IProps> = (props: React.PropsWithChildren<IProps>) => { | ||
const { t } = useTranslation(); | ||
|
||
return ( | ||
<main className={classes['container']}> | ||
<section className={classes['actionSection']}> | ||
<h3 className={classes['actionSection__header']}> | ||
{t('accountSettings.account.signOutHeader')} | ||
</h3> | ||
<hr className={classes['actionSection__divider']} /> | ||
<span className={classes['actionSection__subHeader']}> | ||
{t('accountSettings.account.signOutSubHeader')} | ||
</span> | ||
<button | ||
className={classes['actionSection__button']} | ||
type="button" | ||
onClick={props.onSignOutClick} | ||
> | ||
{t('accountSettings.account.signOutButton')} | ||
</button> | ||
</section> | ||
|
||
<section className={classes['actionSection']}> | ||
<h3 | ||
className={concatClasses( | ||
classes, | ||
'actionSection__header', | ||
'actionSection__header--delete', | ||
)} | ||
> | ||
{t('accountSettings.account.deleteAccountHeader')} | ||
</h3> | ||
<hr className={classes['actionSection__divider']} /> | ||
<span className={classes['actionSection__subHeader']}> | ||
{t('accountSettings.account.deleteAccountSubHeader')} | ||
</span> | ||
<button | ||
className={concatClasses( | ||
classes, | ||
'actionSection__button', | ||
'actionSection__button--delete', | ||
)} | ||
type="button" | ||
onClick={props.onOpenDeleteAccountModal} | ||
> | ||
{t('accountSettings.account.deleteAccountButton')} | ||
</button> | ||
{props.isDeleteAccountModalOnView && ( | ||
<DeleteAccountModal onClose={props.onCloseDeleteAccountModal} /> | ||
)} | ||
</section> | ||
</main> | ||
); | ||
}; | ||
|
||
AccountView.displayName = 'AccountView'; | ||
AccountView.defaultProps = {}; | ||
|
||
export default React.memo(AccountView); |
Oops, something went wrong.