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(landing): show full boards on landing page #1653

Merged
merged 4 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { IconButton } from '@entur/button'
import { LeftArrowIcon, RightArrowIcon } from '@entur/icons'
import { Board } from 'Board/scenarios/Board'
import { Preview } from 'app/(admin)/edit/[id]/components/Preview'
import { usePostHog } from 'posthog-js/react'
import { useEffect, useState } from 'react'
import { TBoard } from 'types/settings'
Expand Down Expand Up @@ -34,7 +34,7 @@ const CarouselIndicators = ({
)
}

function Preview({ boards }: { boards: TBoard[] }) {
function PreviewCarousel({ boards }: { boards: TBoard[] }) {
const [boardIndex, setBoardIndex] = useState(0)
const [fade, setFade] = useState(true)
const posthog = usePostHog()
Expand Down Expand Up @@ -71,8 +71,8 @@ function Preview({ boards }: { boards: TBoard[] }) {
const currentBoard = boards[boardIndex] ?? undefined
if (!currentBoard) return null
return (
<div className="xl:w-1/2 h-[50vh] overflow-hidden rounded-2xl py-10 w-full">
<div className="flex flex-row h-[40vh]">
<div className="md:h-[50vh] py-10">
<div className="flex flex-row md:h-[40vh]">
SelmaBergstrand marked this conversation as resolved.
Show resolved Hide resolved
<div className="my-auto hidden md:block ml-2">
<IconButton
onClick={prevSlide}
Expand All @@ -87,15 +87,12 @@ function Preview({ boards }: { boards: TBoard[] }) {
>
<div
aria-label="Eksempel på avgangstavler"
className={`w-full h-full transform transition-all duration-500 ease-in-out p-2 ${
className={`transform transition-all duration-500 ease-in-out ${
fade ? 'opacity-100' : 'opacity-0'
}`}
style={{ display: 'flex' }}
>
<Board
aria-hidden
board={currentBoard}
style={{ display: 'flex' }}
/>
<Preview aria-hidden board={currentBoard} landingPage />
</div>
</div>
<div className="my-auto hidden md:block mr-2">
Expand All @@ -116,4 +113,4 @@ function Preview({ boards }: { boards: TBoard[] }) {
</div>
)
}
export { Preview }
export { PreviewCarousel }
12 changes: 10 additions & 2 deletions tavla/app/(admin)/edit/[id]/components/Preview/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,25 @@ import { TBoard, TOrganization } from 'types/settings'
function Preview({
board,
organization,
landingPage,
}: {
board: TBoard
organization?: TOrganization
landingPage?: boolean
SelmaBergstrand marked this conversation as resolved.
Show resolved Hide resolved
}) {
return (
<div
className="rounded p-4 bg-primary border border-secondary text-2xl"
className={`rounded p-4 bg-primary border border-secondary ${
landingPage ? 'text-xs' : 'text-2xl'
}`}
data-theme={board?.theme ?? 'dark'}
>
<Header theme={board.theme} organizationLogo={organization?.logo} />
<div className="h-[50rem]">
<div
className={`${
landingPage ? 'md:h-[32em] h-[22em]' : 'h-[50rem]'
}`}
>
<Board board={board} />
</div>
<Footer
Expand Down
4 changes: 2 additions & 2 deletions tavla/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
Paragraph,
UnorderedList,
} from '@entur/typography'
import { Preview } from './(admin)/components/Preview'
import { PreviewCarousel } from './(admin)/components/PreviewCarousel'
import { previewBoards } from '../src/Shared/utils/previewBoards'
import { Welcome } from './components/Welcome'
import { Link as EnturLink } from '@entur/typography'
Expand Down Expand Up @@ -54,7 +54,7 @@ async function Landing() {

<div className="flex flex-col mx-auto items-center justify-start py-4 container overflow-hidden pb-10">
<div className="flex flex-col items-center justify-start gap-4 py-4 w-full">
<Preview boards={previewBoards} />
<PreviewCarousel boards={previewBoards} />

<div className="xl:w-1/2">
<Heading2>Kort om Tavla</Heading2>
Expand Down
25 changes: 25 additions & 0 deletions tavla/src/Shared/utils/previewBoards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,19 @@ export const previewBoards: TBoard[] = [
type: 'stop_place',
uuid: '1s9E_8qW_e2-cWii94rl4',
},
{
columns: [
'line',
'destination',
'time',
'realtime',
'platform',
],
placeId: 'NSR:StopPlace:59853',
name: 'Stavanger bussterminal, Stavanger',
type: 'stop_place',
uuid: 'hV659BA6dvQiRCIbNdIJR',
},
],
},
{
Expand Down Expand Up @@ -53,6 +66,18 @@ export const previewBoards: TBoard[] = [
},
theme: 'light',
tiles: [
{
columns: ['line', 'destination', 'time', 'realtime'],
placeId: 'NSR:StopPlace:6479',
name: 'CC vest, Oslo',
type: 'stop_place',
uuid: '8y-eAK8DVbuNQS8JYxTMf',
walkingDistance: {
distance: 441,
visible: true,
},
},

{
columns: ['line', 'destination', 'time', 'realtime'],
placeId: 'NSR:StopPlace:58856',
Expand Down