Skip to content

Commit

Permalink
Merge pull request #1398 from Tampere/fix/bug-fixes
Browse files Browse the repository at this point in the history
Fix/bug fixes
  • Loading branch information
mmoila authored Nov 12, 2024
2 parents 96ba19f + c221740 commit c691c91
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 14 deletions.
4 changes: 3 additions & 1 deletion frontend/src/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,9 @@ function Navbar() {
{recentGeneralNotifications?.data && recentGeneralNotifications.data.count > 0 ? (
<TooltipLinkTab
title={tr('pages.generalNewGeneralNotificationsTooltip')}
style={{ marginLeft: 'auto' }}
cssProp={css`
margin-left: auto;
`}
to="/tiedotteet"
icon={<Campaign />}
iconPosition="start"
Expand Down
3 changes: 1 addition & 2 deletions frontend/src/components/Map/Map.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { css } from '@mui/material';
import Feature from 'ol/Feature';
import OLMap from 'ol/Map';
import View from 'ol/View';
import { Control, ScaleLine } from 'ol/control';
import { ScaleLine } from 'ol/control';
import { isEmpty } from 'ol/extent';
import { Geometry } from 'ol/geom';
import { defaults as defaultInteractions } from 'ol/interaction';
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/components/Map/MapWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,13 @@ export function MapWrapper<TProject extends ProjectData, TProjectObject extends
<div
ref={mapWrapperRef}
style={{
transition: freezeMapHeight ? 'none' : ' height 0.4s',
transition: 'opacity 0.3s',
height: freezeMapHeight
? mapWrapperRef.current?.clientHeight
? `${mapWrapperRef.current.clientHeight}px`
: '100%'
: '100%',
opacity: freezeMapHeight ? 0 : 1,
position: 'relative',
display: 'flex',
flex: 1,
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/components/Map/NoGeomInfoBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export function NoGeomInfoBox(props: Props) {
projectId: string;
projectObjectId?: string;
};

const isNewItem =
(props.drawItemType === 'project' && !projectId) ||
(props.drawItemType === 'projectObject' && !projectObjectId);
Expand All @@ -27,8 +28,8 @@ export function NoGeomInfoBox(props: Props) {
const tr = useTranslations();

useEffect(() => {
if (editing && isVisible) setIsVisible(false);
}, [editing]);
if ((editing || !props.isVisible) && isVisible) setIsVisible(false);
}, [editing, props.isVisible]);

if (editing || !isVisible) {
return null;
Expand Down
8 changes: 3 additions & 5 deletions frontend/src/components/Map/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,11 +341,9 @@ function getSelectedClusterItemType(feature: FeatureLike) {

export function selectionLayerStyle(feature: FeatureLike) {
const geom = feature.getGeometry();
const clusterCount = feature.get('clusterCount');

if (
(geom?.getType() === 'Point' || geom?.getType() === 'MultiPoint') &&
['projectObjects', 'drawLayer'].includes(feature.get('layer'))
) {
if ((geom?.getType() === 'Point' || geom?.getType() === 'MultiPoint') && !clusterCount) {
return new Style({
image: new IconStyle({
opacity: 1,
Expand All @@ -354,7 +352,7 @@ export function selectionLayerStyle(feature: FeatureLike) {
}),
});
}
const clusterCount = feature.get('clusterCount');

if (clusterCount === 1) {
const itemType = getSelectedClusterItemType(feature);
return getClusterIconStyle(itemType);
Expand Down
6 changes: 4 additions & 2 deletions frontend/src/components/TooltipLinkTab.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import { SerializedStyles } from '@emotion/react';
import { Tab, TabProps, Tooltip } from '@mui/material';
import { Link } from 'react-router-dom';

interface Props extends TabProps<typeof Link> {
title: string;
cssProp?: SerializedStyles;
}

export function TooltipLinkTab(props: Props) {
const { title, ...tabProps } = props;
const { title, cssProp, ...tabProps } = props;

// Span used to get tooltip working even without disabled Tab
return (
<Tooltip title={title}>
<Tooltip title={title} {...(cssProp && { css: cssProp })}>
<span>
<Tab component={Link} {...tabProps} />
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ export const MaintenanceProjectForm = forwardRef(function MaintenanceProjectForm
errorTooltip={getDateFieldErrorMessage(
errors.endDate?.message ?? null,
tr('newProject.endDateTooltip'),
[dayjs(getValues('startDate')).add(5, 'year').year().toString()],
[(dayjs().year() + 5).toString()],
)}
component={(field) => (
<Box
Expand Down
1 change: 1 addition & 0 deletions frontend/src/views/ProjectObject/ProjectObjects.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ function ProjectObjectResults() {
const search = trpc.projectObject.search.useQuery({
...projectObjectSearchParams,
map: useDebounce(projectObjectSearchParams.map, 400),
projectObjectName: useDebounce(projectObjectSearchParams.projectObjectName, 250),
});

return (
Expand Down

0 comments on commit c691c91

Please sign in to comment.