Made 'Петроградская' default metro station

Related to #44
This commit is contained in:
Dmitriy Shishkov 2023-09-05 08:30:09 +03:00
parent 74f89ae7cb
commit e9bf7eabaf
Signed by: dm1sh
GPG Key ID: 027994B0AA357688
2 changed files with 5 additions and 6 deletions

View File

@ -105,5 +105,7 @@ const lineByName = (name: string) => (
lines.find(line => stations[line].has(name)) lines.find(line => stations[line].has(name))
) )
const DEFAULT_LINE = 'Петроградская'
export type { Lines } export type { Lines }
export { lines, stations, colors, lineNames, lineByName } export { lines, stations, colors, lineNames, lineByName, DEFAULT_LINE }

View File

@ -7,7 +7,7 @@ import { useNavigate } from 'react-router-dom'
import { MapClickHandler, LocationMarker, CardLayout, LocateButton } from '../components' import { MapClickHandler, LocationMarker, CardLayout, LocateButton } from '../components'
import { useAddAnnouncement } from '../hooks/api' import { useAddAnnouncement } from '../hooks/api'
import { categories, categoryNames } from '../assets/category' import { categories, categoryNames } from '../assets/category'
import { stations, lines, lineNames } from '../assets/metro' import { stations, lines, lineNames, DEFAULT_LINE } from '../assets/metro'
import { fallbackError, gotResponse } from '../hooks/useFetch' import { fallbackError, gotResponse } from '../hooks/useFetch'
import { useOsmAddresses } from '../hooks/api' import { useOsmAddresses } from '../hooks/api'
@ -126,10 +126,7 @@ function AddPage() {
<Form.Label> <Form.Label>
Станция метро Станция метро
</Form.Label> </Form.Label>
<Form.Select name='metro'> <Form.Select name='metro' defaultValue={DEFAULT_LINE}>
<option value=''>
Укажите ближайщую станцию метро
</option>
{lines.map( {lines.map(
line => line =>
<optgroup key={line} label={lineNames[line]}> <optgroup key={line} label={lineNames[line]}>