Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add external uri button on Station #76

Merged
merged 1 commit into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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