2024-03-16 14:56:58 -05:00
|
|
|
import React, {useRef} from "react";
|
2024-02-11 16:26:33 -06:00
|
|
|
import { Button } from "primereact/button";
|
|
|
|
import { DataTable } from 'primereact/datatable';
|
2024-03-16 14:56:58 -05:00
|
|
|
import { Menu } from 'primereact/menu';
|
2024-02-11 16:26:33 -06:00
|
|
|
import { Column } from 'primereact/column';
|
|
|
|
import { useSelector } from "react-redux";
|
|
|
|
import { useImageProxy } from "@/hooks/useImageProxy";
|
|
|
|
import Image from "next/image";
|
|
|
|
|
|
|
|
const Profile = () => {
|
|
|
|
const user = useSelector((state) => state.user.user);
|
|
|
|
const { returnImageProxy } = useImageProxy();
|
2024-03-16 14:56:58 -05:00
|
|
|
const menu = useRef(null);
|
2024-02-11 16:26:33 -06:00
|
|
|
|
|
|
|
const purchases = [
|
2024-03-16 14:56:58 -05:00
|
|
|
{
|
|
|
|
cost: 100,
|
|
|
|
name: 'Course 1',
|
|
|
|
category: 'Education',
|
|
|
|
date: '2021-09-01'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
cost: 200,
|
|
|
|
name: 'Course 2',
|
|
|
|
category: 'Education',
|
|
|
|
date: '2021-09-01'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
cost: 300,
|
|
|
|
name: 'Course 3',
|
|
|
|
category: 'Education',
|
|
|
|
date: '2021-09-01'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
cost: 400,
|
|
|
|
name: 'Course 4',
|
|
|
|
category: 'Education',
|
|
|
|
date: '2021-09-01'
|
|
|
|
}
|
2024-02-11 16:26:33 -06:00
|
|
|
];
|
|
|
|
|
2024-03-16 14:56:58 -05:00
|
|
|
const menuItems = [
|
|
|
|
{
|
|
|
|
label: 'Edit',
|
|
|
|
icon: 'pi pi-pencil',
|
|
|
|
command: () => {
|
|
|
|
// Add your edit functionality here
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Delete',
|
|
|
|
icon: 'pi pi-trash',
|
|
|
|
command: () => {
|
|
|
|
// Add your delete functionality here
|
|
|
|
}
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
|
|
|
|
2024-02-11 16:26:33 -06:00
|
|
|
return (
|
|
|
|
<>
|
2024-03-17 17:32:23 -05:00
|
|
|
<div className="w-[85vw] flex flex-col justify-center mx-auto">
|
2024-03-16 14:56:58 -05:00
|
|
|
<div className="relative flex w-full items-center justify-center">
|
|
|
|
{user.avatar && (
|
|
|
|
<Image
|
|
|
|
alt="user's avatar"
|
|
|
|
src={returnImageProxy(user.avatar)}
|
|
|
|
width={100}
|
|
|
|
height={100}
|
|
|
|
className="rounded-full my-4"
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
<i className="pi pi-ellipsis-h absolute right-24 text-2xl my-4 cursor-pointer hover:opacity-75"
|
|
|
|
onClick={(e) => menu.current.toggle(e)}></i>
|
|
|
|
<Menu model={menuItems} popup ref={menu} />
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
2024-02-11 16:26:33 -06:00
|
|
|
<h1 className="text-center text-2xl my-2">{user.username}</h1>
|
|
|
|
<h2 className="text-center text-xl my-2">{user.pubkey}</h2>
|
|
|
|
<div className="flex flex-col w-1/2 mx-auto my-4 justify-between items-center">
|
|
|
|
<h2>Subscription</h2>
|
|
|
|
<p>You currently have no active subscription</p>
|
|
|
|
<Button label="Subscribe" className="p-button-raised p-button-success w-auto my-2 text-[#f8f8ff]" />
|
|
|
|
</div>
|
|
|
|
</div>
|
2024-03-16 14:56:58 -05:00
|
|
|
<DataTable emptyMessage="No purchases" value={purchases} tableStyle={{ minWidth: '10rem' }}>
|
|
|
|
<Column field="cost" header="Cost"></Column>
|
2024-02-11 16:26:33 -06:00
|
|
|
<Column field="name" header="Name"></Column>
|
|
|
|
<Column field="category" header="Category"></Column>
|
2024-03-16 14:56:58 -05:00
|
|
|
<Column field="date" header="Date"></Column>
|
2024-02-11 16:26:33 -06:00
|
|
|
</DataTable>
|
|
|
|
</>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default Profile
|