Skip to content

Commit

Permalink
feat(edit tile): implements platform dropdown in settings components
Browse files Browse the repository at this point in the history
  • Loading branch information
stianjsu committed Jul 14, 2023
1 parent 4e76f41 commit 94677ef
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import { isNotNullOrUndefined } from 'utils/typeguards'

const stopPlaceOption = { value: 'stopPlace', label: 'Vis Alle' } as const

function PlatformDropdown<T extends TTile>({
function PlatformDropdown({
stopPlaceId,
tile,
}: {
stopPlaceId: string
tile: T
tile: TTile
}) {
const dispatch = useSettingsDispatch()

Expand Down Expand Up @@ -55,13 +55,15 @@ function PlatformDropdown<T extends TTile>({
type: 'stop_place',
placeId: stopPlaceId,
uuid: tile.uuid,
columns: tile.columns,
})
else
setTile({
type: 'quay',
stopPlaceId,
placeId: e.value,
uuid: tile.uuid,
columns: tile.columns,
})
}
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { useQuery } from 'graphql/utils'
import { TQuayTile } from 'types/tile'
import { fieldsNotNull } from 'utils/typeguards'
import { TileSettingsWrapper } from './TileSettingsWrapper'
import { PlatformDropdown } from './PlatformDropdown'

function QuaySettings({ tile }: { tile: TQuayTile }) {
const { data } = useQuery(GetQuayQuery, { quayId: tile.placeId })
Expand All @@ -18,6 +19,7 @@ function QuaySettings({ tile }: { tile: TQuayTile }) {

return (
<TileSettingsWrapper name={name}>
<PlatformDropdown stopPlaceId={tile.stopPlaceId} tile={tile} />
<SelectLines tile={tile} lines={lines} />
</TileSettingsWrapper>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { useQuery } from 'graphql/utils'
import { TStopPlaceTile } from 'types/tile'
import { fieldsNotNull } from 'utils/typeguards'
import { TileSettingsWrapper } from './TileSettingsWrapper'
import { PlatformDropdown } from './PlatformDropdown'

function StopPlaceSettings({ tile }: { tile: TStopPlaceTile }) {
const { data } = useQuery(StopPlaceSettingsQuery, { id: tile.placeId })
Expand All @@ -17,6 +18,7 @@ function StopPlaceSettings({ tile }: { tile: TStopPlaceTile }) {

return (
<TileSettingsWrapper name={name}>
<PlatformDropdown stopPlaceId={tile.placeId} tile={tile} />
<SelectLines tile={tile} lines={lines} />
</TileSettingsWrapper>
)
Expand Down

0 comments on commit 94677ef

Please sign in to comment.