diff --git a/frontend/src/App.module.less b/frontend/src/App.module.less
index be1b03a..5c1d07f 100644
--- a/frontend/src/App.module.less
+++ b/frontend/src/App.module.less
@@ -5,7 +5,9 @@
flex-direction: column;
justify-content: stretch;
- html, body, & {
+ html,
+ body,
+ & {
min-height: 100%;
}
}
@@ -18,14 +20,20 @@
background: @obsColorB4;
color: @obsColorW;
- h1, h2, h3, h4, h5, h6 {
+ h1,
+ h2,
+ h3,
+ h4,
+ h5,
+ h6 {
&:global(.ui.header) {
color: inherit;
}
}
a {
- &, &:hover {
+ &,
+ &:hover {
color: inherit;
}
@@ -65,7 +73,8 @@
font-weight: 600;
font-size: 18pt;
- &, &:hover {
+ &,
+ &:hover {
color: @obsColorB4;
}
}
@@ -114,16 +123,16 @@
.banner {
padding: 8px;
z-index: 100;
- border-bottom: 1px solid #DDD;
+ border-bottom: 1px solid #ddd;
&.warning {
- background: #FFD54F;
- border-color: #FBC02D;
+ background: #ffd54f;
+ border-color: #fbc02d;
color: #263238;
}
&.info {
- background: #4FC3F7;
- border-color: #0D47A1;
- color: #0D47A1;
+ background: #4fc3f7;
+ border-color: #0d47a1;
+ color: #0d47a1;
}
}
diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx
index c2edc73..d2b1e0e 100644
--- a/frontend/src/App.tsx
+++ b/frontend/src/App.tsx
@@ -51,7 +51,7 @@ function DropdownItemForLink({navigate, ...props}) {
)
}
-function Banner({text, style = 'warning'}: {text: string, style: 'warning' | 'info'}) {
+function Banner({text, style = 'warning'}: {text: string; style: 'warning' | 'info'}) {
return
{text}
}
diff --git a/frontend/src/api.js b/frontend/src/api.js
index 03a87b3..6faf624 100644
--- a/frontend/src/api.js
+++ b/frontend/src/api.js
@@ -47,7 +47,7 @@ class API {
async makeLoginUrl() {
const config = await configPromise
- const url = new URL(config.loginUrl || (config.apiUrl + '/login'))
+ const url = new URL(config.loginUrl || config.apiUrl + '/login')
url.searchParams.append('next', window.location.href) // bring us back to the current page
return url.toString()
}
diff --git a/frontend/src/components/Avatar/index.tsx b/frontend/src/components/Avatar/index.tsx
index 49519dc..a2d49f5 100644
--- a/frontend/src/components/Avatar/index.tsx
+++ b/frontend/src/components/Avatar/index.tsx
@@ -26,13 +26,13 @@ export default function Avatar({user, className}) {
}
if (!username) {
- return
+ return
}
const color = getColor(username)
return (
-
+
{username && {username[0]}}
)
diff --git a/frontend/src/components/Avatar/styles.less b/frontend/src/components/Avatar/styles.less
index a4b7f20..575a11d 100644
--- a/frontend/src/components/Avatar/styles.less
+++ b/frontend/src/components/Avatar/styles.less
@@ -16,12 +16,10 @@
}
}
-
.avatar.empty-avatar {
- background: #AAA;
+ background: #aaa;
}
-
.avatar.text-avatar,
.avatar.empty-avatar {
// border-radius: 0.25rem;
@@ -40,4 +38,3 @@
height: 64px;
}
}
-
diff --git a/frontend/src/components/ColorMapLegend.tsx b/frontend/src/components/ColorMapLegend.tsx
index b6ddd50..62047fb 100644
--- a/frontend/src/components/ColorMapLegend.tsx
+++ b/frontend/src/components/ColorMapLegend.tsx
@@ -13,18 +13,18 @@ export default function ColorMapLegend({map}: {map: ColorMap}) {
{map.map(([value, color]) => (
-
+
))}
- {map.map(([value]) =>
- {value.toFixed(2)}
- )}
+ {map.map(([value]) => (
+
+ {value.toFixed(2)}
+
+ ))}
)
}
diff --git a/frontend/src/components/LoginButton.js b/frontend/src/components/LoginButton.js
index 1bc603f..192c86e 100644
--- a/frontend/src/components/LoginButton.js
+++ b/frontend/src/components/LoginButton.js
@@ -1,18 +1,25 @@
import React from 'react'
-import {Button} from 'semantic-ui-react'
+import {Button} from 'semantic-ui-react'
import api from 'api'
-export default function LoginButton(props) {
+export default function LoginButton(props) {
const [busy, setBusy] = React.useState(false)
- const onClick = React.useCallback(async (e) => {
- e.preventDefault()
- setBusy(true)
- const url = await api.makeLoginUrl()
- window.location.href = url
- setBusy(false)
- }, [setBusy])
+ const onClick = React.useCallback(
+ async (e) => {
+ e.preventDefault()
+ setBusy(true)
+ const url = await api.makeLoginUrl()
+ window.location.href = url
+ setBusy(false)
+ },
+ [setBusy]
+ )
- return
+ return (
+
+ )
}
diff --git a/frontend/src/components/Map/index.tsx b/frontend/src/components/Map/index.tsx
index 598cdcd..86c82ce 100644
--- a/frontend/src/components/Map/index.tsx
+++ b/frontend/src/components/Map/index.tsx
@@ -12,7 +12,11 @@ import {baseMapStyles} from '../../mapstyles'
import styles from './styles.module.less'
-interface Viewport {longitude: number; latitude: number; zoom: number}
+interface Viewport {
+ longitude: number
+ latitude: number
+ zoom: number
+}
const EMPTY_VIEWPORT: Viewport = {longitude: 0, latitude: 0, zoom: 0}
export const withBaseMapStyle = connect((state) => ({baseMapStyle: state.mapConfig?.baseMap?.style ?? 'positron'}))
@@ -32,7 +36,7 @@ function buildHash(v: Viewport): string {
return `${v.zoom.toFixed(2)}/${v.latitude}/${v.longitude}`
}
-function useViewportFromUrl(): [Viewport|null, (v: Viewport) => void] {
+function useViewportFromUrl(): [Viewport | null, (v: Viewport) => void] {
const history = useHistory()
const location = useLocation()
const value = useMemo(() => parseHash(location.hash), [location.hash])
diff --git a/frontend/src/components/Page/index.tsx b/frontend/src/components/Page/index.tsx
index b2f864e..b5ce0d4 100644
--- a/frontend/src/components/Page/index.tsx
+++ b/frontend/src/components/Page/index.tsx
@@ -4,9 +4,26 @@ import {Container} from 'semantic-ui-react'
import styles from './Page.module.less'
-export default function Page({small, children, fullScreen, stage}: {small?: boolean, children: ReactNode, fullScreen?: boolean,stage?: ReactNode}) {
+export default function Page({
+ small,
+ children,
+ fullScreen,
+ stage,
+}: {
+ small?: boolean
+ children: ReactNode
+ fullScreen?: boolean
+ stage?: ReactNode
+}) {
return (
-
+
{stage}
{fullScreen ? children : {children}}
diff --git a/frontend/src/config.ts b/frontend/src/config.ts
index 8d10065..5e657eb 100644
--- a/frontend/src/config.ts
+++ b/frontend/src/config.ts
@@ -1,14 +1,16 @@
import React from 'react'
-export type MapSoure = {
- type: 'vector'
- url: string,
-} | {
- type: 'vector',
- tiles: string[],
- minzoom: number,
- maxzoom: number,
-}
+export type MapSoure =
+ | {
+ type: 'vector'
+ url: string
+ }
+ | {
+ type: 'vector'
+ tiles: string[]
+ minzoom: number
+ maxzoom: number
+ }
export interface Config {
apiUrl: string
@@ -22,7 +24,7 @@ export interface Config {
privacyPolicyUrl?: string
banner?: {
text: string
- style?: "warning" | "info"
+ style?: 'warning' | 'info'
}
}
diff --git a/frontend/src/mapstyles/index.js b/frontend/src/mapstyles/index.js
index d05942b..9d61e9e 100644
--- a/frontend/src/mapstyles/index.js
+++ b/frontend/src/mapstyles/index.js
@@ -8,18 +8,17 @@ import viridisBase from 'colormap/res/res/viridis'
export {bright, positron}
export const baseMapStyles = {bright, positron}
-
function simplifyColormap(colormap, maxCount = 16) {
const result = []
const step = Math.ceil(colormap.length / maxCount)
- for (let i = 0; i < colormap.length; i+= step) {
+ for (let i = 0; i < colormap.length; i += step) {
result.push(colormap[i])
}
return result
}
function rgbArrayToColor(arr) {
- return ['rgb', ...arr.map(v => Math.round(v*255))]
+ return ['rgb', ...arr.map((v) => Math.round(v * 255))]
}
export function colormapToScale(colormap, value, min, max) {
@@ -27,24 +26,19 @@ export function colormapToScale(colormap, value, min, max) {
'interpolate-hcl',
['linear'],
value,
- ...colormap.flatMap((v, i, a) => [
- (i / (a.length - 1)) * (max - min) + min,
- v,
- ])
+ ...colormap.flatMap((v, i, a) => [(i / (a.length - 1)) * (max - min) + min, v]),
]
}
-export const viridis = simplifyColormap(viridisBase.map(rgbArrayToColor), 20);
+export const viridis = simplifyColormap(viridisBase.map(rgbArrayToColor), 20)
export const grayscale = ['#FFFFFF', '#000000']
-export const reds = [['rgba', 255, 0, 0, 0], ['rgba', 255, 0, 0, 1]]
+export const reds = [
+ ['rgba', 255, 0, 0, 0],
+ ['rgba', 255, 0, 0, 1],
+]
export function colorByCount(attribute = 'event_count', maxCount, colormap = viridis) {
- return colormapToScale(
- colormap,
- ['case', ['to-boolean', ['get', attribute]], ['get', attribute], 0],
- 0,
- maxCount
- )
+ return colormapToScale(colormap, ['case', ['to-boolean', ['get', attribute]], ['get', attribute], 0], 0, maxCount)
}
export function colorByDistance(attribute = 'distance_overtaker_mean', fallback = '#ABC') {
@@ -68,13 +62,12 @@ export function colorByDistance(attribute = 'distance_overtaker_mean', fallback
]
}
-
export const trackLayer = {
type: 'line',
paint: {
'line-width': ['interpolate', ['linear'], ['zoom'], 14, 2, 17, 5],
'line-color': '#F06292',
- }
+ },
}
export const basemap = positron
diff --git a/frontend/src/pages/HomePage.module.less b/frontend/src/pages/HomePage.module.less
index 98585b7..82dc4ac 100644
--- a/frontend/src/pages/HomePage.module.less
+++ b/frontend/src/pages/HomePage.module.less
@@ -1,4 +1,4 @@
-@import "styles.less";
+@import 'styles.less';
.welcomeMap {
height: 60rem;
diff --git a/frontend/src/pages/LogoutPage.js b/frontend/src/pages/LogoutPage.js
index 757c8f6..700c711 100644
--- a/frontend/src/pages/LogoutPage.js
+++ b/frontend/src/pages/LogoutPage.js
@@ -5,9 +5,7 @@ import {Redirect} from 'react-router-dom'
import api from 'api'
-const LogoutPage = connect(
- (state) => ({loggedIn: Boolean(state.login)}),
-)(function LogoutPage({loggedIn}) {
+const LogoutPage = connect((state) => ({loggedIn: Boolean(state.login)}))(function LogoutPage({loggedIn}) {
React.useEffect(() => {
// no await, just trigger it
if (loggedIn) {
diff --git a/frontend/src/pages/MapPage/LayerSidebar.tsx b/frontend/src/pages/MapPage/LayerSidebar.tsx
index 079876f..77669fc 100644
--- a/frontend/src/pages/MapPage/LayerSidebar.tsx
+++ b/frontend/src/pages/MapPage/LayerSidebar.tsx
@@ -107,16 +107,18 @@ function LayerSidebar({
- {showEvents && <>
-
-
- >}
+ {showEvents && (
+ <>
+
+
+
+ >
+ )}
)
}
-
export default connect(
(state) => ({
mapConfig: _.merge(
diff --git a/frontend/src/pages/MapPage/index.tsx b/frontend/src/pages/MapPage/index.tsx
index 5dfb5b3..af1c3fd 100644
--- a/frontend/src/pages/MapPage/index.tsx
+++ b/frontend/src/pages/MapPage/index.tsx
@@ -88,7 +88,7 @@ const getEventsTextLayer = () => ({
'text-keep-upright': false,
'text-anchor': 'left',
'text-radial-offset': 1,
- 'text-rotate': ['-', 90, ['*', ['get', 'course'], 180/Math.PI]],
+ 'text-rotate': ['-', 90, ['*', ['get', 'course'], 180 / Math.PI]],
'text-rotation-alignment': 'map',
},
paint: {
diff --git a/frontend/src/pages/MapPage/styles.module.less b/frontend/src/pages/MapPage/styles.module.less
index 654d7e6..e4b8de1 100644
--- a/frontend/src/pages/MapPage/styles.module.less
+++ b/frontend/src/pages/MapPage/styles.module.less
@@ -2,7 +2,7 @@
.mapContainer {
height: calc(100vh - @menuHeight);
- background: #F0F0F3;
+ background: #f0f0f3;
position: relative;
display: flex;
align-items: stretch;
@@ -28,4 +28,3 @@
overflow: auto;
margin: 20px;
}
-
diff --git a/frontend/src/pages/SettingsPage.tsx b/frontend/src/pages/SettingsPage.tsx
index 7185ca8..2dcbb02 100644
--- a/frontend/src/pages/SettingsPage.tsx
+++ b/frontend/src/pages/SettingsPage.tsx
@@ -54,7 +54,13 @@ const SettingsPage = connect((state) => ({login: state.login}), {setLogin})(func
@@ -148,7 +154,7 @@ function ApiKeyDialog({login, onGenerateNewKey}) {
) : (
-
+
)
) : (