diff --git a/src/routes/journey.tsx b/src/routes/journey.tsx index 54562dc..74bed42 100644 --- a/src/routes/journey.tsx +++ b/src/routes/journey.tsx @@ -27,48 +27,52 @@ function Connection({ ); } +function Connection3() { + return ( +
+
content
+ {/*
+ content +
*/} +
+ + {() => ( +
+
+
+
+ )} +
+
+
+ ); +} + function Journey1() { return ( <> + {/* flex-none: diasable elements shrinking to fit the flex container */}
Start
+ {/* overscroll-x-contain: we need to be able to scroll on the y-axis */}
- - {(_, index) => ( -
-
-
- content -
- {/*
- - {() => ( -
-
-
-
- )} -
-
*/} -
- )} -
+ {(_, index) => }
-- 2.51.2 From 8d0a5bdbb54b63b731ac87728a0712cc029d0afe Mon Sep 17 00:00:00 2001 From: Claas Date: Fri, 21 Jun 2024 18:38:34 +0200 Subject: [PATCH 02/11] Add first connection --- src/routes/journey.tsx | 117 +++++++++++++++++++++++++++++++++++------ 1 file changed, 102 insertions(+), 15 deletions(-) diff --git a/src/routes/journey.tsx b/src/routes/journey.tsx index 74bed42..e0bf2d5 100644 --- a/src/routes/journey.tsx +++ b/src/routes/journey.tsx @@ -27,20 +27,79 @@ function Connection({ ); } -function Connection3() { +/** Change between two connections */ +type Change = { + /** Time to change */ + time: string; + connection: Connection2; +}; + +type Connection2 = { + line: string; + headsign: string; + destination: string; + time: { + change?: string; + arrive: string; + depart: string; + duration: string; + }; + + changes?: Change[]; +}; +function Connection3(connection: Connection2): JSX.Element { return ( -
-
content
- {/*
- content -
*/} +
+
+ +
+
+
+
+ +
+
+
+

+ to {connection.headsign} +

+ +
+
+
+
+
+ + + + {connection.line} +
+
+

{connection.destination}

{/* flex-none: diasable elements shrinking to fit the flex container */} -
+
Start
{/* overscroll-x-contain: we need to be able to scroll on the y-axis */}
- {(_, index) => } + {Connection3}
@@ -370,3 +429,31 @@ const connections: Connection[] = [ ], }, ]; + +const connections2: Connection2[] = [ + { + line: "STR 62", + headsign: "Dottendorf Quirinusplatz, Bonn", + time: { + arrive: "16:07", + depart: "15:58", + duration: "9min", + }, + destination: "Hauptbahnhof, Bonn", + changes: [ + { + time: "5min", + connection: { + line: "STR 16", + headsign: "Niehl Sebastianstr., Köln", + destination: "Neumarkt, Köln", + time: { + arrive: "17:05", + depart: "16:12", + duration: "53min", + }, + }, + }, + ], + }, +]; -- 2.51.2 From 472f3272af3c099df6a2404f55435f0e2e5ca2e7 Mon Sep 17 00:00:00 2001 From: Claas Date: Fri, 21 Jun 2024 19:15:02 +0200 Subject: [PATCH 03/11] Add second connection --- README.md | 33 +------------ src/routes/journey.tsx | 102 ++++++++++++++++++++++++++--------------- 2 files changed, 67 insertions(+), 68 deletions(-) diff --git a/README.md b/README.md index a84af39..6f6995f 100644 --- a/README.md +++ b/README.md @@ -1,32 +1,3 @@ -# SolidStart +# Alternative Name Ideas -Everything you need to build a Solid project, powered by [`solid-start`](https://start.solidjs.com); - -## Creating a project - -```bash -# create a new project in the current directory -npm init solid@latest - -# create a new project in my-app -npm init solid@latest my-app -``` - -## Developing - -Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server: - -```bash -npm run dev - -# or start the server and open the app in a new browser tab -npm run dev -- --open -``` - -## Building - -Solid apps are built with _presets_, which optimise your project for deployment to different environments. - -By default, `npm run build` will generate a Node app that you can run with `npm start`. To use a different preset, add it to the `devDependencies` in `package.json` and specify in your `app.config.js`. - -## This project was created with the [Solid CLI](https://solid-cli.netlify.app) +- Destation/Destiation/Destiate/Destia/Destistation (Destination + Station) diff --git a/src/routes/journey.tsx b/src/routes/journey.tsx index e0bf2d5..1727c7e 100644 --- a/src/routes/journey.tsx +++ b/src/routes/journey.tsx @@ -1,4 +1,4 @@ -import { For, Show, createSignal, type JSX } from "solid-js"; +import { For, Match, Show, Switch, createSignal, type JSX } from "solid-js"; /** * A recursive component building the tree of connections @@ -27,29 +27,30 @@ function Connection({ ); } -/** Change between two connections */ -type Change = { - /** Time to change */ - time: string; - connection: Connection2; -}; - type Connection2 = { + /** Start and at the same time destination of the parent connection before this if this is not the first connection */ + start: string; line: string; headsign: string; - destination: string; + /** Only set if this is the last connection/leaf in the connection tree. If this is the last connection, then changes should not exist */ + destination?: string; time: { + /** Time to change from the connection before this (parent connection). Optional because this could be the first connection */ change?: string; arrive: string; depart: string; duration: string; }; - changes?: Change[]; + /** Optional because this could be the last connection and destination is set. */ + changes?: Connection2[]; }; function Connection3(connection: Connection2): JSX.Element { return (
+

+ {connection.time.change} {connection.start} +

{connection.line}
-

{connection.destination}

-
- - {() => ( -
-
-
-
- )} -
-
+ + + {" "} +
+ {Connection3} +
+
+ +

+ Neumarkt, Köln +

+
+
); } @@ -432,6 +435,7 @@ const connections: Connection[] = [ const connections2: Connection2[] = [ { + start: "Beuel Konrad-Adenauer-Platz, Bonn", line: "STR 62", headsign: "Dottendorf Quirinusplatz, Bonn", time: { @@ -442,16 +446,40 @@ const connections2: Connection2[] = [ destination: "Hauptbahnhof, Bonn", changes: [ { - time: "5min", - connection: { - line: "STR 16", - headsign: "Niehl Sebastianstr., Köln", - destination: "Neumarkt, Köln", - time: { - arrive: "17:05", - depart: "16:12", - duration: "53min", - }, + start: "Hauptbahnhof, Bonn", + line: "STR 16", + headsign: "Niehl Sebastianstr., Köln", + destination: "Neumarkt, Köln", + time: { + change: "5min", + arrive: "17:05", + depart: "16:12", + duration: "53min", + }, + }, + ], + }, + { + start: "Beuel Konrad-Adenauer-Platz, Bonn", + line: "STR 62", + headsign: "Dottendorf Quirinusplatz, Bonn", + time: { + arrive: "16:17", + depart: "16:08", + duration: "9min", + }, + destination: "Hauptbahnhof, Bonn", + changes: [ + { + start: "Hauptbahnhof, Bonn", + line: "STR 16", + headsign: "Niehl Sebastianstr., Köln", + destination: "Neumarkt, Köln", + time: { + change: "5min", + arrive: "17:15", + depart: "16:22", + duration: "53min", }, }, ], -- 2.51.2 From 8e4c79bbc72ab1999a402e418d92b84b1b375d02 Mon Sep 17 00:00:00 2001 From: Claas Date: Fri, 21 Jun 2024 19:21:35 +0200 Subject: [PATCH 04/11] Style connection start --- src/routes/journey.tsx | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/routes/journey.tsx b/src/routes/journey.tsx index 1727c7e..ac159f9 100644 --- a/src/routes/journey.tsx +++ b/src/routes/journey.tsx @@ -48,8 +48,18 @@ type Connection2 = { function Connection3(connection: Connection2): JSX.Element { return (
-

- {connection.time.change} {connection.start} +

+ + + + + {connection.start} +

- {" "}
Date: Fri, 21 Jun 2024 21:00:29 +0200 Subject: [PATCH 05/11] Add more connection data --- src/routes/journey.tsx | 414 +++++++++++++++++++++++++++++++++++------ 1 file changed, 361 insertions(+), 53 deletions(-) diff --git a/src/routes/journey.tsx b/src/routes/journey.tsx index ac159f9..0271aa9 100644 --- a/src/routes/journey.tsx +++ b/src/routes/journey.tsx @@ -27,27 +27,13 @@ function Connection({ ); } -type Connection2 = { - /** Start and at the same time destination of the parent connection before this if this is not the first connection */ - start: string; - line: string; - headsign: string; - /** Only set if this is the last connection/leaf in the connection tree. If this is the last connection, then changes should not exist */ - destination?: string; - time: { - /** Time to change from the connection before this (parent connection). Optional because this could be the first connection */ - change?: string; - arrive: string; - depart: string; - duration: string; - }; - - /** Optional because this could be the last connection and destination is set. */ - changes?: Connection2[]; -}; -function Connection3(connection: Connection2): JSX.Element { +function TransportConnection({ + connection, +}: { + connection: Transport; +}): JSX.Element { return ( -
+ <>

+ + ); +} + +function Connection3(connection: Connection2): JSX.Element { + return ( +
+ {/* TODO make this aligned through grid to area below */} + + + + + +
Walk
+
+
+
{Connection3}
- +

{/* flex-none: diasable elements shrinking to fit the flex container */} -

-
Start
+
{/* overscroll-x-contain: we need to be able to scroll on the y-axis */}
- - }> - - + ); } @@ -442,21 +457,217 @@ const connections: Connection[] = [ }, ]; +type Line2 = { + type: "STR" | "Bus" | "RE" | "RB"; + color: string; + number: string; +}; +type Changes = { + /** Optional because this could be the last connection and destination is set. */ + changes?: Connection2[]; +}; +type Transport = { + type: "transport"; + /** Start and at the same time destination of the parent connection before this if this is not the first connection */ + start: string; + line: Line2; + headsign: string; + /** Only set if this is the last connection/leaf in the connection tree. If this is the last connection, then changes should not exist */ + destination?: string; + time: { + /** Time to change from the connection before this (parent connection). Optional because this could be the first connection */ + change?: string; + arrive: string; + depart: string; + duration: string; + delay?: { + arrive: string; + depart: string; + }; + }; + platform?: string; +}; + +type Walk = { + type: "walk"; + timeAvailable: string; + distance: string; + time: string; + + /** Optional because this could be the last connection and destination is set. */ + changes?: Connection2[]; +}; +type Connection2 = (Transport | Walk) & Changes; + +const WALK_BONN_HBF: Walk = { + type: "walk", + timeAvailable: "8min", + distance: "84m", + time: "6min", +}; + +const WALK_BARBAROSSAPLATZ: Walk = { + type: "walk", + timeAvailable: "9min", + distance: "334m", + time: "8min", +}; + +const RE_WESEL_1628: Connection2 = { + type: "transport", + start: "Bonn Hbf", + line: { + type: "RE", + color: "bg-[#7C818B]", + number: "5 (28524)", + }, + headsign: "Wesel", + time: { + arrive: "16:21", + depart: "16:04", + duration: "17min", + delay: { + arrive: "16:45", + depart: "16:28", + }, + }, + changes: [ + { + ...WALK_BARBAROSSAPLATZ, + timeAvailable: "9min", + changes: [ + { + type: "transport", + start: "Barbarossaplatz, Köln", + line: { + type: "STR", + color: "bg-[#9f3d53]", + number: "18", + }, + headsign: "Riehl Slabystr., Köln", + destination: "Neumarkt, Köln", + time: { + arrive: "16:57", + depart: "16:54", + duration: "3min", + delay: { + arrive: "16:57", + depart: "16:54", + }, + }, + }, + ], + }, + ], +}; + +const STR_NIEHL_1622: Connection2 = { + type: "transport", + start: "Hauptbahnhof, Bonn", + // line: "STR 16", + line: { + type: "STR", + color: "bg-[#9f3d53]", + number: "16", + }, + headsign: "Niehl Sebastianstr., Köln", + destination: "Neumarkt, Köln", + time: { + arrive: "17:15", + depart: "16:22", + duration: "53min", + delay: { + arrive: "16:22", + depart: "17:15", + }, + }, +}; + +const RB_MESSE_1633: Connection2 = { + type: "transport", + start: "Bonn Hbf", + line: { + type: "RB", + color: "bg-[#7C818B]", + number: "26 (25430)", + }, + headsign: "Köln Messe/Deutz", + destination: "Köln Süd", + time: { + arrive: "16:53", + depart: "16:33", + duration: "20min", + delay: { + arrive: "16:54", + depart: "16:34", + }, + }, + changes: [ + { + ...WALK_BARBAROSSAPLATZ, + timeAvailable: "8min", + changes: [ + { + type: "transport", + start: "Barbarossaplatz, Köln", + line: { + type: "STR", + color: "bg-[#9f3d53]", + number: "16", + }, + headsign: "Niehl Sebastianstr., Köln", + destination: "Neumarkt, Köln", + time: { + arrive: "17:05", + depart: "17:02", + duration: "3min", + delay: { + arrive: "17:05", + depart: "17:02", + }, + }, + }, + ], + }, + ], +}; + +function withChange(connection: Transport, change: string): Connection2 { + return { + ...connection, + time: { + ...connection.time, + change, + }, + }; +} + const connections2: Connection2[] = [ { + type: "transport", start: "Beuel Konrad-Adenauer-Platz, Bonn", - line: "STR 62", + // line: "STR 62", + line: { + type: "STR", + color: "bg-[#9f3d53]", + number: "62", + }, headsign: "Dottendorf Quirinusplatz, Bonn", time: { arrive: "16:07", depart: "15:58", duration: "9min", }, - destination: "Hauptbahnhof, Bonn", changes: [ { + type: "transport", start: "Hauptbahnhof, Bonn", - line: "STR 16", + // line: "STR 16", + line: { + type: "STR", + color: "bg-[#9f3d53]", + number: "16", + }, headsign: "Niehl Sebastianstr., Köln", destination: "Neumarkt, Köln", time: { @@ -464,32 +675,129 @@ const connections2: Connection2[] = [ arrive: "17:05", depart: "16:12", duration: "53min", + delay: { + arrive: "16:12", + depart: "17:05", + }, }, }, + withChange(STR_NIEHL_1622, "15min"), + withChange(RE_WESEL_1628, "21min"), ], }, { + type: "transport", start: "Beuel Konrad-Adenauer-Platz, Bonn", - line: "STR 62", + // line: "STR 62", + line: { + type: "STR", + color: "bg-[#9f3d53]", + number: "62", + }, headsign: "Dottendorf Quirinusplatz, Bonn", time: { arrive: "16:17", depart: "16:08", duration: "9min", + delay: { + arrive: "16:08", + depart: "16:17", + }, + }, + changes: [ + withChange(STR_NIEHL_1622, "5min"), + withChange(RE_WESEL_1628, "9min"), + ], + }, + { + type: "transport", + start: "Beuel Konrad-Adenauer-Platz, Bonn", + line: { + type: "Bus", + color: "bg-[#76408C]", + number: "117", + }, + headsign: "Hauptbahnhof, Bonn", + time: { + arrive: "16:15", + depart: "16:05", + duration: "10min", + }, + changes: [ + withChange(STR_NIEHL_1622, "4min"), + withChange(RE_WESEL_1628, "13min"), + ], + }, + + // Bus -> Walk -> RE + { + type: "transport", + start: "Beuel Konrad-Adenauer-Platz, Bonn", + line: { + type: "Bus", + color: "bg-[#76408C]", + number: "603", + }, + headsign: "Hauptbahnhof, Bonn", + time: { + arrive: "16:20", + depart: "16:09", + duration: "10min", + }, + changes: [ + { + ...WALK_BONN_HBF, + timeAvailable: "8min", + changes: [RE_WESEL_1628], + }, + ], + }, + { + type: "transport", + start: "Beuel Konrad-Adenauer-Platz, Bonn", + line: { + type: "STR", + color: "bg-[#9f3d53]", + number: "62", + }, + headsign: "Dottendorf Quirinusplatz, Bonn", + time: { + arrive: "16:27", + depart: "16:18", + duration: "9min", }, - destination: "Hauptbahnhof, Bonn", changes: [ { - start: "Hauptbahnhof, Bonn", - line: "STR 16", - headsign: "Niehl Sebastianstr., Köln", - destination: "Neumarkt, Köln", - time: { - change: "5min", - arrive: "17:15", - depart: "16:22", - duration: "53min", - }, + ...WALK_BONN_HBF, + timeAvailable: "7min", + changes: [RB_MESSE_1633], + }, + ], + }, + // 640 -> RB 26 + { + type: "transport", + start: "Beuel Konrad-Adenauer-Platz, Bonn", + line: { + type: "Bus", + color: "bg-[#76408C]", + number: "640", + }, + headsign: "Hauptbahnhof, Bonn", + time: { + arrive: "16:23", + depart: "16:13", + duration: "10min", + delay: { + arrive: "16:28", + depart: "16:18", + }, + }, + changes: [ + { + ...WALK_BONN_HBF, + timeAvailable: "6min", + changes: [RB_MESSE_1633], }, ], }, -- 2.51.2 From 499e850ef3109595e8ebe905e75c55c28f7977df Mon Sep 17 00:00:00 2001 From: Claas Date: Fri, 21 Jun 2024 21:01:49 +0200 Subject: [PATCH 06/11] Remove old stuff --- src/routes/journey.tsx | 237 ----------------------------------------- 1 file changed, 237 deletions(-) diff --git a/src/routes/journey.tsx b/src/routes/journey.tsx index 0271aa9..c29b154 100644 --- a/src/routes/journey.tsx +++ b/src/routes/journey.tsx @@ -1,32 +1,5 @@ import { For, Match, Show, Switch, createSignal, type JSX } from "solid-js"; -/** - * A recursive component building the tree of connections - * @param {Connection} connection - * @returns {JSX.Element} - */ -function Connection({ - label, - destination, - line, - connections, -}: Connection): JSX.Element { - return ( -
-
-

{label}

-

{destination}

-
-
- {Connection} -
-
- ); -} - function TransportConnection({ connection, }: { @@ -239,80 +212,6 @@ function Connection2(properties: Connection2Properties): JSX.Element { ); } -function Journey2() { - return ( - <> -
-
-

- Neumarkt, Köln -

-
- -
-
- -
- -

- Hauptbahnhof, Bonn -

-
- - -
-
- -
- -

- Hauptbahnhof, Bonn -

-
- - -
-
- -
-

- Beuel Konrad-Adenauer-Platz, Bonn -

-
-
- - ); -} - export default function Journeys() { return ( <> @@ -321,142 +220,6 @@ export default function Journeys() { ); } -type Line = { - label: string; - headsign: string; -}; -type Connection = { - label: string; - destination: string; - line: Line; - connections: Connection[]; -}; - -const connections: Connection[] = [ - { - label: "Line/Train/Bus 1", - destination: "Destination 1", - line: { - label: "Line 1", - headsign: "Headsign 1", - }, - connections: [ - { - label: "Line/Train/Bus 1.1", - destination: "Destination 1", - line: { - label: "Line 1", - headsign: "Headsign 1", - }, - connections: [ - { - label: "Line/Train/Bus 1.1.1", - destination: "Destination 1.1", - line: { - label: "Line 1.1", - headsign: "Headsign 1.1", - }, - connections: [], - }, - { - label: "Line/Train/Bus 1.1.2", - destination: "Destination 1.1.2", - line: { - label: "Line 1.1.2", - headsign: "Headsign 1.1.2", - }, - connections: [ - { - label: "Line/Train/Bus 1.1.2.1", - destination: "Destination 1.1.2", - line: { - label: "Line 1.1.2", - headsign: "Headsign 1.1.2", - }, - connections: [], - }, - { - label: "Line/Train/Bus 1.1.2.2", - destination: "Destination 1.1.2.2", - line: { - label: "Line 1.1.2.2", - headsign: "Headsign 1.1.2.2", - }, - connections: [], - }, - ], - }, - ], - }, - { - label: "Line/Train/Bus 1.2", - destination: "Destination 1.2", - line: { - label: "Line 1.2", - headsign: "Headsign 1.2", - }, - connections: [], - }, - ], - }, - { - label: "Line/Train/Bus 2", - destination: "Destination 2", - line: { - label: "Line 2", - headsign: "Headsign 2", - }, - connections: [ - { - label: "Line/Train/Bus 2.1", - destination: "Destination 2.1", - line: { - label: "Line 2.1", - headsign: "Headsign 2.1", - }, - connections: [], - }, - { - label: "Line/Train/Bus 2.2", - destination: "Destination 2.2", - line: { - label: "Line 2.2", - headsign: "Headsign 2.2", - }, - connections: [], - }, - ], - }, - { - label: "Line/Train/Bus 3", - destination: "Destination 3", - line: { - label: "Line 3", - headsign: "Headsign 3", - }, - connections: [ - { - label: "Line/Train/Bus 3.1", - destination: "Destination 3.1", - line: { - label: "Line 3.1", - headsign: "Headsign 3.1", - }, - connections: [], - }, - { - label: "Line/Train/Bus 3.2", - destination: "Destination 3.2", - line: { - label: "Line 3.2", - headsign: "Headsign 3.2", - }, - connections: [], - }, - ], - }, -]; - type Line2 = { type: "STR" | "Bus" | "RE" | "RB"; color: string; -- 2.51.2 From 97932dfcb5c0304c3501b465c8f2b320976eec6b Mon Sep 17 00:00:00 2001 From: Claas Date: Fri, 21 Jun 2024 21:09:38 +0200 Subject: [PATCH 07/11] Align station names with grid --- src/routes/journey.tsx | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/routes/journey.tsx b/src/routes/journey.tsx index c29b154..5a274d2 100644 --- a/src/routes/journey.tsx +++ b/src/routes/journey.tsx @@ -7,16 +7,22 @@ function TransportConnection({ }): JSX.Element { return ( <> -

+

+ {/* Setting w-[3rem] and pl-8 to align with grid. TODO find better solution */} - + {connection.start}

@@ -119,9 +125,10 @@ function Connection3(connection: Connection2): JSX.Element { "destination" in connection && connection.destination !== undefined } > + {/* TODO find better solution than pl-[5rem] to align with grid */}

Neumarkt, Köln

-- 2.51.2 From 7bf7855c3d0860907940be71b31af49f58fcd390 Mon Sep 17 00:00:00 2001 From: Claas Date: Fri, 21 Jun 2024 21:23:36 +0200 Subject: [PATCH 08/11] Add platform information --- src/routes/journey.tsx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/routes/journey.tsx b/src/routes/journey.tsx index 5a274d2..a6b51cb 100644 --- a/src/routes/journey.tsx +++ b/src/routes/journey.tsx @@ -7,24 +7,28 @@ function TransportConnection({ }): JSX.Element { return ( <> -

+

{/* Setting w-[3rem] and pl-8 to align with grid. TODO find better solution */} {connection.start} + + + Pl. {connection.platform} +

-
Walk
+
TODO Walk
@@ -301,6 +305,7 @@ const RE_WESEL_1628: Connection2 = { depart: "16:28", }, }, + platform: "1", changes: [ { ...WALK_BARBAROSSAPLATZ, -- 2.51.2 From e1d8ca6e0e8ac0355eb516b9e2f08ec48feab63d Mon Sep 17 00:00:00 2001 From: Claas Date: Fri, 21 Jun 2024 21:47:02 +0200 Subject: [PATCH 09/11] Add walk instruction and todos --- README.md | 9 +++++++ src/routes/journey.tsx | 58 ++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 65 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6f6995f..c02b88d 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,12 @@ # Alternative Name Ideas - Destation/Destiation/Destiate/Destia/Destistation (Destination + Station) + +# Todo + +- Add walk connection UI +- Fix bonn to bonn missing walk +- make destination/start for next connecion stick as it doesn't change +- Add delay information +- Add fake details view for stops +- Create logo diff --git a/src/routes/journey.tsx b/src/routes/journey.tsx index a6b51cb..528fdee 100644 --- a/src/routes/journey.tsx +++ b/src/routes/journey.tsx @@ -32,7 +32,7 @@ function TransportConnection({