adapting and shit
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
import { Link } from 'react-router-dom'
|
||||
import { message } from 'antd'
|
||||
import { useUserContext } from '../../contexts/UserContext'
|
||||
|
||||
import './style.scss'
|
||||
|
||||
type Props = {
|
||||
selectProfile: (id: string) => void
|
||||
}
|
||||
|
||||
export const AccountSelect = ({ selectProfile }: Props) => {
|
||||
const { accounts } = useUserContext()
|
||||
|
||||
const handleSelect = (id: string) => {
|
||||
selectProfile(id)
|
||||
message.success(`Selected Account: ${id}`)
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<h1>Select Account</h1>
|
||||
<div className="account-select">
|
||||
{accounts?.length
|
||||
? accounts.map((account) => (
|
||||
<button
|
||||
key={`account-${account.name}`}
|
||||
onClick={() => handleSelect(account.id)}
|
||||
>
|
||||
{account.name}
|
||||
</button>
|
||||
))
|
||||
: ''}
|
||||
<Link to="/account/new">Create New Budget!</Link>
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user