Skip to content

Commit

Permalink
Merge pull request #786 from Arnei/typing-modal-navigation
Browse files Browse the repository at this point in the history
Add typing to ModalNavigation
  • Loading branch information
Arnei authored Jul 5, 2024
2 parents 6f65015 + 5563c5b commit e96bc4e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
6 changes: 6 additions & 0 deletions src/components/configuration/partials/wizard/ThemeDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,31 +48,37 @@ const ThemeDetails : React.FC<{
name: "generalForm",
tabTranslation: "CONFIGURATION.THEMES.DETAILS.GENERAL.CAPTION",
translation: "CONFIGURATION.THEMES.DETAILS.GENERAL.CAPTION",
accessRole: "ROLE_UI_THEMES_EDIT",
},
{
name: "bumperForm",
tabTranslation: "CONFIGURATION.THEMES.DETAILS.BUMPER.CAPTION",
translation: "CONFIGURATION.THEMES.DETAILS.BUMPER.CAPTION",
accessRole: "ROLE_UI_THEMES_EDIT",
},
{
name: "trailerForm",
tabTranslation: "CONFIGURATION.THEMES.DETAILS.TRAILER.CAPTION",
translation: "CONFIGURATION.THEMES.DETAILS.TRAILER.CAPTION",
accessRole: "ROLE_UI_THEMES_EDIT",
},
{
name: "titleSlideForm",
tabTranslation: "CONFIGURATION.THEMES.DETAILS.TITLE.CAPTION",
translation: "CONFIGURATION.THEMES.DETAILS.TITLE.CAPTION",
accessRole: "ROLE_UI_THEMES_EDIT",
},
{
name: "watermarkForm",
tabTranslation: "CONFIGURATION.THEMES.DETAILS.WATERMARK.CAPTION",
translation: "CONFIGURATION.THEMES.DETAILS.WATERMARK.CAPTION",
accessRole: "ROLE_UI_THEMES_EDIT",
},
{
name: "usage",
tabTranslation: "CONFIGURATION.THEMES.DETAILS.USAGE.CAPTION",
translation: "CONFIGURATION.THEMES.DETAILS.USAGE.CAPTION",
accessRole: "ROLE_UI_THEMES_EDIT",
},
];

Expand Down
16 changes: 11 additions & 5 deletions src/components/shared/modals/ModalNavigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,24 @@ import { useAppSelector } from "../../../store";
* This component renders the navigation in details modals
*/
const ModalNavigation = ({
tabInformation,
page,
openTab,
}: any) => {
tabInformation,
page,
openTab,
}: {
tabInformation: {
accessRole: string,
tabTranslation: string
}[],
page: number,
openTab: (key: number) => unknown,
}) => {
const { t } = useTranslation();

const user = useAppSelector(state => getUserInformation(state));

return (
<nav className="modal-nav" id="modal-nav">
{tabInformation.map(
// @ts-expect-error TS(7006): Parameter 'tab' implicitly has an 'any' type.
(tab, key) =>
hasAccess(tab.accessRole, user) && (
<button
Expand Down

0 comments on commit e96bc4e

Please sign in to comment.