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

React 18 Type changes #1027

Draft
wants to merge 22 commits into
base: develop
Choose a base branch
from
Draft
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
9971eb4
ZES: Refactor config
tordans Mar 14, 2022
53f3fe9
ZES: Move `/sections` to `/forschungsprojekt`
tordans Mar 14, 2022
ac87354
Components Article: Introduce `<Details>
tordans Mar 14, 2022
6b9391b
ZES: Introduce CycleNetworkDevelopmentPage
tordans Mar 14, 2022
ac25e6f
ZES: Refactor existing content
tordans Mar 14, 2022
42b2337
Refactor icon filename "smartphone-finger-icon"
tordans Mar 14, 2022
ce96530
Refactor icon filename "close-icon"
tordans Mar 14, 2022
d9eb115
Refactor import name "PlaceholderImageDesktop"
tordans Mar 14, 2022
7ea7dd0
Component: Add FlyingLegend, Refactor Planning-Legend
tordans Mar 14, 2022
af9acc8
Fix .vscode Extension for styled components
tordans Mar 15, 2022
67ae43e
Refactor Component ErrorMessages to tsx
tordans Mar 15, 2022
12850e1
Refactor Legend, Extract Components, Update to TS
tordans Mar 16, 2022
9d84ea0
Refactoring: Move MapLegend into Map-Scope
tordans Mar 17, 2022
1f42062
Improve styled component code
tordans Mar 17, 2022
a885ea4
Refactor+Mobile: Close-X Component and FloatingLegend
tordans Mar 17, 2022
f5c35e2
Remove Map Layer Toggle from Xhain
tordans Mar 17, 2022
b1e7354
Extract MapActivationButton in shared component
tordans Mar 17, 2022
5dc47a0
Refactor MapControls position
tordans Mar 17, 2022
40ea9c0
Add comment about process.env.CONTEXT
tordans Mar 17, 2022
fbab2cb
Refactor config routes, menu for all apps
tordans Mar 17, 2022
d32ea42
Hide Login link in Sidebar via config.menu.login=false
tordans Mar 17, 2022
891c216
Typescript: Add explicit children to React.FC
tordans Apr 11, 2022
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
2 changes: 1 addition & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"editorconfig.editorconfig",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"jpoissonnier.vscode-styled-components",
"styled-components.vscode-styled-components"
]
}
2 changes: 1 addition & 1 deletion src/apps/Gastro/components/FileUpload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ type Props = ConnectedProps<typeof connector> & {
isSubmitting: boolean;
name: string;
values: any;
children: React.ReactNode; // shouldn't be necessary but it is
children: React.ReactNode;
};

const FileUploadRaw: React.FC<Props> = ({
Expand Down
16 changes: 16 additions & 0 deletions src/apps/Map/assets/map-legend-icon-activated.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions src/apps/Map/assets/minus-circle-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions src/apps/Map/assets/plus-circle-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
59 changes: 0 additions & 59 deletions src/apps/Map/components/MapControl.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
import React from 'react';

import ConstructionLegendImage from './assets/construction.png';
import DividersLegendImage from './assets/dividers.png';
import FootwaysLegendImage from './assets/footways.png';
import GuardrailLegendImage from './assets/guardrail-legend.png';
import {
CadastreLegendItemColor,
CadastreLegendItemImage,
CadastreLegendItemLine,
CadastreLegendItemPoint,
CadastreLegendItemPointSmall,
CadastreLegendItemLine,
Header,
LegendCol,
LegendItem,
LegendWrapper,
ConstructionLegendImage,
DividersLegendImage,
FootwaysLegendImage,
GuardrailLegendImage,
} from './index';
} from './Styles';

export const CadastreLegendGrid = () => (
<LegendWrapper>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import React from 'react';

import {
CadastreLegendItemPoint,
HeaderCol,
LegendCol,
LegendItem,
LegendWrapper,
} from './index';
} from './Styles';

export const IncidentLegendGrid = () => (
<LegendWrapper>
Expand Down
51 changes: 51 additions & 0 deletions src/apps/Map/components/MapLegend/Legend.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import React from 'react';
import styled from 'styled-components';
import { AnchorLink } from '~/components2/Link';
import {
FloatingLegend,
FloatingLegendProps,
} from '~/components2/FloatingLegend';
import config from '~/config';
import { CadastreLegendGrid, IncidentLegendGrid } from '.';

const Header = styled.h1`
font-size: 1.2em;
font-weight: 400;
margin-top: 1rem;
margin-right: 0;
margin-bottom: 0;
margin-left: 0;
padding-bottom: 0.5em;
border-bottom: solid 1px #e0e0e0;
`;

export const MutedText = styled.div`
color: ${config.colors.midgrey};
font-size: 0.9rem;
margin: 0.5rem 0 1.5rem 0;
`;

const FooterWrapper = styled.div`
margin-top: 1rem;
`;

type Props = Pick<FloatingLegendProps, 'visible' | 'closeLegend'>;

export const Legend: React.FC<Props> = ({ visible, closeLegend }) => {
return (
<FloatingLegend visible={visible} closeLegend={closeLegend}>
<Header>Legende Katasterdaten</Header>
<CadastreLegendGrid />
<MutedText>Quellen: Fis-Broker Berlin 2014</MutedText>

<Header>Legende Unfälle</Header>
<IncidentLegendGrid />

<FooterWrapper>
<AnchorLink href="https://de.wikipedia.org/wiki/Unfalltyp">
Erläuterungen der Unfallkategorien
</AnchorLink>
</FooterWrapper>
</FloatingLegend>
);
};
3 changes: 3 additions & 0 deletions src/apps/Map/components/MapLegend/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from './Legend';
export * from './IncidentLegendGrid';
export * from './CadastreLegendGrid';
98 changes: 35 additions & 63 deletions src/apps/Map/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,29 @@ import {
withRouter,
} from 'react-router-dom';
import styled from 'styled-components';
import ErrorMessage from '~/components/ErrorMessage';
import { Legend } from './components/MapLegend';
import { ErrorMessage } from '~/components2/ErrorMessage';
import { FloatingLegendIcon } from '~/components2/FloatingLegend';
import { Logo as FMBLogo } from '~/components2/Logo';
import Legend from '~/components/MapLegend/Legend';
import {
LocatorButton,
MapControl,
StyledMapButton,
} from '~/components2/MapsControls';
import config from '~/config';
import MapLegendButtonIcon from '~/images/map-legend-icon.svg';
import MapLegendButtonActivatedIcon from '~/images/map-legend-icon-activated.svg';
import ZoomInButtonIcon from '~/images/plus-circle-icon.svg';
import ZoomOutButtonIcon from '~/images/minus-circle-icon.svg';
import Store, { RootState } from '~/store';
import { matchMediaSize, breakpoints, media } from '~/styles/utils';

import * as MapActions from './MapState';
import { breakpoints, matchMediaSize, media } from '~/styles/utils';
import ZoomOutButtonIcon from './assets/minus-circle-icon.svg';
import ZoomInButtonIcon from './assets/plus-circle-icon.svg';
import { DetailPanel } from './components/DetailView';
import ProjectDetail from './components/DetailView/ProjectDetail';
import { SectionDetail } from './components/DetailView/SectionDetail';
import FMBCredits from './components/FMBCredits';
import LocatorControl from './components/LocatorControl';
import MapContent from './components/MapContent';
import MapControl from './components/MapControl';
import { MapPopup } from './components/MapPopup';
import SearchBar from './components/SearchBar';
import { WebglMap } from './components/WebglMap';
import * as MapActions from './MapState';

const Wrapper = styled.div`
height: 100%;
Expand All @@ -54,26 +55,6 @@ const StyledFMBLogo = styled(FMBLogo)`
`}
`;

const StyledMapLegendButton = styled(MapLegendButtonIcon)`
cursor: pointer;
`;

const StyledMapLegendButtonActivated = styled(MapLegendButtonActivatedIcon)`
cursor: pointer;
`;

const StyledZoomInButton = styled(ZoomInButtonIcon)`
cursor: pointer;
`;

const StyledZoomOutButton = styled(ZoomOutButtonIcon)`
cursor: pointer;
`;

const StyledMapControl = styled(MapControl)`
margin-bottom: 45px;
`;

const connector = connect(
({ MapState, UserState }: RootState) => ({
activeLayer: MapState.activeView,
Expand Down Expand Up @@ -145,50 +126,41 @@ const MapView = ({
return (
<Wrapper>
{error != null && (
<ErrorMessage message={error} onDismiss={dismissErrorMessage} />
<ErrorMessage onDismiss={dismissErrorMessage}>{error}</ErrorMessage>
)}

<MapWrapper>
<SearchBar />
{showLegend && <Legend closeLegend={() => setShowLegend(false)} />}
<Legend visible={showLegend} closeLegend={() => setShowLegend(false)} />
<WebglMap
key="MapComponent"
calculatePopupPosition={calculatePopupPosition}
>
{!displayPopup && (
<LocatorControl
key="Map__LocatorControl"
onChange={handleLocationChange}
position="bottom-right"
/>
)}
<StyledMapControl position="bottom-right" role="button">
<div>
<div>
<StyledZoomInButton onClick={() => changeZoom(1)} />
</div>
<div>
<StyledZoomOutButton onClick={() => changeZoom(-1)} />
</div>
<div>
{!showLegend && (
<StyledMapLegendButton
onClick={() => setShowLegend(!showLegend)}
/>
)}
{showLegend && (
<StyledMapLegendButtonActivated
onClick={() => setShowLegend(!showLegend)}
/>
)}
</div>
</div>
</StyledMapControl>
{!isEmbedMode && (
<MapControl position="top-right">
<MapControl top right>
<StyledFMBLogo width={67} />
</MapControl>
)}

<MapControl
visible={!isDesktopView && !showLegend}
style={{ right: '16px', bottom: '25px' }}
>
<StyledMapButton
as={ZoomInButtonIcon}
onClick={() => changeZoom(1)}
/>
<StyledMapButton
as={ZoomOutButtonIcon}
onClick={() => changeZoom(-1)}
/>
<FloatingLegendIcon
showLegend={showLegend}
setShowLegend={setShowLegend}
/>
{!displayPopup && <LocatorButton onChange={handleLocationChange} />}
</MapControl>

{isEmbedMode && <FMBCredits />}
</WebglMap>

Expand Down
Loading