Skip to content

Commit

Permalink
Map action link added
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Haube committed Oct 31, 2023
1 parent 7eda16b commit 77f1443
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/services/ui/src/pages/detail/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { useGetItem } from "@/api";
import { DetailNav } from "./detailNav";
import { BreadCrumbs } from "@/components/BreadCrumb";
import { BREAD_CRUMB_CONFIG_PACKAGE_DETAILS } from "@/components/BreadCrumb/bread-crumb-config";
import { mapActionLabel } from "@/utils";
import { mapActionLabel, mapActionLink } from "@/utils";
import { Link } from "react-router-dom";
import { ROUTES } from "@/routes";

Expand Down Expand Up @@ -69,7 +69,7 @@ export const DetailsContent = ({ data }: { data?: ItemResult }) => {
{data.actions.map((action, idx) => (
<Link
className="text-sky-500 underline"
to={ROUTES.DASHBOARD}
to={mapActionLink(action)}
key={`${idx}-${action}`}
>
<li>{mapActionLabel(action)}</li>
Expand Down
10 changes: 8 additions & 2 deletions src/services/ui/src/utils/actionLabelMapper.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
import { Action } from "shared-types";
import { ROUTES } from "@/routes";
export const mapActionLabel = (a: Action) => {
switch (a) {
case Action.ENABLE_RAI_WITHDRAW:
return "Enable RAI Response Withdraw";
default:
return null;
}
};

export const mapActionLink = (a: Action): ROUTES => {
switch (a) {
case Action.ENABLE_RAI_WITHDRAW:
return ROUTES.DASHBOARD;
}
};

0 comments on commit 77f1443

Please sign in to comment.