diff --git a/app/src/components/Dashboard/DasboardUseCases.tsx b/app/src/components/Dashboard/DasboardUseCases.tsx index bc0e247..fc3bd64 100644 --- a/app/src/components/Dashboard/DasboardUseCases.tsx +++ b/app/src/components/Dashboard/DasboardUseCases.tsx @@ -1,36 +1,35 @@ import React, { useEffect, useState } from "react"; import DashboardNavBar from "./DashboardNavBar"; import { projectTutorialApi } from "../../services/dashboard/projectTutorialApi"; -import { TutorialCard } from "./DashboardTutorial"; +import { TutorialCard } from "./TutorialCard"; +import { getUserData } from "../../functions/getUserData"; +import { ALPHA_ORG } from "../../pages/Dashboard"; -interface Tutorial { - _id: string; - name: string; - thumbnail?: string; - updatedAt: string; -} +const DUMMY_DATA = [ + //remove later + { + _id: "1", + name: "Robotic Arm Control", + thumbnail: "https://signfix.com.au/wp-content/uploads/2017/09/placeholder-600x400.png", + updatedAt: new Date().toISOString(), + }, + { + _id: "2", + name: "Simulation Basics", + thumbnail: "https://signfix.com.au/wp-content/uploads/2017/09/placeholder-600x400.png", + updatedAt: new Date().toISOString(), + }, + { + _id: "3", + name: "3D Visualization", + thumbnail: "https://signfix.com.au/wp-content/uploads/2017/09/placeholder-600x400.png", + updatedAt: new Date().toISOString(), + }, +]; const DashboardUseCases: React.FC = () => { - const [useCases, setUseCases] = useState([ - { - _id: "1", - name: "Robotic Arm Control", - thumbnail: "https://signfix.com.au/wp-content/uploads/2017/09/placeholder-600x400.png", - updatedAt: new Date().toISOString(), - }, - { - _id: "2", - name: "Simulation Basics", - thumbnail: "https://signfix.com.au/wp-content/uploads/2017/09/placeholder-600x400.png", - updatedAt: new Date().toISOString(), - }, - { - _id: "3", - name: "3D Visualization", - thumbnail: "https://signfix.com.au/wp-content/uploads/2017/09/placeholder-600x400.png", - updatedAt: new Date().toISOString(), - }, - ]); + const [useCases, setUseCases] = useState(DUMMY_DATA || []); // default [] + const { organization } = getUserData(); useEffect(() => { const fetchTutorials = async () => { @@ -52,13 +51,15 @@ const DashboardUseCases: React.FC = () => {
-
-
- + {organization === ALPHA_ORG && ( +
+
+ +
-
+ )} {useCases.length > 0 ? ( useCases.map((tut) => ) ) : ( diff --git a/app/src/components/Dashboard/DashboardTutorial.tsx b/app/src/components/Dashboard/DashboardTutorial.tsx index 822c4d9..6859c26 100644 --- a/app/src/components/Dashboard/DashboardTutorial.tsx +++ b/app/src/components/Dashboard/DashboardTutorial.tsx @@ -2,33 +2,7 @@ import React, { useEffect, useState } from "react"; import DashboardNavBar from "./DashboardNavBar"; import { projectTutorialApi } from "../../services/dashboard/projectTutorialApi"; import { AIIcon } from "../icons/ExportCommonIcons"; -import { DeleteIcon } from "../icons/ContextMenuIcons"; - -export const TutorialCard: React.FC<{ tutorial: Tutorial }> = ({ tutorial }) => { - return ( -
-
-
-
-
{tutorial.name}
-
- {new Date(tutorial.updatedAt).toLocaleDateString()} -
-
-
- -
-
-
- ); -}; +import { TutorialCard } from "./TutorialCard"; const DashboardTutorial: React.FC = () => { const [tutorials, setTutorials] = useState([]); diff --git a/app/src/components/Dashboard/TutorialCard.tsx b/app/src/components/Dashboard/TutorialCard.tsx new file mode 100644 index 0000000..a0ae4bf --- /dev/null +++ b/app/src/components/Dashboard/TutorialCard.tsx @@ -0,0 +1,32 @@ +import { getUserData } from "../../functions/getUserData"; +import { ALPHA_ORG } from "../../pages/Dashboard"; +import { DeleteIcon } from "../icons/ContextMenuIcons"; + +export const TutorialCard: React.FC<{ tutorial: Tutorial }> = ({ tutorial }) => { + const { organization } = getUserData(); + return ( +
+
+
+
+
{tutorial.name}
+
+ {new Date(tutorial.updatedAt).toLocaleDateString()} +
+
+ {organization === ALPHA_ORG && ( +
+ +
+ )} +
+
+ ); +}; diff --git a/app/src/pages/Dashboard.tsx b/app/src/pages/Dashboard.tsx index de1bee9..799c18d 100644 --- a/app/src/pages/Dashboard.tsx +++ b/app/src/pages/Dashboard.tsx @@ -6,6 +6,8 @@ import DashboardTutorial from "../components/Dashboard/DashboardTutorial"; import DashboardMain from "../components/Dashboard/DashboardMain"; import DashboardUseCases from "../components/Dashboard/DasboardUseCases"; +export const ALPHA_ORG = "hexrfactory"; + const Dashboard: React.FC = () => { const [activeTab, setActiveTab] = useState("Home"); const { socket } = useSocketStore();