diff --git a/pkgs/ui/public/tub-favicon.ico b/pkgs/ui/public/tub-favicon.ico new file mode 100644 index 0000000..44973f8 Binary files /dev/null and b/pkgs/ui/public/tub-favicon.ico differ diff --git a/pkgs/ui/public/tub-favicon.png b/pkgs/ui/public/tub-favicon.png new file mode 100644 index 0000000..c3b832e Binary files /dev/null and b/pkgs/ui/public/tub-favicon.png differ diff --git a/pkgs/ui/public/tub-logo.png b/pkgs/ui/public/tub-logo.png new file mode 100644 index 0000000..3c9bb7c Binary files /dev/null and b/pkgs/ui/public/tub-logo.png differ diff --git a/pkgs/ui/src/app/client-1/page.tsx b/pkgs/ui/src/app/client-1/page.tsx index e290a0b..5abb913 100644 --- a/pkgs/ui/src/app/client-1/page.tsx +++ b/pkgs/ui/src/app/client-1/page.tsx @@ -1,7 +1,14 @@ "use client"; import SummaryDetails from "@/components/summary_card"; -import { Client1SummaryDetails } from "@/mock/client_1"; +import { + Client1SummaryDetails, + Client1ConsumerData, + Client1ConsumerTableConfig, + Client1ProducerTableConfig, + Client1ProducerData, +} from "@/mock/client_1"; +import CustomTable from "@/components/table"; export default function Client1() { return ( @@ -14,6 +21,20 @@ export default function Client1() { details: Client1SummaryDetails, }} /> +
+

Consumer View

+ +
+
+

Producer View

+ +
); } diff --git a/pkgs/ui/src/app/client-2/page.tsx b/pkgs/ui/src/app/client-2/page.tsx index a9a4168..80be865 100644 --- a/pkgs/ui/src/app/client-2/page.tsx +++ b/pkgs/ui/src/app/client-2/page.tsx @@ -1,7 +1,14 @@ "use client"; import SummaryDetails from "@/components/summary_card"; -import { Client2SummaryDetails } from "@/mock/client_2"; +import { + Client2ConsumerData, + Client2ConsumerTableConfig, + Client2ProducerData, + Client2ProducerTableConfig, + Client2SummaryDetails, +} from "@/mock/client_2"; +import CustomTable from "@/components/table"; export default function Client1() { return ( @@ -14,6 +21,20 @@ export default function Client1() { details: Client2SummaryDetails, }} /> +
+

Consumer View

+ +
+
+

Producer View

+ +
); } diff --git a/pkgs/ui/src/app/home/page.tsx b/pkgs/ui/src/app/home/page.tsx index bfcddf8..37e51de 100644 --- a/pkgs/ui/src/app/home/page.tsx +++ b/pkgs/ui/src/app/home/page.tsx @@ -3,6 +3,7 @@ import { NoDataOverlay } from "@/components/noDataOverlay"; import SummaryDetails from "@/components/summary_card"; import CustomTable from "@/components/table"; +import { HomeDummyData, HomeTableConfig } from "@/mock/home"; export default function Home() { return ( @@ -15,7 +16,7 @@ export default function Home() {

Home View Table

- +
diff --git a/pkgs/ui/src/app/layout.tsx b/pkgs/ui/src/app/layout.tsx index 50de272..87b7ebd 100644 --- a/pkgs/ui/src/app/layout.tsx +++ b/pkgs/ui/src/app/layout.tsx @@ -50,7 +50,7 @@ export default function RootLayout({ Service Aware Networks - + @@ -88,8 +88,8 @@ export default function RootLayout({
TUB Logo, + label: "C1", + to: "/client-1", + disabled: false, + }, + { + icon: , + label: "C2", + to: "/client-2", + disabled: false, + }, +]; + const menuEntries: MenuEntry[] = [ { icon: , @@ -39,18 +57,6 @@ const menuEntries: MenuEntry[] = [ icon: , label: "Entities", to: "/entities", - disabled: true, - }, - { - icon: , - label: "C1", - to: "/client-1", - disabled: false, - }, - { - icon: , - label: "C2", - to: "/client-2", disabled: false, }, { @@ -74,10 +80,17 @@ interface SidebarProps { show: boolean; onClose: () => void; } + export function Sidebar(props: SidebarProps) { const { show, onClose } = props; + const [activeMenuItem, setActiveMenuItem] = React.useState( + typeof window !== "undefined" ? window.location.pathname : "", + ); + const [collapseMenuOpen, setCollapseMenuOpen] = React.useState(true); - const [activeMenuItem, setActiveMenuItem] = React.useState("/"); + const handleCollapseClick = () => { + setCollapseMenuOpen(!collapseMenuOpen); + }; const handleMenuItemClick = (path: string) => { setActiveMenuItem(path); @@ -93,10 +106,10 @@ export function Sidebar(props: SidebarProps) {
TUB Logo
@@ -119,28 +132,88 @@ export function Sidebar(props: SidebarProps) { disablePadding className="!overflow-hidden py-2" > - handleMenuItemClick(menuEntry.to)} - > - handleMenuItemClick(menuEntry.to)} > - {menuEntry.icon} - - - + + {menuEntry.icon} + + + + ) : ( +
+ + + {menuEntry.icon} + + + {collapseMenuOpen ? : } + + + + {menuEntityEntries.map((menuEntry, idx) => ( + handleMenuItemClick(menuEntry.to)} + > + + {menuEntry.icon} + + + + ))} + + +
+ )} ); })} diff --git a/pkgs/ui/src/components/table/index.tsx b/pkgs/ui/src/components/table/index.tsx index cbfec7e..36714df 100644 --- a/pkgs/ui/src/components/table/index.tsx +++ b/pkgs/ui/src/components/table/index.tsx @@ -9,6 +9,7 @@ import Paper from "@mui/material/Paper"; import { NoDataOverlay } from "@/components/noDataOverlay"; import { StyledTableCell, StyledTableRow } from "./style"; import { ICustomTable, CustomTableConfiguration } from "@/types"; +import { Checkbox } from "@mui/material"; const CustomTable = ({ configuration, data }: ICustomTable) => { // display empty icon in case there is no data @@ -25,6 +26,10 @@ const CustomTable = ({ configuration, data }: ICustomTable) => { // cover use case if the data is an array if (Array.isArray(value)) renderedValue = value.join(", "); + // cover use case if the data is an boolean + if (typeof value === "boolean") + renderedValue = ; + // cover use case if we want to render a component if (render) renderedValue = render(value); diff --git a/pkgs/ui/src/mock/client_1/index.ts b/pkgs/ui/src/mock/client_1/index.ts index 030cc7f..658b51e 100644 --- a/pkgs/ui/src/mock/client_1/index.ts +++ b/pkgs/ui/src/mock/client_1/index.ts @@ -14,3 +14,127 @@ export const Client1SummaryDetails = [ value: "Carlo's Home Network", }, ]; + +export const Client1ConsumerData = [ + { + service_name: "Carlo's Printing", + service_type: "3D Printing", + end_point: "Consume", + producer: "C2", + producer_did: "did:sov:test:1223", + network: "Carlo's Home Network", + }, + { + service_name: "Steve's Printing", + service_type: "3D Printing", + end_point: "Consume", + producer: "C2", + producer_did: "did:sov:test:1234", + network: "Steve's Home Network", + }, + { + service_name: "Test A", + service_type: "3D Printing", + end_point: "Consume", + producer: "C2", + producer_did: "did:sov:test:4567", + network: "Test Network A", + }, + { + service_name: "Test B", + service_type: "3D Printing", + end_point: "Consume", + producer: "C2", + producer_did: "did:sov:test:0062", + network: "Test Network B", + }, +]; + +export const Client1ConsumerTableConfig = [ + { + key: "service_name", + label: "Service name", + }, + { + key: "service_type", + label: "Service Type", + }, + { + key: "end_point", + label: "End Point", + }, + { + key: "producer", + label: "Producer", + }, + { + key: "producer_did", + label: "Producer DID", + }, + { + key: "network", + label: "Network", + }, +]; + +export const Client1ProducerData = [ + { + service_name: "Carlo's Printing", + service_type: "3D Printing", + end_point: "URL", + usage: "C1(3), C3(4)", + status: "DRAFT, REGISTERED", + action: "Register, Deregister, Delete", + }, + { + service_name: "Steve's Printing", + service_type: "3D Printing", + end_point: "URL", + usage: "C1(3), C3(4)", + status: "REGISTERED", + action: "Create", + }, + { + service_name: "Test Printing A", + service_type: "3D Printing", + end_point: "URL", + usage: "C1(3), C3(4)", + status: "DRAFT", + action: "Register, Deregister", + }, + { + service_name: "Test Printing B", + service_type: "3D Printing", + end_point: "URL", + usage: "C1(3), C3(4)", + status: "DRAFT, REGISTERED", + action: "Delete, Create", + }, +]; + +export const Client1ProducerTableConfig = [ + { + key: "service_name", + label: "Service name", + }, + { + key: "service_type", + label: "Service Type", + }, + { + key: "end_point", + label: "End Point", + }, + { + key: "usage", + label: "Usage", + }, + { + key: "status", + label: "Status", + }, + { + key: "action", + label: "Action", + }, +]; diff --git a/pkgs/ui/src/mock/client_2/index.ts b/pkgs/ui/src/mock/client_2/index.ts index 19e6936..b0105fd 100644 --- a/pkgs/ui/src/mock/client_2/index.ts +++ b/pkgs/ui/src/mock/client_2/index.ts @@ -14,3 +14,127 @@ export const Client2SummaryDetails = [ value: "Carlo's Home Network", }, ]; + +export const Client2ConsumerData = [ + { + service_name: "Carlo's Printing", + service_type: "3D Printing", + end_point: "Consume", + producer: "C2", + producer_did: "did:sov:test:1223", + network: "Carlo's Home Network", + }, + { + service_name: "Steve's Printing", + service_type: "3D Printing", + end_point: "Consume", + producer: "C2", + producer_did: "did:sov:test:1234", + network: "Steve's Home Network", + }, + { + service_name: "Test A", + service_type: "3D Printing", + end_point: "Consume", + producer: "C2", + producer_did: "did:sov:test:4567", + network: "Test Network A", + }, + { + service_name: "Test B", + service_type: "3D Printing", + end_point: "Consume", + producer: "C2", + producer_did: "did:sov:test:0062", + network: "Test Network B", + }, +]; + +export const Client2ConsumerTableConfig = [ + { + key: "service_name", + label: "Service name", + }, + { + key: "service_type", + label: "Service Type", + }, + { + key: "end_point", + label: "End Point", + }, + { + key: "producer", + label: "Producer", + }, + { + key: "producer_did", + label: "Producer DID", + }, + { + key: "network", + label: "Network", + }, +]; + +export const Client2ProducerData = [ + { + service_name: "Carlo's Printing", + service_type: "3D Printing", + end_point: "URL", + usage: "C1(3), C3(4)", + status: "DRAFT, REGISTERED", + action: "Register, Deregister, Delete", + }, + { + service_name: "Steve's Printing", + service_type: "3D Printing", + end_point: "URL", + usage: "C1(3), C3(4)", + status: "REGISTERED", + action: "Create", + }, + { + service_name: "Test Printing A", + service_type: "3D Printing", + end_point: "URL", + usage: "C1(3), C3(4)", + status: "DRAFT", + action: "Register, Deregister", + }, + { + service_name: "Test Printing B", + service_type: "3D Printing", + end_point: "URL", + usage: "C1(3), C3(4)", + status: "DRAFT, REGISTERED", + action: "Delete, Create", + }, +]; + +export const Client2ProducerTableConfig = [ + { + key: "service_name", + label: "Service name", + }, + { + key: "service_type", + label: "Service Type", + }, + { + key: "end_point", + label: "End Point", + }, + { + key: "usage", + label: "Usage", + }, + { + key: "status", + label: "Status", + }, + { + key: "action", + label: "Action", + }, +]; diff --git a/pkgs/ui/src/mock/home/index.ts b/pkgs/ui/src/mock/home/index.ts new file mode 100644 index 0000000..ccff693 --- /dev/null +++ b/pkgs/ui/src/mock/home/index.ts @@ -0,0 +1,47 @@ +// HOME - Table Data + +export const HomeDummyData = [ + { + entity_name: "C1", + entity_DID: "did:sov:test:1234", + network: "Carlo's Home Network", + ip_address: "127.0.0.1", + roles: "service repository, service consumer, DLG", + visible: true, + }, + { + entity_name: "C2", + entity_DID: "did:sov:test:4567", + network: "Steve's Home Network", + ip_address: "127.0.0.1", + roles: "service repository, service consumer, DLG", + visible: false, + }, +]; + +export const HomeTableConfig = [ + { + key: "entity_name", + label: "Entity name", + }, + { + key: "entity_DID", + label: "Entity DID", + }, + { + key: "network", + label: "Network", + }, + { + key: "ip_address", + label: "IP address", + }, + { + key: "roles", + label: "Roles", + }, + { + key: "visible", + label: "Visible", + }, +];