Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 3.24.0 #1289

Merged
merged 22 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
2298988
Bump next from 13.2.4 to 14.2.15
dtrucs Oct 8, 2024
6210404
Update tsconfig.json
dtrucs Oct 15, 2024
19990a9
Remove scrollRestoration to top from trek detail page
dtrucs Oct 9, 2024
4523b24
Active nextconfig scrollRestoration feature
dtrucs Oct 9, 2024
a81ede8
Simplify CSS for search positions element
dtrucs Oct 9, 2024
1936104
Create useBrowserNavigationDetection hook
dtrucs Oct 9, 2024
f583a9c
UseBbox returns a bounds props instead of bboxSate
dtrucs Oct 9, 2024
8564796
Create BoundsHandler component
dtrucs Oct 10, 2024
d3c81d2
Display search map bounds of user's preference
dtrucs Oct 9, 2024
69b508c
Fix search init instanciation with user search context
dtrucs Oct 29, 2024
0f283a1
Bump package.json / 3.24.0
dtrucs Oct 21, 2024
d0d4e73
Hide not displayed tooltip
dtrucs Nov 13, 2024
ac1a834
Increase z-index loader
dtrucs Oct 30, 2024
34f65c9
Define previousRouter state
dtrucs Oct 30, 2024
1f3716c
Optimize animation details header mobile
dtrucs Oct 30, 2024
f54adc0
Create DetailsGoBack button
dtrucs Oct 30, 2024
770607e
Display DetailsGoBack on details page
dtrucs Oct 30, 2024
6807dc2
Allows to forward props to AlertTriangle/Printer/ThreeDMap icons comp…
dtrucs Nov 13, 2024
266b81d
Change type of DetailsButton to receive several children prop
dtrucs Nov 13, 2024
1e15224
Refacto DetailsTopIcons
dtrucs Nov 13, 2024
d60f04e
Create tailored variables for DetailsDownloadIcons
dtrucs Nov 19, 2024
05e1c74
Reorder import for DetailsDownloadIcons component
dtrucs Nov 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Changelog

## 3.24.0 (2024-11-20)

**✨ Improvements**

- Keep user search results (scroll position and map fitbounds) when returning from a detail page (#1282)
- Refacto details top icons (#1304)

**🔧 Maintenance**

- Bump next from 13.2.4 to 14.2.15 (#1284)

## 3.23.3 (2024-11-19)

**🐛 Fixes**
Expand Down
1 change: 1 addition & 0 deletions frontend/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ const nextConfig = {
},
experimental: {
instrumentationHook: true,
scrollRestoration: true,
},
};

Expand Down
4 changes: 2 additions & 2 deletions frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "geotrek-rando-frontend",
"version": "3.23.3",
"version": "3.24.0",
"private": true,
"scripts": {
"debug": "NODE_OPTIONS='--inspect' next ./src",
Expand Down Expand Up @@ -59,7 +59,7 @@
"leaflet-rastercoords": "^1.0.5",
"leaflet.locatecontrol": "^0.81.1",
"leaflet.offline": "^3.1.0",
"next": "13.2.4",
"next": "^14.2.15",
"next-compose-plugins": "^2.2.1",
"next-leaflet-cluster": "^1.0.0",
"next-pwa": "^5.6.0",
Expand Down
17 changes: 2 additions & 15 deletions frontend/src/components/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import { routes } from 'services/routes';

import { Link } from 'components/Link';
import { Display } from 'hooks/useHideOnScrollDown';

import InlineMenu from 'components/InlineMenu';
import { GoToSearchButton } from 'components/GoToSearchButton';
Expand All @@ -15,11 +14,6 @@
export const Header: React.FC = () => {
const menuNode = useRef<HTMLDivElement | null>(null);
const { config, menuItems, isDesktopMenu, intl } = useHeader(menuNode);
/**
* Disabled for now to handle the map on the search page
*/
// const headerState = useHideOnScrollDown(sizes.desktopHeader);
const headerState: Display = 'DISPLAYED';

const headerTop = config.headerTopHtml[intl.locale] ?? config.headerTopHtml.default;
const headerBottom = config.headerBottomHtml[intl.locale] ?? config.headerBottomHtml.default;
Expand All @@ -31,18 +25,11 @@
<HtmlParser template={headerTop} />
</div>
)}
<header
className={cn(
'sticky z-header bg-primary1',
headerState === 'DISPLAYED' ? 'top-0' : '-top-desktopHeader',
)}
role="banner"
id="header"
>
<header className="sticky z-header bg-primary1 top-0" role="banner" id="header">
<div className="h-11 desktop:h-desktopHeader flex justify-between items-center sticky z-header px-3 shadow-sm shrink-0 transition-all duration-300 delay-100">
<Link href={routes.HOME} className="flex items-center">
<div className="shrink-0" id="header_logo">
<img

Check warning on line 32 in frontend/src/components/Header/Header.tsx

View workflow job for this annotation

GitHub Actions / install-and-test

Using `<img>` could result in slower LCP and higher bandwidth. Consider using `<Image />` from `next/image` to automatically optimize images. This may incur additional usage or cost from your provider. See: https://nextjs.org/docs/messages/no-img-element

Check warning on line 32 in frontend/src/components/Header/Header.tsx

View workflow job for this annotation

GitHub Actions / install-and-test

Using `<img>` could result in slower LCP and higher bandwidth. Consider using `<Image />` from `next/image` to automatically optimize images. This may incur additional usage or cost from your provider. See: https://nextjs.org/docs/messages/no-img-element
id="header_logoImg"
className="h-9 w-auto desktop:h-18 mr-3"
alt=""
Expand Down Expand Up @@ -75,7 +62,7 @@
<BurgerMenu
className={cn(isDesktopMenu && 'hidden')}
config={config.menu}
displayState={headerState}
displayState="DISPLAYED"
menuItems={menuItems}
/>
</header>
Expand Down
6 changes: 2 additions & 4 deletions frontend/src/components/Icons/AlertTriangle/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ import { GenericIconProps } from '../types';

export const AlertTriangle: React.FC<GenericIconProps> = ({
color = 'currentColor',
opacity,
className,
size,
...props
}) => {
return (
<svg
Expand All @@ -14,8 +13,7 @@ export const AlertTriangle: React.FC<GenericIconProps> = ({
viewBox="0 0 49 49"
fill="none"
xmlns="http://www.w3.org/2000/svg"
className={className}
opacity={opacity}
{...props}
>
<path
fillRule="evenodd"
Expand Down
6 changes: 2 additions & 4 deletions frontend/src/components/Icons/Printer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ import { GenericIconProps } from '../types';

export const Printer: React.FC<GenericIconProps> = ({
color = 'currentColor',
opacity,
className,
size,
...props
}) => {
return (
<svg
Expand All @@ -14,8 +13,7 @@ export const Printer: React.FC<GenericIconProps> = ({
viewBox="0 0 30 30"
fill="none"
xmlns="http://www.w3.org/2000/svg"
className={className}
opacity={opacity}
{...props}
>
<path
d="M7.5 11.25V2.5h15v8.75M7.5 22.5H5A2.5 2.5 0 012.5 20v-6.25a2.5 2.5 0 012.5-2.5h20a2.5 2.5 0 012.5 2.5V20a2.5 2.5 0 01-2.5 2.5h-2.5"
Expand Down
6 changes: 2 additions & 4 deletions frontend/src/components/Icons/ThreeDMap/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ import { GenericIconProps } from '../types';

export const ThreeDMap: React.FC<GenericIconProps> = ({
color = 'currentColor',
opacity,
className,
size,
...props
}) => {
return (
<svg
Expand All @@ -14,8 +13,7 @@ export const ThreeDMap: React.FC<GenericIconProps> = ({
viewBox="0 0 31 31"
fill="none"
xmlns="http://www.w3.org/2000/svg"
className={className}
opacity={opacity}
{...props}
>
<path
fillRule="evenodd"
Expand Down
21 changes: 21 additions & 0 deletions frontend/src/components/Map/SearchMap/BoundsHandler.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { LatLngBounds } from 'leaflet';
import { useEffect } from 'react';
import { useMap } from 'react-leaflet';

interface Props {
bounds: LatLngBounds | null;
}

const BoundsHandler: React.FC<Props> = ({ bounds }) => {
const map = useMap();

useEffect(() => {
if (bounds) {
map.fitBounds(bounds);
}
}, [bounds, map]);

return null;
};

export default BoundsHandler;
3 changes: 1 addition & 2 deletions frontend/src/components/Map/SearchMap/MapContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { getMapConfig } from 'components/Map/config';
import { MapContainer as LeafMapContainer } from 'react-leaflet';
import React, { memo } from 'react';
import { Map } from 'leaflet';

interface Props {
Expand Down Expand Up @@ -28,4 +27,4 @@ const MapContainer: React.FC<Props> = ({ children, whenCreated, hasZoomControl =
);
};

export default memo(MapContainer, () => true);
export default MapContainer;
5 changes: 5 additions & 0 deletions frontend/src/components/Map/SearchMap/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import { ResetView } from 'components/Map/components/ResetView';
import TileLayerManager from 'components/Map/components/TileLayerManager';
import FullscreenControl from 'components/Map/components/FullScreenControl';
import LocateControl from 'components/Map/components/LocateControl';
import { useListAndMapContext } from 'modules/map/ListAndMapContext';
import BoundsHandler from './BoundsHandler';

export type PropsType = {
segments?: { x: number; y: number }[];
Expand All @@ -35,6 +37,7 @@ const SearchMap: React.FC<PropsType> = props => {
};

const { setMapInstance } = useTileLayer();
const { searchBbox, isNavigatedByBrowser } = useListAndMapContext();

return (
<MapContainer whenCreated={setMapInstance} hasZoomControl={props.hasZoomControl}>
Expand All @@ -44,6 +47,8 @@ const SearchMap: React.FC<PropsType> = props => {
<FilterButton openFilterMenu={props.openFilterMenu} />
{props.hasZoomControl === true && <FullscreenControl />}
<ResetView />
{/* Must be below ResetView */}
{isNavigatedByBrowser && <BoundsHandler bounds={searchBbox} />}
<ScaleControl />
<LocateControl />
<SearchMapChildrens {...props} />
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/ToolTip/ToolTip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ const ToolTipGT: FC<Props> = ({
className={cn(
'tooltipSpan',
'relative absolute left-1/2 -translate-x-1/2 p-1.5 text-center rounded-md z-1',
'w-0 invisible',
'group-hover:w-max group-hover:visible',
'w-0 hidden',
'group-hover:w-max group-hover:inline',
"after:content-[''] after:block after:absolute after:left-1/2 after:-ml-1 after:border-4 after:border-transparent",
invertPosition
? 'top-full after:bottom-full after:border-b-primary1'
Expand Down
20 changes: 12 additions & 8 deletions frontend/src/components/pages/details/Details.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
import { DetailsViewPoints } from './components/DetailsViewPoints';
import { DetailsFiles } from './components/DetailsFiles';
import { theme } from '../../../../tailwind.config';
import { DetailsBackButton } from './components/DetailsPreview/DetailsBackButton';

interface Props {
slug: string | string[] | undefined;
Expand Down Expand Up @@ -706,7 +707,7 @@
)}
</>
),
[

Check warning on line 710 in frontend/src/components/pages/details/Details.tsx

View workflow job for this annotation

GitHub Actions / install-and-test

React Hook useMemo has missing dependencies: 'anchors', 'handleViewPointClick', 'hasNavigator', 'sectionRef', 'sections', and 'setMapId'. Either include them or remove the dependency array

Check warning on line 710 in frontend/src/components/pages/details/Details.tsx

View workflow job for this annotation

GitHub Actions / install-and-test

React Hook useMemo has missing dependencies: 'anchors', 'handleViewPointClick', 'hasNavigator', 'sectionRef', 'sections', and 'setMapId'. Either include them or remove the dependency array
details,
displayAltimetricProfile,
displayMobileMap,
Expand Down Expand Up @@ -736,15 +737,18 @@
return (
<div
id="details_headerMobile"
className={`py-3 px-4
text-P2 font-bold text-primary1
shadow-md bg-white
${displayState === 'DISPLAYED' ? 'top-mobileHeader sticky' : '-top-mobileHeader'}
desktop:hidden z-headerDetails truncate
transition-all duration-500
`}
className={cn(
'flex gap-3 items-center py-3 px-4',
'text-P2 font-bold text-primary1',
'shadow-md bg-white',
'-top-4 right-0 left-0 z-headerDetails fixed',
displayState === 'DISPLAYED' && 'top-0 translate-y-mobileHeader',
'desktop:hidden',
'transition-transform duration-500 will-change-transform',
)}
>
{name}
<DetailsBackButton className="border-r border-solid pr-4" />
<span className="truncate">{name}</span>
</div>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import React from 'react';
interface DetailsButtonProps {
url?: string;
onClick?: (event: React.MouseEvent) => void;
children: JSX.Element;
children: React.ReactNode;
}

export const DetailsButton: React.FC<DetailsButtonProps> = ({ 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 (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ interface DetailsButtonDropdownProps {
label: string;
size: number;
}[];
children: JSX.Element;
children: React.ReactNode;
}

export const DetailsButtonDropdown: React.FC<DetailsButtonDropdownProps> = ({
Expand Down
Loading
Loading