- Updated icon stroke and fill colors from `var(--text-button-color)` to `var(--text-color)` for consistency. - Refactored `Dashboard` component to utilize a new `DashboardMain` component for better structure. - Enhanced `DashboardMain` to manage project data fetching and rendering based on active folder and subfolder. - Implemented socket handling for project actions (add, delete, update, duplicate) in `ProjectSocketRes`. - Improved styles in `_dashboard.scss` for buttons and project cards, including hover effects and layout adjustments.
71 lines
2.0 KiB
TypeScript
71 lines
2.0 KiB
TypeScript
import React, { useEffect, useState } from 'react';
|
|
import DashboardNavBar from './DashboardNavBar';
|
|
import DashboardCard from './DashboardCard';
|
|
import { projectTutorial } from '../../services/dashboard/projectTutorial';
|
|
interface Project {
|
|
_id: string;
|
|
projectName: string;
|
|
thumbnail: string;
|
|
createdBy: string;
|
|
projectUuid?: string;
|
|
}
|
|
|
|
interface DiscardedProjects {
|
|
[key: string]: Project[];
|
|
}
|
|
|
|
const DashboardTutorial = () => {
|
|
const [tutorialProject, setTutorialProject] = useState<DiscardedProjects>({})
|
|
const handleIcon = async () => {
|
|
try {
|
|
let tutorial = await projectTutorial()
|
|
setTutorialProject(tutorial)
|
|
} catch {
|
|
|
|
}
|
|
}
|
|
|
|
|
|
const [openKebabProjectId, setOpenKebabProjectId] = useState<string | null>(
|
|
null
|
|
);
|
|
|
|
useEffect(() => {
|
|
handleIcon()
|
|
}, [])
|
|
const renderTrashProjects = () => {
|
|
const projectList = tutorialProject[Object.keys(tutorialProject)[0]];
|
|
|
|
if (!projectList?.length) {
|
|
return <div className="empty-state">No deleted projects found</div>;
|
|
}
|
|
|
|
return projectList.map((tutorials: any) => (
|
|
<DashboardCard
|
|
key={tutorials._id}
|
|
projectName={tutorials.projectName}
|
|
thumbnail={tutorials.thumbnail}
|
|
projectId={tutorials._id}
|
|
openKebabProjectId={openKebabProjectId}
|
|
setOpenKebabProjectId={setOpenKebabProjectId}
|
|
/>
|
|
));
|
|
};
|
|
return (
|
|
<div className="dashboard-home-container">
|
|
<DashboardNavBar
|
|
page="tutorial"
|
|
/>
|
|
|
|
<div className="dashboard-container" style={{ height: "calc(100% - 87px)" }}>
|
|
<div className="header" style={{ display: 'flex', gap: '7px' }}></div>
|
|
<div className="cards-container">
|
|
{renderTrashProjects()}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
export default DashboardTutorial;
|