Skip to content

Commit

Permalink
Merge pull request #289 from Arnei/type-tabindex
Browse files Browse the repository at this point in the history
Fix typescript complaints about tabIndex
  • Loading branch information
Arnei authored Mar 7, 2024
2 parents 61e44f6 + a09607f commit 5583f3e
Show file tree
Hide file tree
Showing 21 changed files with 51 additions and 74 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -464,8 +464,7 @@ const EditScheduledEventsEditPage = ({
nextPage(formik.values);
}
}}
// @ts-expect-error TS(2322): Type 'string' is not assignable to type 'number'.
tabIndex="100"
tabIndex={100}
>
{t("WIZARD.NEXT_STEP")}
</button>
Expand All @@ -479,8 +478,7 @@ const EditScheduledEventsEditPage = ({
setPageCompleted([]);
}
}}
// @ts-expect-error TS(2322): Type 'string' is not assignable to type 'number'.
tabIndex="101"
tabIndex={101}
>
{t("WIZARD.BACK")}
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,7 @@ const EditScheduledEventsGeneralPage = ({
onClick={() => {
nextPage(formik.values);
}}
// @ts-expect-error TS(2322): Type 'string' is not assignable to type 'number'.
tabIndex="100"
tabIndex={100}
>
{t("WIZARD.NEXT_STEP")}
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@ const EventDetailsAssetsAddAsset = ({
handleChange(e, formik, asset.id)
}
type="file"
// @ts-expect-error TS(2322): Type 'string' is not assignable to type 'number'.
tabIndex=""
tabIndex={0}
/>
{/* @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message */}
{formik.values[asset.id] && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ const EventDetailsCommentsTab = ({
placeholder={t(
"EVENTS.EVENTS.DETAILS.COMMENTS.SELECTPLACEHOLDER"
)}
tabIndex={"5"}
tabIndex={5}
/>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,7 @@ const EventDetailsSchedulingTab = ({
<ThemeProvider theme={theme}>
<DatePicker
name="scheduleStartDate"
// @ts-expect-error TS(2322): Type 'string' is not assignable to type 'number'.
tabIndex={"1"}
tabIndex={1}
value={formik.values.scheduleStartDate}
onChange={(value) =>
changeStartDate(
Expand Down Expand Up @@ -365,7 +364,7 @@ const EventDetailsSchedulingTab = ({
placeholder={t(
"EVENTS.EVENTS.DETAILS.SOURCE.PLACEHOLDER.HOUR"
)}
tabIndex={"2"}
tabIndex={2}
disabled={
!accessAllowed(formik.values.captureAgent)
}
Expand Down Expand Up @@ -394,7 +393,7 @@ const EventDetailsSchedulingTab = ({
placeholder={t(
"EVENTS.EVENTS.DETAILS.SOURCE.PLACEHOLDER.MINUTE"
)}
tabIndex={"3"}
tabIndex={3}
disabled={
!accessAllowed(formik.values.captureAgent)
}
Expand Down Expand Up @@ -439,7 +438,7 @@ const EventDetailsSchedulingTab = ({
)
}
placeholder={t("WIZARD.DURATION.HOURS")}
tabIndex={"4"}
tabIndex={4}
disabled={
!accessAllowed(formik.values.captureAgent)
}
Expand Down Expand Up @@ -468,7 +467,7 @@ const EventDetailsSchedulingTab = ({
)
}
placeholder={t("WIZARD.DURATION.MINUTES")}
tabIndex={"5"}
tabIndex={5}
disabled={
!accessAllowed(formik.values.captureAgent)
}
Expand Down Expand Up @@ -515,7 +514,7 @@ const EventDetailsSchedulingTab = ({
placeholder={t(
"EVENTS.EVENTS.DETAILS.SOURCE.PLACEHOLDER.HOUR"
)}
tabIndex={"6"}
tabIndex={6}
disabled={
!accessAllowed(formik.values.captureAgent)
}
Expand Down Expand Up @@ -544,7 +543,7 @@ const EventDetailsSchedulingTab = ({
placeholder={t(
"EVENTS.EVENTS.DETAILS.SOURCE.PLACEHOLDER.MINUTE"
)}
tabIndex={"7"}
tabIndex={7}
disabled={
!accessAllowed(formik.values.captureAgent)
}
Expand Down Expand Up @@ -616,7 +615,7 @@ const EventDetailsSchedulingTab = ({
placeholder={t(
"EVENTS.EVENTS.DETAILS.SOURCE.PLACEHOLDER.LOCATION"
)}
tabIndex={"8"}
tabIndex={8}
disabled={
!accessAllowed(formik.values.captureAgent)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ const EventDetailsWorkflowTab = ({
"EVENTS.EVENTS.NEW.PROCESSING.SELECT_WORKFLOW_EMPTY"
)
}
tabIndex={"5"}
tabIndex={5}
disabled={
!hasCurrentAgentAccess() ||
!isRoleWorkflowEdit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ const NewAccessPage = ({
placeholder={t(
"EVENTS.SERIES.NEW.ACCESS.ACCESS_POLICY.LABEL"
)}
tabIndex={"1"}
tabIndex={1}
autoFocus={true}
/>
</div>
Expand Down Expand Up @@ -331,16 +331,14 @@ const NewAccessPage = ({
nextPage(formik.values);
}
}}
// @ts-expect-error TS(2322): Type 'string' is not assignable to type 'number'.
tabIndex="100"
tabIndex={100}
>
{t("WIZARD.NEXT_STEP")}
</button>
<button
className="cancel"
onClick={() => previousPage(formik.values, false)}
// @ts-expect-error TS(2322): Type 'string' is not assignable to type 'number'.
tabIndex="101"
tabIndex={101}
>
{t("WIZARD.BACK")}
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,7 @@ const NewAssetUploadPage = ({
accept={asset.accept}
onChange={(e) => handleChange(e, asset.id)}
type="file"
// @ts-expect-error TS(2322): Type 'string' is not assignable to type 'number'.
tabIndex=""
tabIndex={0}
/>
{formik.values[asset.id] && (
<span className="ui-helper">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ const NewProcessingPage: React.FC<{
placeholder={t(
"EVENTS.EVENTS.NEW.PROCESSING.SELECT_WORKFLOW"
)}
tabIndex={"99"}
tabIndex={99}
/>
</div>
) : (
Expand Down Expand Up @@ -125,8 +125,7 @@ const NewProcessingPage: React.FC<{
onClick={() => {
nextPage(formik.values);
}}
// @ts-expect-error TS(2322): Type 'string' is not assignable to type 'number'.
tabIndex="100"
tabIndex={100}
>
{t("WIZARD.NEXT_STEP")}
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,16 +204,14 @@ const NewSourcePage = ({
nextPage(formik.values);
}
}}
// @ts-expect-error TS(2322): Type 'string' is not assignable to type 'number'.
tabIndex="100"
tabIndex={100}
>
{t("WIZARD.NEXT_STEP")}
</button>
<button
className="cancel"
onClick={() => previousPage(formik.values, false)}
// @ts-expect-error TS(2322): Type 'string' is not assignable to type 'number'.
tabIndex="101"
tabIndex={101}
>
{t("WIZARD.BACK")}
</button>
Expand Down Expand Up @@ -286,8 +284,7 @@ const Upload = ({ formik }) => {
type="file"
multiple={asset.multiple}
name={`uploadAssetsTrack.${key}.file`}
// @ts-expect-error TS(2322): Type 'string' is not assignable to type 'number'.
tabIndex=""
tabIndex={0}
/>
{/* Show name of file that is uploaded */}
{formik.values.uploadAssetsTrack[key].file && (
Expand Down Expand Up @@ -371,7 +368,7 @@ const Schedule = ({ formik, inputDevices }) => {
type="checkbox"
name="deviceInputs"
value={input.id}
tabIndex="12"
tabIndex={12}
/>
{t(input.value)}
</label>
Expand Down Expand Up @@ -419,8 +416,7 @@ const Schedule = ({ formik, inputDevices }) => {
);
}
}}
// @ts-expect-error TS(2322): Type 'string' is not assignable to type 'number'.
tabIndex="4"
tabIndex={4}
/>
</MuiPickersUtilsProvider>
</ThemeProvider>
Expand All @@ -446,8 +442,7 @@ const Schedule = ({ formik, inputDevices }) => {
formik.setFieldValue
)
}
// @ts-expect-error TS(2322): Type 'string' is not assignable to type 'number'.
tabIndex="5"
tabIndex={5}
/>
</ThemeProvider>
</td>
Expand Down Expand Up @@ -508,7 +503,7 @@ const Schedule = ({ formik, inputDevices }) => {
}
}}
placeholder={t("EVENTS.EVENTS.NEW.SOURCE.PLACEHOLDER.HOUR")}
tabIndex={"13"}
tabIndex={13}
/>

{/* drop-down for minute
Expand Down Expand Up @@ -538,7 +533,7 @@ const Schedule = ({ formik, inputDevices }) => {
}
}}
placeholder={t("EVENTS.EVENTS.NEW.SOURCE.PLACEHOLDER.MINUTE")}
tabIndex={"14"}
tabIndex={14}
/>
</td>
</tr>
Expand Down Expand Up @@ -575,7 +570,7 @@ const Schedule = ({ formik, inputDevices }) => {
}
}}
placeholder={t("EVENTS.EVENTS.NEW.SOURCE.PLACEHOLDER.HOUR")}
tabIndex={"15"}
tabIndex={15}
/>

{/* drop-down for minute
Expand Down Expand Up @@ -605,7 +600,7 @@ const Schedule = ({ formik, inputDevices }) => {
}
}}
placeholder={t("EVENTS.EVENTS.NEW.SOURCE.PLACEHOLDER.MINUTE")}
tabIndex={"16"}
tabIndex={16}
/>
</td>
</tr>
Expand Down Expand Up @@ -642,7 +637,7 @@ const Schedule = ({ formik, inputDevices }) => {
}
}}
placeholder={t("EVENTS.EVENTS.NEW.SOURCE.PLACEHOLDER.HOUR")}
tabIndex={"17"}
tabIndex={17}
/>

{/* drop-down for minute
Expand Down Expand Up @@ -672,7 +667,7 @@ const Schedule = ({ formik, inputDevices }) => {
}
}}
placeholder={t("EVENTS.EVENTS.NEW.SOURCE.PLACEHOLDER.MINUTE")}
tabIndex={"18"}
tabIndex={18}
/>

{/* display end date if on different day to start date, only if this is current source mode */}
Expand Down Expand Up @@ -711,7 +706,7 @@ const Schedule = ({ formik, inputDevices }) => {
placeholder={t(
"EVENTS.EVENTS.NEW.SOURCE.PLACEHOLDER.LOCATION"
)}
tabIndex={"19"}
tabIndex={19}
/>
</td>
</tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const NewThemePage = ({
formik.setFieldValue("theme", element.value)
}
placeholder={t("EVENTS.SERIES.NEW.THEME.LABEL")}
tabIndex={"1"}
tabIndex={1}
/>
</div>
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const SeriesDetailsThemeTab = ({
formik.setFieldValue("theme", element.value)
}
placeholder={t("EVENTS.SERIES.NEW.THEME.LABEL")}
tabIndex={"8"}
tabIndex={8}
disabled={
!hasAccess(
"ROLE_UI_SERIES_DETAILS_THEMES_EDIT",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,7 @@ const StartTaskGeneralPage = ({ formik, nextPage, selectedRows }) => {
onClick={() => {
nextPage(formik.values);
}}
// @ts-expect-error TS(2322): Type 'string' is not assignable to type 'number'.
tabIndex="100"
tabIndex={100}
>
{t("WIZARD.NEXT_STEP")}
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const StartTaskWorkflowPage: React.FC<{
placeholder={t(
"EVENTS.EVENTS.DETAILS.PUBLICATIONS.SELECT_WORKFLOW"
)}
tabIndex={"99"}
tabIndex={99}
/>
</div>
)}
Expand Down Expand Up @@ -111,8 +111,7 @@ const StartTaskWorkflowPage: React.FC<{
onClick={() => {
nextPage(formik.values);
}}
// @ts-expect-error TS(2322): Type 'string' is not assignable to type 'number'.
tabIndex="100"
tabIndex={100}
>
{t("WIZARD.NEXT_STEP")}
</button>
Expand All @@ -125,8 +124,7 @@ const StartTaskWorkflowPage: React.FC<{
setPageCompleted([]);
}
}}
// @ts-expect-error TS(2322): Type 'string' is not assignable to type 'number'.
tabIndex="101"
tabIndex={101}
>
{t("WIZARD.BACK")}
</button>
Expand Down
3 changes: 1 addition & 2 deletions app/src/components/shared/NewResourceModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ const NewResourceModal = ({
<>
<div className="modal-animation modal-overlay" />
<section
// @ts-expect-error TS(2322): Type 'string' is not assignable to type 'number'.
tabIndex="1"
tabIndex={1}
className="modal wizard modal-animation"
id="add-event-modal"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ const ResourceDetailsAccessPolicyTab : React.FC <{
"EVENTS.EVENTS.DETAILS.ACCESS.ACCESS_POLICY.EMPTY"
)
}
tabIndex={"1"}
tabIndex={1}
/>
) : (
baseAclId
Expand Down
2 changes: 1 addition & 1 deletion app/src/components/shared/wizard/RenderField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ const EditableSingleSelect = ({
// @ts-expect-error TS(7006): Parameter 'element' implicitly has an 'any' type.
handleChange={(element) => setFieldValue(field.name, element.value)}
placeholder={`-- ${t("SELECT_NO_OPTION_SELECTED")} --`}
tabIndex={"10"}
tabIndex={10}
autoFocus={true}
defaultOpen={true}
/>
Expand Down
Loading

0 comments on commit 5583f3e

Please sign in to comment.