georgs #23

Closed
Ghost wants to merge 50 commits from georgs into main
3 changed files with 100 additions and 48 deletions
Showing only changes of commit 78144fde03 - Show all commits

View File

@@ -3,6 +3,7 @@
import { NoDataOverlay } from "@/components/noDataOverlay"; import { NoDataOverlay } from "@/components/noDataOverlay";
import SummaryDetails from "@/components/summary_card"; import SummaryDetails from "@/components/summary_card";
import CustomTable from "@/components/table"; import CustomTable from "@/components/table";
import {HomeDummyData, HomeTableConfig} from "@/mock/home";
export default function Home() { export default function Home() {
return ( return (
@@ -15,7 +16,7 @@ export default function Home() {
<div> <div>
<h4>Home View Table</h4> <h4>Home View Table</h4>
<CustomTable data={[]} configuration={[]} /> <CustomTable data={HomeDummyData} configuration={HomeTableConfig} />
</div> </div>
<div> <div>

View File

@@ -9,6 +9,7 @@ import Paper from "@mui/material/Paper";
import {NoDataOverlay} from "@/components/noDataOverlay"; import {NoDataOverlay} from "@/components/noDataOverlay";
import {StyledTableCell, StyledTableRow} from "./style"; import {StyledTableCell, StyledTableRow} from "./style";
import {ICustomTable, CustomTableConfiguration} from "@/types"; import {ICustomTable, CustomTableConfiguration} from "@/types";
import {Checkbox} from "@mui/material";
const CustomTable = ({configuration, data}: ICustomTable) => { const CustomTable = ({configuration, data}: ICustomTable) => {
// display empty icon in case there is no data // display empty icon in case there is no data
@@ -25,6 +26,9 @@ const CustomTable = ({ configuration, data }: ICustomTable) => {
// cover use case if the data is an array // cover use case if the data is an array
if (Array.isArray(value)) renderedValue = value.join(", "); if (Array.isArray(value)) renderedValue = value.join(", ");
// cover use case if the data is an boolean
if (typeof value === "boolean") renderedValue = <Checkbox disabled checked={value}/>;
// cover use case if we want to render a component // cover use case if we want to render a component
if (render) renderedValue = render(value); if (render) renderedValue = render(value);

View File

@@ -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",
},
];