Skip to content

Commit

Permalink
deposit page
Browse files Browse the repository at this point in the history
  • Loading branch information
LucSPI committed May 23, 2023
1 parent 4669ea1 commit 5579582
Show file tree
Hide file tree
Showing 13 changed files with 339 additions and 148 deletions.
140 changes: 120 additions & 20 deletions src/assets/icons.tsx

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions src/components/Detail/Deposit.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@

const Deposit: React.FC = () => {
return (
<div className="ml-10 w-full">
<div className="flex justify-center">Coming Soon</div>
<div className='ml-10 w-[70vw] h-[88vh] border rounded-md'>
<div className='border-b w-full py-4 px-6 font-medium text-lg'>
Payment Detail
</div>
</div>
);
};
Expand Down
6 changes: 4 additions & 2 deletions src/components/Detail/Preferences.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
const Preferences: React.FC = () => {
return (
<div className="ml-10 w-full">
<div className="flex justify-center">Coming Soon</div>
<div className='ml-10 w-[70vw] h-[88vh] border rounded-md'>
<div className='border-b w-full py-4 px-6 font-medium text-lg'>
Preference Detail
</div>
</div>
);
};
Expand Down
201 changes: 119 additions & 82 deletions src/components/Detail/Profile.tsx
Original file line number Diff line number Diff line change
@@ -1,92 +1,110 @@
// import User from '~/assets/img/user_large.png'
import { useEffect } from 'react'
import { useNavigate } from 'react-router-dom'
import { Bullet } from '~/assets/icons'
import Star from '~/assets/img/Star.png'
import { Achievement, HistoryIcon } from '~/assets/icons'
import { useAuth } from '~/providers/AuthProvider'
import { ColumnDefinitionType, Image, Table } from '../UI'
import { ColumnDefinitionType, Image, Table, Star } from '../UI'
type ChessResult = 'Won' | 'LOST';

type ChessResult = 'WIN' | 'LOST';
type ChessType = {
category: string;
time: number;
}
interface History {
type: ChessType;
result: ChessResult;
timeclass: string;
category?: string;
time: number;

bet_amount: number;
opponent: string;
wager: number;
result: ChessResult;
edit?: string; // optional, same as string | undefined
}
const data: History[] = [
{
type: {category: 'Standard', time: 10},
result: 'WIN',
opponent:'Olivia Rhye',
wager: 100.00,
edit: '1'
},
{
type: {category: 'Standard', time: 10},
result: 'WIN',
opponent:'Olivia Rhye',
wager: 100.00,
edit: '1'
},
{
type: {category: 'Standard', time: 10},
result: 'WIN',
opponent:'Olivia Rhye',
wager: 100.00,
edit: '1'
},
{
type: {category: 'Standard', time: 10},
result: 'WIN',
opponent:'Olivia Rhye',
wager: 100.00,
edit: '1'
},
{
type: {category: 'Standard', time: 10},
result: 'WIN',
timeclass: 'bullet',
time: 1,
bet_amount: 1,
result: 'Won',
opponent:'Olivia Rhye',
wager: 100.00,
edit: '1'
},
{
type: {category: 'Standard', time: 10},
result: 'WIN',
opponent:'Olivia Rhye',
wager: 100.00,
edit: '1'
},
timeclass: 'standard',
time: 1,
bet_amount: 1,
result: 'Won',
opponent:'Olivia Rhye',
edit: '1'
},
{
timeclass: 'blitz',
time: 1,
bet_amount: 1,
result: 'Won',
opponent:'Olivia Rhye',
edit: '1'
},
{
timeclass: 'rapid',
time: 1,
bet_amount: 1,
result: 'Won',
opponent:'Olivia Rhye',
edit: '1'
},
{
timeclass: 'standard',
time: 1,
bet_amount: 1,
result: 'Won',
opponent:'Olivia Rhye',
edit: '1'
},

];

const columns: ColumnDefinitionType<History, keyof History>[] = [
{
key: 'type',
header: 'Mactch Type',
width: 150,
key: 'category',
header: 'Category',
},
{
key: 'result',
header: 'Result',
key: 'time',
header: 'Time',
},
{
key: 'bet_amount',
header: 'Bet Amount ($)',
},
{
key: 'opponent',
header: 'Opponent',
},
{
key: 'wager',
header: 'Wager',
key: 'result',
header: 'Results',
},
{
key: 'edit',
header: '',
width: '50px',
},
];

const achievementList = [
{
category: 'bullet',
score: 3259
},
{
category: 'standard',
score: 3259
},
{
category: 'rapid',
score: 3259
},
{
category: 'blitz',
score: 3259
}
]
const ProfileDetails: React.FC = () => {
const { user, isAuthenticated } = useAuth();
const navigate = useNavigate();
Expand All @@ -96,38 +114,57 @@ const ProfileDetails: React.FC = () => {
}
},[])
return (
<div className="ml-10 pr-14 w-full overflow-y-auto overflow-x-hidden max-h-[83vh]">
<div className="flex items-center gap-6">
<Image source={user?.picture} className="w-[100px] h-[100px] rounded-full" />
<div className="flex flex-col">
<p className="font-bold text-2xl">{user?.nickname}</p>
<p className="text-base text-gray-600">LVL 24</p>
</div>
<div className='ml-10 w-[70vw] h-[88vh] border rounded-md'>
<div className='border-b w-full py-4 px-6 font-medium text-lg'>
Account Detail
</div>
<div className="flex flex-col mt-5">
<p className="font-bold text-2xl">Achievements</p>
<div className="flex items-center gap-12">
<div className="flex flex-col items-center gap-3">
<Image source={Star} className="w-[80px] h-[80px]" />
<Bullet className="w-[20px] h-[25px]" />
<p className="font-bold text-xl text-purple-100">1254</p>
<div className="w-full overflow-y-auto overflow-x-hidden p-6 max-h-[81vh]">
<div className="flex items-center gap-6">
<Image source={user?.picture} className="w-32 h-32 rounded-md" />
<div className="flex flex-col justify-between h-32">
<p className="font-bold text-lg">{user?.nickname}</p>
<p className="text-base">{user?.nickname}</p>
<p className="font-bold text-lg">Level: 24</p>
</div>
<div className="flex flex-col items-center gap-3">
<Image source={Star} className="w-[80px] h-[80px]" />
<Bullet className="w-[20px] h-[25px]" />
<p className="font-bold text-xl text-purple-100">1254</p>
</div>
<div className="flex flex-col mt-5">
<p className="flex items-center gap-2 font-bold text-base my-6"><Achievement color='white'/>Achievements</p>
<div className="flex items-center gap-8 pl-6">
{
achievementList.length > 0
?
achievementList?.map((achievement) => {
return(
<Star
text= {achievement.category}
score={achievement.score}
/>
)
})
:
<p className='mx-auto my-10 text-[#667085]'>You have nothing to show for so far...</p>
}
</div>
<div className="flex flex-col items-center gap-3">
<Image source={Star} className="w-[80px] h-[80px]" />
<Bullet className="w-[20px] h-[25px]" />
<p className="font-bold text-xl text-purple-100">1254</p>
</div>
<div className="mt-5">
<p className="flex items-center gap-2 font-bold text-base my-6"><HistoryIcon />History</p>
<div className='flex flex-col justify-center border-[1px] h-fit col-span-8 border-[#B4C7D8] shadow-3xl rounded-xl'>
<div className="space-x-2 px-4 py-4">
<span className="text-lg font-medium">Past Matches</span>
<span className="bg-[#F9F5FF] rounded-xl px-2 py-1 text-xs text-purple-100 ">
125 Matches
</span>
</div>
<Table
data={data}
columns={columns}
headClass="bg-[#F9FAFB]"
tableClass="table-fixed"
selectable
/>
</div>
</div>
</div>
<div className="mt-5">
<p className="font-bold text-2xl mb-2">History</p>
<Table data={data} columns={columns} />
</div>
</div>
);
};
Expand Down
86 changes: 51 additions & 35 deletions src/components/Detail/SideBar.tsx
Original file line number Diff line number Diff line change
@@ -1,51 +1,67 @@
import { Sidebar, Menu, MenuItem } from 'react-pro-sidebar';

import { Link } from 'react-router-dom';
import { useAuth } from '~/providers/AuthProvider';
import { appActions, useTrackedStore } from '~/store';
import { PaymentIcon, ProfileIcon, PreferenceIcon, LogoutIcon } from '~/assets/icons'
const SideBar: React.FC = () => {
const { signOut } = useAuth();
const detailMode = useTrackedStore().profile.currentTab();

const onLogout = () => signOut();
const onActivateMenuItem = (order: typeof detailMode) => appActions.profile.currentTab(order);
const styles = {
container: {
borderRightWidth: '0px',
width: '300px'
}
};
return (
<Sidebar>
<Menu
menuItemStyles={{
button: ({ level, active }) => {
if (level === 0)
return {
backgroundColor: active ? '#7b61ff66' : undefined,
border: '1.15288px solid rgba(0, 0, 0, 0.1)',
};
},
}}
<div className='h-[88vh] border rounded-md'>
<div className='border-b py-4 px-5 font-medium text-lg'>
General Information
</div>
<Sidebar
style={styles.container}
>
<MenuItem
active={detailMode === 'profile'}
component={<Link to="/profile" />}
onClick={() => onActivateMenuItem('profile')}
>
Profile
</MenuItem>
<MenuItem
active={detailMode === 'deposit'}
component={<Link to="/profile/deposit" />}
onClick={() => onActivateMenuItem('deposit')}
>
Deposit Money
</MenuItem>
<MenuItem
active={detailMode === 'settings'}
component={<Link to="/profile/preferences" />}
onClick={() => onActivateMenuItem('settings')}
<Menu
menuItemStyles={{
button: ({ level, active }) => {
if (level === 0)
return {
backgroundColor: active ? '#01B6FF' : undefined,
border: '1.15288px solid rgba(0, 0, 0, 0.1)',
};
},
}}
>
Preferences
</MenuItem>
<MenuItem onClick={onLogout}> Logout </MenuItem>
</Menu>
</Sidebar>
<MenuItem
icon={<ProfileIcon />}
active={detailMode === 'profile'}
component={<Link to="/profile" />}
onClick={() => onActivateMenuItem('profile')}
>
Profile
</MenuItem>
<MenuItem
icon={<PaymentIcon />}
active={detailMode === 'deposit'}
component={<Link to="/profile/deposit" />}
onClick={() => onActivateMenuItem('deposit')}
>
Payments
</MenuItem>
<MenuItem
icon={<PreferenceIcon />}
active={detailMode === 'settings'}
component={<Link to="/profile/preferences" />}
onClick={() => onActivateMenuItem('settings')}
>
Preferences
</MenuItem>
<MenuItem icon={<LogoutIcon />} onClick={onLogout}> Logout </MenuItem>
</Menu>
</Sidebar>
</div>
);
};
export default SideBar;
2 changes: 1 addition & 1 deletion src/components/Detail/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import SideBar from './SideBar';
export default function Profile() {
return (
<div className="flex gap-2 items-stretch justify-center pt-4">
<div className="ml-14">
<div className="ml-4">
<SideBar />
</div>
<Outlet />
Expand Down
2 changes: 1 addition & 1 deletion src/components/Pools/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Image } from '../UI';
import Clock from '~/assets/img/time.png';
import { Bullet, Blitz, Rapid, Standard } from '../UI/SVG_ICONS';
import { appStore } from '~/store';
type Category = 'Bullet' | 'Blitz' | 'Rapid';
type Category = 'Bullet' | 'Blitz' | 'Rapid' | 'Standard';

interface Pool {
category: Category;
Expand Down
Loading

0 comments on commit 5579582

Please sign in to comment.