Skip to content

Commit

Permalink
feat: add external uri button on Station
Browse files Browse the repository at this point in the history
  • Loading branch information
babastienne committed May 7, 2024
1 parent 9398157 commit b634111
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/api/stations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export type Station = {
description: string;
customContributionTypes: number[];
observations?: StationObservations | null;
url?: string;
geometry: {
type: string;
coordinates: number[];
Expand Down
13 changes: 12 additions & 1 deletion src/components/station.page.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { Observation } from '@/api/customObservations';
import { Station } from '@/api/stations';
import { LatLngTuple } from 'leaflet';
import { useTranslations } from 'next-intl';

import ButtonCenterView from './button-center-view';
import ButtonClose from './button-close';
import { StationContributionList } from './station-contribution-list';
import { StationContributionTypesList } from './station-contribution-types-list';
import LinkAsButton from './ui/link-as-button';

type Props = {
content: Station;
Expand All @@ -14,7 +16,7 @@ type Props = {

export default function StationPageUI({ content, observationTypes }: Props) {
const observations = content.observations ?? [];

const t = useTranslations('details');
return (
<article>
<header>
Expand All @@ -35,6 +37,15 @@ export default function StationPageUI({ content, observationTypes }: Props) {
{content.description.split('\n').map(e => (
<p>{e}</p>
))}
{content?.url && (
<LinkAsButton
target="_blank"
className="mx-auto mt-4 block w-fit"
href={content?.url}
>
{t('link')}
</LinkAsButton>
)}
</div>
<StationContributionTypesList
ids={content.customContributionTypes || []}
Expand Down

0 comments on commit b634111

Please sign in to comment.