mirror of
https://github.com/Sosokker/B2D-Ventures.git
synced 2025-12-21 15:04: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 () => {
|
const fetchProjects = async () => {
|
||||||
if (userId) {
|
if (userId) {
|
||||||
const { data, error } = await getProjectByUserId(supabase, userId);
|
const { data, error } = await getProjectByUserId(supabase, userId);
|
||||||
// alert(JSON.stringify(data));
|
|
||||||
if (error) {
|
if (error) {
|
||||||
console.error("Error while fetching projects");
|
console.error("Error while fetching projects");
|
||||||
}
|
}
|
||||||
if (data) {
|
if (data) {
|
||||||
|
// set project and current project id
|
||||||
setProjects(data);
|
setProjects(data);
|
||||||
// console.table(data);
|
setCurrentProjectId(data[0].id);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.error("Error with UserId while fetching projects");
|
console.error("Error with UserId while fetching projects");
|
||||||
@ -108,8 +108,6 @@ export default function Dashboard() {
|
|||||||
};
|
};
|
||||||
fetchProjects();
|
fetchProjects();
|
||||||
}, [supabase, userId]);
|
}, [supabase, userId]);
|
||||||
// console.table(projects);
|
|
||||||
// console.table(latestInvestment);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="container max-w-screen-xl">
|
<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">
|
<div className="flex items-center justify-between space-y-2">
|
||||||
<h2 className="text-3xl font-bold tracking-tight">Business Dashboard</h2>
|
<h2 className="text-3xl font-bold tracking-tight">Business Dashboard</h2>
|
||||||
</div>
|
</div>
|
||||||
|
{projects && projects.length > 0 && (
|
||||||
<Tabs className="space-y-4">
|
<Tabs className="space-y-4" defaultValue={projects[0].project_name}>
|
||||||
<TabsList>
|
<TabsList>
|
||||||
{projects.map((project) => (
|
{projects.map((project) => (
|
||||||
<TabsTrigger
|
<TabsTrigger
|
||||||
@ -301,6 +299,7 @@ export default function Dashboard() {
|
|||||||
</TabsContent>
|
</TabsContent>
|
||||||
))}
|
))}
|
||||||
</Tabs>
|
</Tabs>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user