diff --git a/frontend/src/components/Icons/AlertTriangle/index.tsx b/frontend/src/components/Icons/AlertTriangle/index.tsx index 86ef0a116..b8a7dfb5a 100644 --- a/frontend/src/components/Icons/AlertTriangle/index.tsx +++ b/frontend/src/components/Icons/AlertTriangle/index.tsx @@ -3,9 +3,8 @@ import { GenericIconProps } from '../types'; export const AlertTriangle: React.FC = ({ color = 'currentColor', - opacity, - className, size, + ...props }) => { return ( = ({ viewBox="0 0 49 49" fill="none" xmlns="http://www.w3.org/2000/svg" - className={className} - opacity={opacity} + {...props} > = ({ color = 'currentColor', - opacity, - className, size, + ...props }) => { return ( = ({ viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg" - className={className} - opacity={opacity} + {...props} > = ({ color = 'currentColor', - opacity, - className, size, + ...props }) => { return ( = ({ viewBox="0 0 31 31" fill="none" xmlns="http://www.w3.org/2000/svg" - className={className} - opacity={opacity} + {...props} > void; - children: JSX.Element; + children: React.ReactNode; } export const DetailsButton: React.FC = ({ url, onClick, children }) => { const className = - 'h-12 w-12 grid place-items-center rounded-full shadow-lg text-primary1 bg-white cursor-pointer hover:text-primary1-light transition-all'; + 'size-12 grid place-items-center rounded-full shadow-lg text-primary1 bg-white hover:text-primary1-light transition'; if (url === undefined) { return ( diff --git a/frontend/src/components/pages/details/components/DetailsButtonDropdown/DetailsButtonDropdown.tsx b/frontend/src/components/pages/details/components/DetailsButtonDropdown/DetailsButtonDropdown.tsx index 61df9ad6c..231f613ed 100644 --- a/frontend/src/components/pages/details/components/DetailsButtonDropdown/DetailsButtonDropdown.tsx +++ b/frontend/src/components/pages/details/components/DetailsButtonDropdown/DetailsButtonDropdown.tsx @@ -6,7 +6,7 @@ interface DetailsButtonDropdownProps { label: string; size: number; }[]; - children: JSX.Element; + children: React.ReactNode; } export const DetailsButtonDropdown: React.FC = ({ diff --git a/frontend/src/components/pages/details/components/DetailsDownloadIcons/DetailsDownloadIcons.tsx b/frontend/src/components/pages/details/components/DetailsDownloadIcons/DetailsDownloadIcons.tsx index e5b75fa9d..9061a74bd 100644 --- a/frontend/src/components/pages/details/components/DetailsDownloadIcons/DetailsDownloadIcons.tsx +++ b/frontend/src/components/pages/details/components/DetailsDownloadIcons/DetailsDownloadIcons.tsx @@ -1,22 +1,23 @@ +import { useState } from 'react'; +import { FormattedMessage, useIntl } from 'react-intl'; +import { useMediaPredicate } from 'react-media-hook'; + import { AlertTriangle } from 'components/Icons/AlertTriangle'; import { Reservation } from 'components/Icons/Reservation'; import { ThreeDMap } from 'components/Icons/ThreeDMap'; import { Printer } from 'components/Icons/Printer'; import { DetailsButton } from 'components/pages/details/components/DetailsButton'; -import { useState } from 'react'; import ToolTip from 'components/ToolTip'; -import { useIntl } from 'react-intl'; import { Download } from 'components/Icons/Download'; import { Details } from 'modules/details/interface'; import { ThreeD } from 'components/3D'; import { getMapConfig } from 'components/Map/config'; -import { useMediaPredicate } from 'react-media-hook'; import useHasMounted from 'hooks/useHasMounted'; -import { OutdoorCourseDetails } from '../../../../../modules/outdoorCourse/interface'; -import { OutdoorSiteDetails } from '../../../../../modules/outdoorSite/interface'; -import { TouristicContentDetails } from '../../../../../modules/touristicContent/interface'; -import { TouristicEventDetails } from '../../../../../modules/touristicEvent/interface'; -import { getGlobalConfig } from '../../../../../modules/utils/api.config'; +import { OutdoorCourseDetails } from 'modules/outdoorCourse/interface'; +import { OutdoorSiteDetails } from 'modules/outdoorSite/interface'; +import { TouristicContentDetails } from 'modules/touristicContent/interface'; +import { TouristicEventDetails } from 'modules/touristicEvent/interface'; +import { getGlobalConfig } from 'modules/utils/api.config'; import { DetailsButtonDropdown } from '../DetailsButtonDropdown'; import { useDetailsAndMapContext } from '../../DetailsAndMapContext'; @@ -54,6 +55,16 @@ export const DetailsDownloadIcons: React.FC = ({ 'elevationAreaUrl' in details && !isTouchScreen; + const isReportFeatureEnabled = + displayReport && getGlobalConfig().enableReport && Boolean(details.id); + + const isReservationWidgetFeatureEnabled = + displayReservationWidget && + 'reservation' in details && + 'reservation_id' in details && + getGlobalConfig().reservationPartner && + getGlobalConfig().reservationProject; + const dropdownButtonOptions = []; if ('gpxUri' in details) { dropdownButtonOptions.push({ @@ -73,7 +84,7 @@ export const DetailsDownloadIcons: React.FC = ({ return (
{open3D && is3DfeatureEnabled && ( @@ -86,51 +97,60 @@ export const DetailsDownloadIcons: React.FC = ({ /> )} -
- {details.pdfUri && ( - - - - - - )} + {details.pdfUri && ( + + + + + + + + + )} - {dropdownButtonOptions.length > 0 && ( - - - - - - )} + {dropdownButtonOptions.length > 0 && ( + + + + + + + + + )} - {displayReport && Number(details.id) && getGlobalConfig().enableReport && ( - - setReportVisibility(true)}> - - - - )} + {isReportFeatureEnabled && ( + + setReportVisibility(true)}> + + + + + + + )} - {displayReservationWidget && - (details as Details).reservation && - (details as Details).reservation_id && - getGlobalConfig().reservationPartner && - getGlobalConfig().reservationProject && ( - - - - - - )} + {isReservationWidgetFeatureEnabled && ( + + + + + + + + + )} - {is3DfeatureEnabled && ( - - setOpen3D(true)}> - - - - )} -
+ {is3DfeatureEnabled && ( + + setOpen3D(true)}> + + + + + + + )}
); }; diff --git a/frontend/src/components/pages/details/components/DetailsTopIcons/DetailsTopIcons.tsx b/frontend/src/components/pages/details/components/DetailsTopIcons/DetailsTopIcons.tsx index 914e5a276..a2bee0711 100644 --- a/frontend/src/components/pages/details/components/DetailsTopIcons/DetailsTopIcons.tsx +++ b/frontend/src/components/pages/details/components/DetailsTopIcons/DetailsTopIcons.tsx @@ -25,18 +25,25 @@ interface DetailsTopIconsProps { } interface IconProps { + className?: string; height?: number; width?: number; src?: string; } -const Icon: React.FC = ({ src = '', ...props }) => { +const Icon: React.FC = ({ src, ...props }) => { if (!src) { return null; } if (RegExp(/(.*).svg/).test(src)) { return ( - + ); } return ; @@ -49,30 +56,25 @@ export const DetailsTopIcons: React.FC = ({ displayReservationWidget = true, }) => { return ( - <> +
+ {practice && }
- {practice && } -
-
- -
-
+
- +
); }; @@ -82,18 +84,12 @@ const ActivityLogo: React.FC<{ }> = ({ src, type = null }) => (
-
- -
-
- -
+
);