Skip to content

Commit

Permalink
[#3]added breadcrumbs
Browse files Browse the repository at this point in the history
  • Loading branch information
Eriikah committed May 23, 2024
1 parent 2362898 commit b4c926c
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 6 deletions.
22 changes: 19 additions & 3 deletions src/dashboards/AuthParams.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import { FormControl, InputLabel, MenuItem, Select } from "@mui/material";
import { t } from "i18next";
import attributes from "../static/attributes.json";
import { useEffect, useState } from "react";
import { useAppDispatch, useAppSelector } from "../app/hooks";
import "./AuthParams.css";
import { useState } from "react";
import { OptionRenderer } from "../components/authParamOptions/OptionRenderer";
import {
getConfigAsync,
removeError,
setError,
updateAuthParams,
} from "../features/config/configSlice";
import attributes from "../static/attributes.json";
import "./AuthParams.css";
export function AuthParams() {
const dispatch = useAppDispatch();
const authChoiceModules = useAppSelector(
Expand Down Expand Up @@ -54,6 +55,21 @@ export function AuthParams() {
return [];
}),
];
const configNum = useAppSelector((state) =>
state.router.location?.hash.replace("#authParams/", "")
);
useEffect(() => {
if (
configNum !== "latest" &&
Number(configNum) !== Number(config.data.metadata.cfgNum)
) {
dispatch(
getConfigAsync(configNum === "latest" ? undefined : Number(configNum))
);
} else if (configNum === "latest" && config.data.metadata.next) {
dispatch(getConfigAsync());
}
}, [dispatch, configNum, config.data.metadata]);

const [optionSelected, setOptionSelected] = useState(authModule);
try {
Expand Down
42 changes: 39 additions & 3 deletions src/pages/Configuration.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,39 @@
import Manager from "./../dashboards/Manager";
import { Breadcrumbs, Link } from "@mui/material";
import { t } from "i18next";
import { useAppSelector } from "../app/hooks";
import AddApp from "../components/managerComponents/AddApp";
import SaveButton from "./../components/SaveButton";
import { ApplicationDashboard } from "../dashboards/ApplicationDashboard";
import { HomePage } from "../dashboards/HomePage";
import { AuthParams } from "../dashboards/AuthParams";
import { HomePage } from "../dashboards/HomePage";
import { IssuerDashboard } from "../dashboards/IssuerDashboard";
import SaveButton from "./../components/SaveButton";
import Manager from "./../dashboards/Manager";

export function Configuration({
location,
}: {
location: { type: string; info: { name: string; type?: string } };
}) {
const metadata = useAppSelector((state) => state.config.data.metadata);
console.log(location);
switch (location.type) {
case "app":
return (
<div className="main">
<Breadcrumbs>
<Link underline="hover" color="inherit">
{t("conf")} {metadata.cfgNum}
</Link>
<Link underline="none" color="inherit">
{location.type}
</Link>
<Link underline="none" color="inherit">
{location.info.type}
</Link>
<Link underline="hover" color="text.primary">
{location.info.name}
</Link>
</Breadcrumbs>
<ApplicationDashboard
name={location.info.name}
type={location.info.type ? location.info.type : ""}
Expand All @@ -34,12 +54,28 @@ export function Configuration({
case "authParams":
return (
<div className="main">
<Breadcrumbs>
<Link underline="none" color="inherit">
{location.info.name === "latest"
? `${t(location.info.name)} ${t("conf")}`
: `${t("conf")} ${t(location.info.name)}`}
</Link>
<Link underline="none" color="text.primary">
{t(location.type)}
</Link>
</Breadcrumbs>
<AuthParams />
<div>
<SaveButton />
</div>
</div>
);
case "issuer":
return (
<div className="main">
<IssuerDashboard type={location.info.name} />
</div>
);
default:
return <HomePage />;
}
Expand Down

0 comments on commit b4c926c

Please sign in to comment.