mirror of
https://github.com/Sosokker/B2D-Ventures.git
synced 2025-12-20 14:34:05 +01:00
feat: enhance user experience by optimizing loading times for dashboard components
This commit is contained in:
parent
1c8d68183a
commit
1c46887cef
@ -93,13 +93,13 @@ export default function Dashboard() {
|
||||
const fetchProjects = async () => {
|
||||
if (userId) {
|
||||
const { data, error } = await getProjectByUserId(supabase, userId);
|
||||
// alert(JSON.stringify(data));
|
||||
if (error) {
|
||||
console.error("Error while fetching projects");
|
||||
}
|
||||
if (data) {
|
||||
// set project and current project id
|
||||
setProjects(data);
|
||||
// console.table(data);
|
||||
setCurrentProjectId(data[0].id);
|
||||
}
|
||||
} else {
|
||||
console.error("Error with UserId while fetching projects");
|
||||
@ -108,8 +108,6 @@ export default function Dashboard() {
|
||||
};
|
||||
fetchProjects();
|
||||
}, [supabase, userId]);
|
||||
// console.table(projects);
|
||||
// console.table(latestInvestment);
|
||||
|
||||
return (
|
||||
<div className="container max-w-screen-xl">
|
||||
@ -135,8 +133,8 @@ export default function Dashboard() {
|
||||
<div className="flex items-center justify-between space-y-2">
|
||||
<h2 className="text-3xl font-bold tracking-tight">Business Dashboard</h2>
|
||||
</div>
|
||||
|
||||
<Tabs className="space-y-4">
|
||||
{projects && projects.length > 0 && (
|
||||
<Tabs className="space-y-4" defaultValue={projects[0].project_name}>
|
||||
<TabsList>
|
||||
{projects.map((project) => (
|
||||
<TabsTrigger
|
||||
@ -301,6 +299,7 @@ export default function Dashboard() {
|
||||
</TabsContent>
|
||||
))}
|
||||
</Tabs>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user