Skip to content

Commit fc13497

Browse files
committed
Merge branch 'main' into reduce-api-requests
2 parents 1558352 + 751bdd9 commit fc13497

92 files changed

Lines changed: 440 additions & 312 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/check-label.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This workflow runs on any change made to a pull-request and aims to verify
22
# that the correct label is present.
33

4-
name: Check proper lable usage
4+
name: Check proper label usage
55

66
on:
77
pull_request_target:

.github/workflows/remove-test.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
name: Remove Pull Request Page
22

33
on:
4-
pull_request:
4+
pull_request_target:
55
types:
66
- closed
77

8+
env:
9+
PR_NUMBER: ${{ github.event.pull_request.number }}
10+
811
jobs:
912
delete_directory:
1013
runs-on: ubuntu-latest

src/components/NavBar.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import MainNav from "./shared/MainNav";
99
import NewResourceModal, { NewResource } from "./shared/NewResourceModal";
1010
import { useHotkeys } from "react-hotkeys-hook";
1111
import { ModalHandle } from "./shared/modals/Modal";
12+
import { ParseKeys } from "i18next";
1213

1314
/**
1415
* Component that renders the nav bar
@@ -17,11 +18,11 @@ type CreateType = {
1718
accessRole: string
1819
onShowModal?: () => Promise<void>
1920
onHideModal?: () => void
20-
text: string
21+
text: ParseKeys
2122
isDisplay?: boolean
2223
resource: NewResource
2324
hotkeySequence?: string[]
24-
hotkeyDescription?: string
25+
hotkeyDescription?: ParseKeys
2526
}
2627

2728
const NavBar = ({
@@ -33,13 +34,13 @@ const NavBar = ({
3334
create,
3435
} : {
3536
children?: React.ReactNode
36-
navAriaLabel?: string
37+
navAriaLabel?: ParseKeys
3738
displayNavigation: boolean
3839
setNavigation: React.Dispatch<React.SetStateAction<boolean>>
3940
links: {
4041
path: string
4142
accessRole: string
42-
text: string
43+
text: ParseKeys
4344
}[]
4445
create?: CreateType
4546
}) => {
@@ -67,7 +68,7 @@ const NavBar = ({
6768
useHotkeys(
6869
(create && create.hotkeySequence) ?? [],
6970
() => showNewResourceModal(),
70-
{ description: t((create && create.hotkeyDescription) ?? "") ?? undefined },
71+
{ description: create && create.hotkeyDescription ? t(create.hotkeyDescription) : undefined },
7172
[showNewResourceModal]
7273
);
7374

src/components/configuration/partials/wizard/NewThemeWizard.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { usePageFunctions } from "../../../../hooks/wizardHooks";
1111
import { NewThemeSchema } from "../../../../utils/validate";
1212
import { useAppDispatch } from "../../../../store";
1313
import { postNewTheme, ThemeDetailsInitialValues } from "../../../../slices/themeSlice";
14+
import { ParseKeys } from "i18next";
1415

1516
/**
1617
* This component manages the pages of the new theme wizard and the submission of values
@@ -34,7 +35,10 @@ const NewThemeWizard: React.FC<{
3435
} = usePageFunctions(0, initialValues);
3536

3637
// Caption of steps used by Stepper
37-
const steps = [
38+
const steps: {
39+
name: string
40+
translation: ParseKeys
41+
}[] = [
3842
{
3943
name: "generalForm",
4044
translation: "CONFIGURATION.THEMES.DETAILS.GENERAL.CAPTION",

src/components/configuration/partials/wizard/ThemeDetails.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { useAppDispatch, useAppSelector } from "../../../../store";
1515
import { updateThemeDetails } from "../../../../slices/themeDetailsSlice";
1616
import WizardNavigationButtons from "../../../shared/wizard/WizardNavigationButtons";
1717
import { ThemeDetailsInitialValues } from "../../../../slices/themeSlice";
18+
import { ParseKeys } from "i18next";
1819

1920
/**
2021
* This component manages the pages of the theme details
@@ -41,7 +42,12 @@ const ThemeDetails = ({
4142
};
4243

4344
// information about tabs
44-
const tabs = [
45+
const tabs: {
46+
name: string
47+
tabTranslation: ParseKeys
48+
translation: ParseKeys
49+
accessRole: string
50+
}[] = [
4551
{
4652
name: "generalForm",
4753
tabTranslation: "CONFIGURATION.THEMES.DETAILS.GENERAL.CAPTION",

src/components/events/partials/EventsNavigation.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
1+
import { ParseKeys } from "i18next";
2+
13
/**
24
* Utility file for the navigation bar
35
*/
4-
export const eventsLinks = [
6+
export const eventsLinks: {
7+
path: string,
8+
accessRole: string,
9+
text: ParseKeys
10+
}[] = [
511
{
612
path: "/events/events",
713
accessRole: "ROLE_UI_EVENTS_VIEW",

src/components/events/partials/EventsStatusCell.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
import { EventDetailsPage } from "./modals/EventDetails";
1010
import { hasScheduledStatus } from "../../../utils/eventDetailsUtils";
1111
import { IconButton } from "../../shared/IconButton";
12+
import { ParseKeys } from "i18next";
1213

1314
/**
1415
* This component renders the status cells of events in the table view
@@ -46,7 +47,7 @@ const EventsStatusCell = ({
4647
iconClassname={"crosslink"}
4748
tooltipText={"EVENTS.EVENTS.TABLE.TOOLTIP.STATUS"}
4849
>
49-
{t(row.displayable_status)}
50+
{t(row.displayable_status as ParseKeys)}
5051
</IconButton>
5152
);
5253
};

src/components/events/partials/ModalTabsAndPages/DetailsMetadataTab.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { MetadataCatalog } from "../../../../slices/eventSlice";
1616
import { AsyncThunk } from "@reduxjs/toolkit";
1717
import RenderDate from "../../../shared/RenderDate";
1818
import WizardNavigationButtons from "../../../shared/wizard/WizardNavigationButtons";
19+
import { ParseKeys } from "i18next";
1920

2021
/**
2122
* This component renders metadata details of a certain event or series
@@ -35,7 +36,7 @@ const DetailsMetadataTab = ({
3536
catalog: MetadataCatalog;
3637
}, any> //(id: string, values: { [key: string]: any }, catalog: MetadataCatalog) => void,
3738
editAccessRole: string,
38-
header?: string
39+
header?: ParseKeys
3940
}) => {
4041
const { t } = useTranslation();
4142
const dispatch = useAppDispatch();
@@ -91,7 +92,7 @@ const DetailsMetadataTab = ({
9192
/* Render table for each metadata catalog */
9293
<div className="obj tbl-details" key={key}>
9394
<header>
94-
<span>{t(header ? header : catalog.title)}</span>
95+
<span>{t(header ? header : catalog.title as ParseKeys)}</span>
9596
</header>
9697
<div className="obj-container">
9798
<table className="main-tbl">
@@ -101,7 +102,7 @@ const DetailsMetadataTab = ({
101102
catalog.fields.map((field, index) => (
102103
<tr key={index}>
103104
<td>
104-
<span>{t(field.label)}</span>
105+
<span>{t(field.label as ParseKeys)}</span>
105106
{field.required && (
106107
<i className="required">*</i>
107108
)}

src/components/events/partials/ModalTabsAndPages/EditScheduledEventsEditPage.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ const EditScheduledEventsEditPage = <T extends RequiredFormProps>({
243243
{
244244
reduceGroupEvents(Object.values(groupBy(formik.values.editedEvents, i => i.weekday))).map((groupedEvent, key) => (
245245
<div className="obj tbl-details">
246-
<header>{t("EVENTS.EVENTS.NEW.WEEKDAYSLONG." + groupedEvent.weekday)
246+
<header>{t(`EVENTS.EVENTS.NEW.WEEKDAYSLONG.${groupedEvent.weekday}`)
247247
+ " ("
248248
+ t("BULK_ACTIONS.EDIT_EVENTS.EDIT.EVENTS")
249249
+ " "
@@ -272,7 +272,7 @@ const EditScheduledEventsEditPage = <T extends RequiredFormProps>({
272272
disabled={false}
273273
title={"EVENTS.EVENTS.DETAILS.SOURCE.DATE_TIME.START_TIME"}
274274
hourPlaceholder={"EVENTS.EVENTS.DETAILS.SOURCE.PLACEHOLDER.HOUR"}
275-
minutePlaceholder={"EVENTS.EVENTS.DETAILS.SOURCE.PLACEHOLDER.MINUTES"}
275+
minutePlaceholder={"EVENTS.EVENTS.DETAILS.SOURCE.PLACEHOLDER.MINUTE"}
276276
callbackHour={(value: string) => {
277277
for (const [i, entry] of formik.values.editedEvents.entries()) {
278278
if (entry.weekday === groupedEvent.weekday ) {
@@ -300,7 +300,7 @@ const EditScheduledEventsEditPage = <T extends RequiredFormProps>({
300300
disabled={false}
301301
title={"EVENTS.EVENTS.DETAILS.SOURCE.DATE_TIME.END_TIME"}
302302
hourPlaceholder={"EVENTS.EVENTS.DETAILS.SOURCE.PLACEHOLDER.HOUR"}
303-
minutePlaceholder={"EVENTS.EVENTS.DETAILS.SOURCE.PLACEHOLDER.MINUTES"}
303+
minutePlaceholder={"EVENTS.EVENTS.DETAILS.SOURCE.PLACEHOLDER.MINUTE"}
304304
callbackHour={(value: string) => {
305305
for (const [i, entry] of formik.values.editedEvents.entries()) {
306306
if (entry.weekday === groupedEvent.weekday ) {
@@ -329,9 +329,7 @@ const EditScheduledEventsEditPage = <T extends RequiredFormProps>({
329329
inputDevices={inputDevices}
330330
disabled={false}
331331
title={"EVENTS.EVENTS.DETAILS.SOURCE.PLACEHOLDER.LOCATION"}
332-
placeholder={`-- ${t(
333-
"SELECT_NO_OPTION_SELECTED"
334-
)} --`}
332+
placeholder={"SELECT_NO_OPTION_SELECTED"}
335333
callback={(value: string) => {
336334
for (const [i, entry] of formik.values.editedEvents.entries()) {
337335
if (entry.weekday === groupedEvent.weekday ) {

src/components/events/partials/ModalTabsAndPages/EditScheduledEventsGeneralPage.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { useAppSelector } from "../../../../store";
1515
import { FormikProps } from "formik";
1616
import { Event } from "../../../../slices/eventSlice";
1717
import WizardNavigationButtons from "../../../shared/wizard/WizardNavigationButtons";
18+
import { ParseKeys } from "i18next";
1819

1920
/**
2021
* This component renders the table overview of selected events in edit scheduled events bulk action
@@ -119,7 +120,7 @@ const EditScheduledEventsGeneralPage = <T extends RequiredFormProps>({
119120
<td className="nowrap">
120121
{event.series ? event.series.title : ""}
121122
</td>
122-
<td className="nowrap">{t(event.event_status)}</td>
123+
<td className="nowrap">{t(event.event_status as ParseKeys)}</td>
123124
</tr>
124125
))}
125126
</tbody>

0 commit comments

Comments
 (0)