Skip to content

Commit

Permalink
fix(tilecard): remove county name from header (#1621)
Browse files Browse the repository at this point in the history
  • Loading branch information
oyvindgrutle authored Aug 22, 2024
1 parent 2f30350 commit 9d10302
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 14 deletions.
15 changes: 5 additions & 10 deletions tavla/app/(admin)/edit/[id]/components/TileCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import {
Paragraph,
SubParagraph,
} from '@entur/typography'
import { isEmptyOrSpaces } from 'app/(admin)/edit/utils'
import { ColumnModal } from 'app/(admin)/organizations/components/DefaultColumns/ColumnModal'
import Goat from 'assets/illustrations/Goat.png'
import { HiddenInput } from 'components/Form/HiddenInput'
Expand Down Expand Up @@ -150,7 +149,9 @@ function TileCard({
}`}
>
<div className="flex flex-row gap-4 items-center ">
<Heading3 margin="none">{tile.name}</Heading3>
<Heading3 margin="none">
{tile.displayName ?? tile.name}
</Heading3>
<div className="hidden sm:flex flex-row gap-4 h-8">
{transportModes.map((tm) => (
<TransportIcon transportMode={tm} key={tm} />
Expand Down Expand Up @@ -226,12 +227,6 @@ function TileCard({
) as string
data.delete('displayName')

if (isEmptyOrSpaces(displayName))
return addToast({
variant: 'info',
content: 'Navnet kan ikke være tomt.',
})

let lines: string[] = []
for (const line of data.values()) {
lines.push(line as string)
Expand All @@ -251,7 +246,7 @@ function TileCard({
distance: tile.walkingDistance?.distance,
},
offset: Number(offset) || undefined,
name: displayName,
displayName: displayName || undefined,
} as TTile

bid === 'demo'
Expand All @@ -272,7 +267,7 @@ function TileCard({
label="Navn på stoppested"
className="!w-2/5"
name="displayName"
defaultValue={tile.name}
defaultValue={tile.displayName}
/>
</div>
<Heading4>Gåavstand</Heading4>
Expand Down
4 changes: 2 additions & 2 deletions tavla/src/Board/scenarios/QuayTile/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export function QuayTile({
columns,
walkingDistance,
offset,
name,
displayName,
}: TQuayTile) {
const { data } = useQuery(
GetQuayQuery,
Expand Down Expand Up @@ -49,7 +49,7 @@ export function QuayTile({
return (
<Tile className="flex flex-col">
<TableHeader
heading={name ?? heading}
heading={displayName ?? heading}
walkingDistance={walkingDistance}
/>
<Table
Expand Down
4 changes: 2 additions & 2 deletions tavla/src/Board/scenarios/StopPlaceTile/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export function StopPlaceTile({
columns,
walkingDistance,
offset,
name,
displayName,
}: TStopPlaceTile) {
const { data } = useQuery(
StopPlaceQuery,
Expand Down Expand Up @@ -44,7 +44,7 @@ export function StopPlaceTile({
return (
<Tile className="flex flex-col">
<TableHeader
heading={name ?? data.stopPlace.name}
heading={displayName ?? data.stopPlace.name}
walkingDistance={walkingDistance}
/>
<Table
Expand Down
1 change: 1 addition & 0 deletions tavla/src/Shared/types/tile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export type TSharedTile = {
whitelistedTransportModes?: TTransportMode[]
walkingDistance?: TWalkingDistance
offset?: number
displayName?: string
}

export type TColumnTile = {
Expand Down

0 comments on commit 9d10302

Please sign in to comment.