Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into allow-tracks-to-show-…
Browse files Browse the repository at this point in the history
…up-in-asset-upload
  • Loading branch information
Arnei committed Jul 1, 2024
2 parents 484eb37 + ca662a8 commit 1c411b6
Show file tree
Hide file tree
Showing 57 changed files with 472 additions and 517 deletions.
15 changes: 8 additions & 7 deletions src/components/events/partials/EventActionCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,14 @@ const EventActionCell = ({
return (
<>
{/* Display modal for editing table view if table edit button is clicked */}
<EventDetailsModal
showModal={displayEventDetailsModal}
handleClose={hideEventDetailsModal}
tabIndex={eventDetailsTabIndex}
eventTitle={row.title}
eventId={row.id}
/>
{displayEventDetailsModal &&
<EventDetailsModal
handleClose={hideEventDetailsModal}
tabIndex={eventDetailsTabIndex}
eventTitle={row.title}
eventId={row.id}
/>
}

{displaySeriesDetailsModal && (
<SeriesDetailsModal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,38 +14,36 @@ import {
} from "../../../../utils/utils";
import { getMetadataCollectionFieldName } from "../../../../utils/resourceUtils";
import { useAppSelector } from "../../../../store";
import { MetadataCatalog } from "../../../../slices/eventDetailsSlice";

/**
* This component renders metadata details of a certain event or series
*/
const DetailsExtendedMetadataTab: React.FC<{
resourceId: any, //TODO: Type this
editAccessRole: any, //TODO: Type this
metadata: any, //TODO: Type this
updateResource: any, //TODO: Type this
}> = ({
const DetailsExtendedMetadataTab = ({
resourceId,
editAccessRole,
metadata,
updateResource,
}: {
resourceId: string,
editAccessRole: string,
metadata: MetadataCatalog[],
updateResource: (id: string, values: { [key: string]: any }, catalog: MetadataCatalog) => void,
}) => {
const { t } = useTranslation();

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

// @ts-expect-error TS(7006): Parameter 'values' implicitly has an 'any' type.
const handleSubmit = (values, catalog) => {
const handleSubmit = (values: { [key: string]: any }, catalog: MetadataCatalog) => {
updateResource(resourceId, values, catalog);
};

// set current values of metadata fields as initial values
// @ts-expect-error TS(7006): Parameter 'metadataCatalog' implicitly has an 'any... Remove this comment to see the full error message
const getInitialValues = (metadataCatalog) => {
const getInitialValues = (metadataCatalog: MetadataCatalog) => {
let initialValues = {};

// Transform metadata fields and their values provided by backend (saved in redux)
if (!!metadataCatalog.fields && metadataCatalog.fields.length > 0) {
// @ts-expect-error TS(7006): Parameter 'field' implicitly has an 'any' type.
metadataCatalog.fields.forEach((field) => {
let value = parseValueForBooleanStrings(field.value);
// @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
Expand Down Expand Up @@ -77,7 +75,6 @@ const DetailsExtendedMetadataTab: React.FC<{
//iterate through metadata catalogs
!!metadata &&
metadata.length > 0 &&
// @ts-expect-error TS(7006): Parameter 'catalog' implicitly has an 'any' type.
metadata.map((catalog, key) => (
// initialize form
<Formik
Expand All @@ -96,7 +93,6 @@ const DetailsExtendedMetadataTab: React.FC<{
<tbody>
{/* Render table row for each metadata field depending on type */}
{!!catalog.fields &&
// @ts-expect-error TS(7006): Parameter 'field' implicitly has an 'any' type.
catalog.fields.map((field, index) => (
<tr key={index}>
<td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,29 @@ import { getUserInformation } from "../../../../selectors/userInfoSelectors";
import { hasAccess, isJson } from "../../../../utils/utils";
import { getMetadataCollectionFieldName } from "../../../../utils/resourceUtils";
import { useAppSelector } from "../../../../store";
import { MetadataCatalog } from "../../../../slices/eventDetailsSlice";

/**
* This component renders metadata details of a certain event or series
*/
const DetailsMetadataTab: React.FC<{
metadataFields: any, //TODO: Type this
updateResource: any, //TODO: Type this
resourceId: any, //TODO: Type this
header: any, //TODO: Type this
editAccessRole: any, //TODO: Type this
}> = ({
const DetailsMetadataTab = ({
metadataFields,
updateResource,
resourceId,
header,
editAccessRole,
}: {
metadataFields: MetadataCatalog,
updateResource: (id: string, values: { [key: string]: any }) => void,
resourceId: string,
header: string,
editAccessRole: string,
}) => {
const { t } = useTranslation();

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

// @ts-expect-error TS(7006): Parameter 'values' implicitly has an 'any' type.
const handleSubmit = (values) => {
const handleSubmit = (values: { [key: string]: any }) => {
updateResource(resourceId, values);
};

Expand All @@ -47,7 +47,6 @@ const DetailsMetadataTab: React.FC<{
!!metadataFields.fields &&
metadataFields.fields.length > 0
) {
// @ts-expect-error TS(7006): Parameter 'field' implicitly has an 'any' type.
metadataFields.fields.forEach((field) => {
// @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
initialValues[field.id] = field.value;
Expand Down Expand Up @@ -88,7 +87,6 @@ const DetailsMetadataTab: React.FC<{
{/* Render table row for each metadata field depending on type */}
{!!metadataFields &&
!!metadataFields.fields &&
// @ts-expect-error TS(7006): Parameter 'field' implicitly has an 'any' type.
metadataFields.fields.map((field, key) => (
<tr key={key}>
<td>
Expand Down Expand Up @@ -126,7 +124,7 @@ const DetailsMetadataTab: React.FC<{
) : (
<td>{
field.type === "time" || field.type === "date"
? <RenderDate date={field.value} />
? <RenderDate date={field.value as string} />
: field.value
}</td>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,23 @@ import {
saveAccessPolicies,
} from "../../../../slices/eventDetailsSlice";
import { unwrapResult } from "@reduxjs/toolkit";
import { useTranslation } from "react-i18next";

/**
* This component manages the access policy tab of the event details modal
*/
const EventDetailsAccessPolicyTab = ({
// @ts-expect-error TS(7031): Binding element 'eventId' implicitly has an 'any' ... Remove this comment to see the full error message
eventId,
// @ts-expect-error TS(7031): Binding element 'header' implicitly has an 'any' t... Remove this comment to see the full error message
header,
// @ts-expect-error TS(7031): Binding element 't' implicitly has an 'any' type.
t,
// @ts-expect-error TS(7031): Binding element 'policyChanged' implicitly has an ... Remove this comment to see the full error message
policyChanged,
// @ts-expect-error TS(7031): Binding element 'setPolicyChanged' implicitly has ... Remove this comment to see the full error message
setPolicyChanged,
}: {
eventId: string,
header: string,
policyChanged: boolean,
setPolicyChanged: (value: boolean) => void,
}) => {
const { t } = useTranslation();
const dispatch = useAppDispatch();

// TODO: Get rid of the wrappers when modernizing redux is done
Expand All @@ -45,7 +46,6 @@ const EventDetailsAccessPolicyTab = ({
header={header}
buttonText={"EVENTS.EVENTS.DETAILS.ACCESS.ACCESS_POLICY.LABEL"}
saveButtonText={"SAVE"}
t={t}
policies={policies}
fetchAccessPolicies={fetchAccessPoliciesWrapper}
fetchHasActiveTransactions={fetchHasActiveTransactionsWrapper}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ import {
} from "../../../../selectors/eventDetailsSelectors";
import { humanReadableBytesFilter } from "../../../../utils/eventDetailsUtils";
import { useAppSelector } from "../../../../store";
import { AssetTabHierarchy } from "../modals/EventDetails";
import { useTranslation } from "react-i18next";

/**
* This component manages the attachment details sub-tab for assets tab of event details modal
*/
const EventDetailsAssetAttachmentDetails = ({
// @ts-expect-error TS(7031): Binding element 'eventId' implicitly has an 'any' ... Remove this comment to see the full error message
eventId,
// @ts-expect-error TS(7031): Binding element 't' implicitly has an 'any' type.
t,
// @ts-expect-error TS(7031): Binding element 'setHierarchy' implicitly has an '... Remove this comment to see the full error message
setHierarchy,
}: {
setHierarchy: (subTabName: AssetTabHierarchy) => void,
}) => {
const { t } = useTranslation();
const attachment = useAppSelector(state => getAssetAttachmentDetails(state));
const isFetching = useAppSelector(state => isFetchingAssetAttachmentDetails(state));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,26 @@ import {
} from "../../../../selectors/eventDetailsSelectors";
import { useAppDispatch, useAppSelector } from "../../../../store";
import { fetchAssetAttachmentDetails } from "../../../../slices/eventDetailsSlice";
import { AssetTabHierarchy } from "../modals/EventDetails";
import { useTranslation } from "react-i18next";

/**
* This component manages the attachments sub-tab for assets tab of event details modal
*/
const EventDetailsAssetAttachments = ({
// @ts-expect-error TS(7031): Binding element 'eventId' implicitly has an 'any' ... Remove this comment to see the full error message
eventId,
// @ts-expect-error TS(7031): Binding element 't' implicitly has an 'any' type.
t,
// @ts-expect-error TS(7031): Binding element 'setHierarchy' implicitly has an '... Remove this comment to see the full error message
setHierarchy,
}: {
eventId: string,
setHierarchy: (subTabName: AssetTabHierarchy) => void,
}) => {
const { t } = useTranslation();
const dispatch = useAppDispatch();

const attachments = useAppSelector(state => getAssetAttachments(state));
const isFetching = useAppSelector(state => isFetchingAssetAttachments(state));

// @ts-expect-error TS(7006): Parameter 'subTabName' implicitly has an 'any' typ... Remove this comment to see the full error message
const openSubTab = (subTabName, attachmentId = "") => {
const openSubTab = (subTabName: AssetTabHierarchy, attachmentId = "") => {
if (subTabName === "attachment-details") {
dispatch(fetchAssetAttachmentDetails({eventId, attachmentId})).then();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,19 @@ import {
} from "../../../../selectors/eventDetailsSelectors";
import { humanReadableBytesFilter } from "../../../../utils/eventDetailsUtils";
import { useAppSelector } from "../../../../store";
import { AssetTabHierarchy } from "../modals/EventDetails";
import { useTranslation } from "react-i18next";

/**
* This component manages the catalog details sub-tab for assets tab of event details modal
*/
const EventDetailsAssetCatalogDetails = ({
// @ts-expect-error TS(7031): Binding element 'eventId' implicitly has an 'any' ... Remove this comment to see the full error message
eventId,
// @ts-expect-error TS(7031): Binding element 't' implicitly has an 'any' type.
t,
// @ts-expect-error TS(7031): Binding element 'setHierarchy' implicitly has an '... Remove this comment to see the full error message
setHierarchy,
}: {
setHierarchy: (subTabName: AssetTabHierarchy) => void,
}) => {
const { t } = useTranslation();

const catalog = useAppSelector(state => getAssetCatalogDetails(state));
const isFetching = useAppSelector(state => isFetchingAssetCatalogDetails(state));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,26 @@ import {
} from "../../../../selectors/eventDetailsSelectors";
import { useAppDispatch, useAppSelector } from "../../../../store";
import { fetchAssetCatalogDetails } from "../../../../slices/eventDetailsSlice";
import { AssetTabHierarchy } from "../modals/EventDetails";
import { useTranslation } from "react-i18next";

/**
* This component manages the catalogs sub-tab for assets tab of event details modal
*/
const EventDetailsAssetCatalogs = ({
// @ts-expect-error TS(7031): Binding element 'eventId' implicitly has an 'any' ... Remove this comment to see the full error message
eventId,
// @ts-expect-error TS(7031): Binding element 't' implicitly has an 'any' type.
t,
// @ts-expect-error TS(7031): Binding element 'setHierarchy' implicitly has an '... Remove this comment to see the full error message
setHierarchy,
}: {
eventId: string,
setHierarchy: (subTabName: AssetTabHierarchy) => void,
}) => {
const { t } = useTranslation();
const dispatch = useAppDispatch();

const catalogs = useAppSelector(state => getAssetCatalogs(state));
const isFetching = useAppSelector(state => isFetchingAssetCatalogs(state));

// @ts-expect-error TS(7006): Parameter 'subTabName' implicitly has an 'any' typ... Remove this comment to see the full error message
const openSubTab = (subTabName, catalogId = "") => {
const openSubTab = (subTabName: AssetTabHierarchy, catalogId = "") => {
if (subTabName === "catalog-details") {
dispatch(fetchAssetCatalogDetails({eventId, catalogId})).then();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,26 @@ import {
} from "../../../../selectors/eventDetailsSelectors";
import { useAppDispatch, useAppSelector } from "../../../../store";
import { fetchAssetMediaDetails } from "../../../../slices/eventDetailsSlice";
import { AssetTabHierarchy } from "../modals/EventDetails";
import { useTranslation } from "react-i18next";

/**
* This component manages the media sub-tab for assets tab of event details modal
*/
const EventDetailsAssetMedia = ({
// @ts-expect-error TS(7031): Binding element 'eventId' implicitly has an 'any' ... Remove this comment to see the full error message
eventId,
// @ts-expect-error TS(7031): Binding element 't' implicitly has an 'any' type.
t,
// @ts-expect-error TS(7031): Binding element 'setHierarchy' implicitly has an '... Remove this comment to see the full error message
setHierarchy,
}: {
eventId: string,
setHierarchy: (subTabName: AssetTabHierarchy) => void,
}) => {
const { t } = useTranslation();
const dispatch = useAppDispatch();

const media = useAppSelector(state => getAssetMedia(state));
const isFetching = useAppSelector(state => isFetchingAssetMedia(state));

// @ts-expect-error TS(7006): Parameter 'subTabName' implicitly has an 'any' typ... Remove this comment to see the full error message
const openSubTab = (subTabName, mediaId = "") => {
const openSubTab = (subTabName: AssetTabHierarchy, mediaId = "") => {
if (subTabName === "media-details") {
dispatch(fetchAssetMediaDetails({eventId, mediaId})).then();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,19 @@ import {
humanReadableBytesFilter,
} from "../../../../utils/eventDetailsUtils";
import { useAppSelector } from "../../../../store";
import { AssetTabHierarchy } from "../modals/EventDetails";
import { useTranslation } from "react-i18next";

/**
* This component manages the media details sub-tab for assets tab of event details modal
*/
const EventDetailsAssetMediaDetails = ({
// @ts-expect-error TS(7031): Binding element 'eventId' implicitly has an 'any' ... Remove this comment to see the full error message
eventId,
// @ts-expect-error TS(7031): Binding element 't' implicitly has an 'any' type.
t,
// @ts-expect-error TS(7031): Binding element 'setHierarchy' implicitly has an '... Remove this comment to see the full error message
setHierarchy,
}: {
setHierarchy: (subTabName: AssetTabHierarchy) => void,
}) => {
const { t } = useTranslation();

const media = useAppSelector(state => getAssetMediaDetails(state));
const isFetching = useAppSelector(state => isFetchingAssetMediaDetails(state));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,19 @@ import {
} from "../../../../selectors/eventDetailsSelectors";
import { humanReadableBytesFilter } from "../../../../utils/eventDetailsUtils";
import { useAppSelector } from "../../../../store";
import { AssetTabHierarchy } from "../modals/EventDetails";
import { useTranslation } from "react-i18next";

/**
* This component manages the publication details sub-tab for assets tab of event details modal
*/
const EventDetailsAssetPublicationDetails = ({
// @ts-expect-error TS(7031): Binding element 'eventId' implicitly has an 'any' ... Remove this comment to see the full error message
eventId,
// @ts-expect-error TS(7031): Binding element 't' implicitly has an 'any' type.
t,
// @ts-expect-error TS(7031): Binding element 'setHierarchy' implicitly has an '... Remove this comment to see the full error message
setHierarchy,
}: {
setHierarchy: (subTabName: AssetTabHierarchy) => void,
}) => {
const { t } = useTranslation();

const publication = useAppSelector(state => getAssetPublicationDetails(state));
const isFetching = useAppSelector(state => isFetchingAssetPublicationDetails(state));

Expand Down
Loading

0 comments on commit 1c411b6

Please sign in to comment.