├── .editorconfig ├── .env.example ├── .eslintrc.json ├── .gitignore ├── .prettierignore ├── LICENSE.txt ├── README.md ├── img ├── filter_station_board.gif ├── journey_details.gif ├── search.gif └── station_board.png ├── next-env.d.ts ├── next.config.js ├── package.json ├── pnpm-lock.yaml ├── postcss.config.js ├── prettier.config.cjs ├── public ├── assets │ ├── railboard_180x180_violet.png │ ├── railboard_192x192_violet.png │ ├── railboard_384x384_violet.png │ ├── railboard_512x512_violet.png │ └── railboard_favicon_gray.png ├── manifest.json ├── sw.js.map └── workbox-7028bf80.js.map ├── renovate.json ├── src ├── app │ ├── HomePage.tsx │ ├── RailboardInfo.tsx │ ├── StationBoardPanel.tsx │ ├── TrainSearchPanel.tsx │ ├── about │ │ └── page.tsx │ ├── globals.css │ ├── journey │ │ └── [journey] │ │ │ ├── JourneyShareButton.tsx │ │ │ ├── MessageDisplay.tsx │ │ │ ├── StopDisplay.tsx │ │ │ ├── StopTimeDisplay.tsx │ │ │ ├── loading.tsx │ │ │ └── page.tsx │ ├── layout.tsx │ ├── page.tsx │ └── station │ │ └── [station] │ │ ├── ReloadButton.tsx │ │ ├── StationBoardTopBar.tsx │ │ ├── StationShareButton.tsx │ │ ├── [datetime] │ │ ├── loading.tsx │ │ └── page.tsx │ │ ├── layout.tsx │ │ └── page.tsx ├── components │ ├── coach_sequence │ │ └── CoachSequence.tsx │ ├── search │ │ ├── StationSearchBar.tsx │ │ └── TrainSearchBar.tsx │ ├── station_board │ │ ├── StationBoardDisplayContainer.tsx │ │ ├── StationBoardDisplayElement.tsx │ │ ├── details │ │ │ ├── DetailsPopup.tsx │ │ │ └── StopDetailsPopup.tsx │ │ ├── elements │ │ │ ├── NameAndPlatformDisplay.tsx │ │ │ ├── NoticesDisplay.tsx │ │ │ ├── PlatformDisplay.tsx │ │ │ ├── StationsDisplay.tsx │ │ │ └── TimeDisplay.tsx │ │ └── filter │ │ │ └── TransportTypeFilter.tsx │ └── ui │ │ ├── PageTitle.tsx │ │ ├── Popup.tsx │ │ ├── TabSelection.tsx │ │ └── button │ │ ├── Button.tsx │ │ ├── GoBackButton.tsx │ │ └── ShareButton.tsx ├── middleware.ts ├── pages │ └── api │ │ └── share.ts ├── requests │ ├── coach_sequence │ │ └── coach_sequence.ts │ ├── custom │ │ └── stationBoard.ts │ ├── get_base_url.ts │ └── ris │ │ ├── journeyDetails.ts │ │ ├── journeySearch.ts │ │ ├── stationInformation.ts │ │ └── stationSearch.ts ├── server │ ├── base-url.ts │ └── redis.ts └── utils │ ├── async_component_fix.ts │ ├── favourites.ts │ ├── share.ts │ └── time.ts ├── tailwind.config.js ├── tsconfig.json └── vercel.json /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig is awesome: https://EditorConfig.org 2 | 3 | # top-most EditorConfig file 4 | root = true 5 | 6 | [*] 7 | indent_style = space 8 | indent_size = 2 9 | end_of_line = lf 10 | charset = utf-8 11 | max_line_length = 120 12 | trim_trailing_whitespace = true 13 | insert_final_newline = true 14 | -------------------------------------------------------------------------------- /.env.example: -------------------------------------------------------------------------------- 1 | # Upstash Credentials 2 | UPSTASH_REDIS_REST_URL= 3 | UPSTASH_REDIS_REST_TOKEN= 4 | -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "parser": "@typescript-eslint/parser", 3 | "parserOptions": { 4 | "project": "./tsconfig.json" 5 | }, 6 | "plugins": ["@typescript-eslint"], 7 | "extends": ["next/core-web-vitals", "plugin:@typescript-eslint/recommended"] 8 | } 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # database 12 | /prisma/db.sqlite 13 | /prisma/db.sqlite-journal 14 | 15 | # next.js 16 | /.next/ 17 | /out/ 18 | 19 | # production 20 | /build 21 | /public/sw.js 22 | /public/workbox-*.js 23 | /public/sw.js.map 24 | 25 | # misc 26 | .DS_Store 27 | *.pem 28 | 29 | # debug 30 | npm-debug.log* 31 | yarn-debug.log* 32 | yarn-error.log* 33 | .pnpm-debug.log* 34 | 35 | # local env files 36 | .env 37 | .env*.local 38 | 39 | # vercel 40 | .vercel 41 | 42 | # typescript 43 | *.tsbuildinfo 44 | 45 | # idea 46 | .idea 47 | *.iml 48 | .vscode 49 | 50 | .vercel 51 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .next 3 | pnpm-lock.yaml 4 | .idea 5 | .vscode 6 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | GNU AFFERO GENERAL PUBLIC LICENSE 2 | Version 3, 19 November 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU Affero General Public License is a free, copyleft license for 11 | software and other kinds of works, specifically designed to ensure 12 | cooperation with the community in the case of network server software. 13 | 14 | The licenses for most software and other practical works are designed 15 | to take away your freedom to share and change the works. By contrast, 16 | our General Public Licenses are intended to guarantee your freedom to 17 | share and change all versions of a program--to make sure it remains free 18 | software for all its users. 19 | 20 | When we speak of free software, we are referring to freedom, not 21 | price. Our General Public Licenses are designed to make sure that you 22 | have the freedom to distribute copies of free software (and charge for 23 | them if you wish), that you receive source code or can get it if you 24 | want it, that you can change the software or use pieces of it in new 25 | free programs, and that you know you can do these things. 26 | 27 | Developers that use our General Public Licenses protect your rights 28 | with two steps: (1) assert copyright on the software, and (2) offer 29 | you this License which gives you legal permission to copy, distribute 30 | and/or modify the software. 31 | 32 | A secondary benefit of defending all users' freedom is that 33 | improvements made in alternate versions of the program, if they 34 | receive widespread use, become available for other developers to 35 | incorporate. Many developers of free software are heartened and 36 | encouraged by the resulting cooperation. However, in the case of 37 | software used on network servers, this result may fail to come about. 38 | The GNU General Public License permits making a modified version and 39 | letting the public access it on a server without ever releasing its 40 | source code to the public. 41 | 42 | The GNU Affero General Public License is designed specifically to 43 | ensure that, in such cases, the modified source code becomes available 44 | to the community. It requires the operator of a network server to 45 | provide the source code of the modified version running there to the 46 | users of that server. Therefore, public use of a modified version, on 47 | a publicly accessible server, gives the public access to the source 48 | code of the modified version. 49 | 50 | An older license, called the Affero General Public License and 51 | published by Affero, was designed to accomplish similar goals. This is 52 | a different license, not a version of the Affero GPL, but Affero has 53 | released a new version of the Affero GPL which permits relicensing under 54 | this license. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | TERMS AND CONDITIONS 60 | 61 | 0. Definitions. 62 | 63 | "This License" refers to version 3 of the GNU Affero General Public License. 64 | 65 | "Copyright" also means copyright-like laws that apply to other kinds of 66 | works, such as semiconductor masks. 67 | 68 | "The Program" refers to any copyrightable work licensed under this 69 | License. Each licensee is addressed as "you". "Licensees" and 70 | "recipients" may be individuals or organizations. 71 | 72 | To "modify" a work means to copy from or adapt all or part of the work 73 | in a fashion requiring copyright permission, other than the making of an 74 | exact copy. The resulting work is called a "modified version" of the 75 | earlier work or a work "based on" the earlier work. 76 | 77 | A "covered work" means either the unmodified Program or a work based 78 | on the Program. 79 | 80 | To "propagate" a work means to do anything with it that, without 81 | permission, would make you directly or secondarily liable for 82 | infringement under applicable copyright law, except executing it on a 83 | computer or modifying a private copy. Propagation includes copying, 84 | distribution (with or without modification), making available to the 85 | public, and in some countries other activities as well. 86 | 87 | To "convey" a work means any kind of propagation that enables other 88 | parties to make or receive copies. Mere interaction with a user through 89 | a computer network, with no transfer of a copy, is not conveying. 90 | 91 | An interactive user interface displays "Appropriate Legal Notices" 92 | to the extent that it includes a convenient and prominently visible 93 | feature that (1) displays an appropriate copyright notice, and (2) 94 | tells the user that there is no warranty for the work (except to the 95 | extent that warranties are provided), that licensees may convey the 96 | work under this License, and how to view a copy of this License. If 97 | the interface presents a list of user commands or options, such as a 98 | menu, a prominent item in the list meets this criterion. 99 | 100 | 1. Source Code. 101 | 102 | The "source code" for a work means the preferred form of the work 103 | for making modifications to it. "Object code" means any non-source 104 | form of a work. 105 | 106 | A "Standard Interface" means an interface that either is an official 107 | standard defined by a recognized standards body, or, in the case of 108 | interfaces specified for a particular programming language, one that 109 | is widely used among developers working in that language. 110 | 111 | The "System Libraries" of an executable work include anything, other 112 | than the work as a whole, that (a) is included in the normal form of 113 | packaging a Major Component, but which is not part of that Major 114 | Component, and (b) serves only to enable use of the work with that 115 | Major Component, or to implement a Standard Interface for which an 116 | implementation is available to the public in source code form. A 117 | "Major Component", in this context, means a major essential component 118 | (kernel, window system, and so on) of the specific operating system 119 | (if any) on which the executable work runs, or a compiler used to 120 | produce the work, or an object code interpreter used to run it. 121 | 122 | The "Corresponding Source" for a work in object code form means all 123 | the source code needed to generate, install, and (for an executable 124 | work) run the object code and to modify the work, including scripts to 125 | control those activities. However, it does not include the work's 126 | System Libraries, or general-purpose tools or generally available free 127 | programs which are used unmodified in performing those activities but 128 | which are not part of the work. For example, Corresponding Source 129 | includes interface definition files associated with source files for 130 | the work, and the source code for shared libraries and dynamically 131 | linked subprograms that the work is specifically designed to require, 132 | such as by intimate data communication or control flow between those 133 | subprograms and other parts of the work. 134 | 135 | The Corresponding Source need not include anything that users 136 | can regenerate automatically from other parts of the Corresponding 137 | Source. 138 | 139 | The Corresponding Source for a work in source code form is that 140 | same work. 141 | 142 | 2. Basic Permissions. 143 | 144 | All rights granted under this License are granted for the term of 145 | copyright on the Program, and are irrevocable provided the stated 146 | conditions are met. This License explicitly affirms your unlimited 147 | permission to run the unmodified Program. The output from running a 148 | covered work is covered by this License only if the output, given its 149 | content, constitutes a covered work. This License acknowledges your 150 | rights of fair use or other equivalent, as provided by copyright law. 151 | 152 | You may make, run and propagate covered works that you do not 153 | convey, without conditions so long as your license otherwise remains 154 | in force. You may convey covered works to others for the sole purpose 155 | of having them make modifications exclusively for you, or provide you 156 | with facilities for running those works, provided that you comply with 157 | the terms of this License in conveying all material for which you do 158 | not control copyright. Those thus making or running the covered works 159 | for you must do so exclusively on your behalf, under your direction 160 | and control, on terms that prohibit them from making any copies of 161 | your copyrighted material outside their relationship with you. 162 | 163 | Conveying under any other circumstances is permitted solely under 164 | the conditions stated below. Sublicensing is not allowed; section 10 165 | makes it unnecessary. 166 | 167 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 168 | 169 | No covered work shall be deemed part of an effective technological 170 | measure under any applicable law fulfilling obligations under article 171 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 172 | similar laws prohibiting or restricting circumvention of such 173 | measures. 174 | 175 | When you convey a covered work, you waive any legal power to forbid 176 | circumvention of technological measures to the extent such circumvention 177 | is effected by exercising rights under this License with respect to 178 | the covered work, and you disclaim any intention to limit operation or 179 | modification of the work as a means of enforcing, against the work's 180 | users, your or third parties' legal rights to forbid circumvention of 181 | technological measures. 182 | 183 | 4. Conveying Verbatim Copies. 184 | 185 | You may convey verbatim copies of the Program's source code as you 186 | receive it, in any medium, provided that you conspicuously and 187 | appropriately publish on each copy an appropriate copyright notice; 188 | keep intact all notices stating that this License and any 189 | non-permissive terms added in accord with section 7 apply to the code; 190 | keep intact all notices of the absence of any warranty; and give all 191 | recipients a copy of this License along with the Program. 192 | 193 | You may charge any price or no price for each copy that you convey, 194 | and you may offer support or warranty protection for a fee. 195 | 196 | 5. Conveying Modified Source Versions. 197 | 198 | You may convey a work based on the Program, or the modifications to 199 | produce it from the Program, in the form of source code under the 200 | terms of section 4, provided that you also meet all of these conditions: 201 | 202 | a) The work must carry prominent notices stating that you modified 203 | it, and giving a relevant date. 204 | 205 | b) The work must carry prominent notices stating that it is 206 | released under this License and any conditions added under section 207 | 7. This requirement modifies the requirement in section 4 to 208 | "keep intact all notices". 209 | 210 | c) You must license the entire work, as a whole, under this 211 | License to anyone who comes into possession of a copy. This 212 | License will therefore apply, along with any applicable section 7 213 | additional terms, to the whole of the work, and all its parts, 214 | regardless of how they are packaged. This License gives no 215 | permission to license the work in any other way, but it does not 216 | invalidate such permission if you have separately received it. 217 | 218 | d) If the work has interactive user interfaces, each must display 219 | Appropriate Legal Notices; however, if the Program has interactive 220 | interfaces that do not display Appropriate Legal Notices, your 221 | work need not make them do so. 222 | 223 | A compilation of a covered work with other separate and independent 224 | works, which are not by their nature extensions of the covered work, 225 | and which are not combined with it such as to form a larger program, 226 | in or on a volume of a storage or distribution medium, is called an 227 | "aggregate" if the compilation and its resulting copyright are not 228 | used to limit the access or legal rights of the compilation's users 229 | beyond what the individual works permit. Inclusion of a covered work 230 | in an aggregate does not cause this License to apply to the other 231 | parts of the aggregate. 232 | 233 | 6. Conveying Non-Source Forms. 234 | 235 | You may convey a covered work in object code form under the terms 236 | of sections 4 and 5, provided that you also convey the 237 | machine-readable Corresponding Source under the terms of this License, 238 | in one of these ways: 239 | 240 | a) Convey the object code in, or embodied in, a physical product 241 | (including a physical distribution medium), accompanied by the 242 | Corresponding Source fixed on a durable physical medium 243 | customarily used for software interchange. 244 | 245 | b) Convey the object code in, or embodied in, a physical product 246 | (including a physical distribution medium), accompanied by a 247 | written offer, valid for at least three years and valid for as 248 | long as you offer spare parts or customer support for that product 249 | model, to give anyone who possesses the object code either (1) a 250 | copy of the Corresponding Source for all the software in the 251 | product that is covered by this License, on a durable physical 252 | medium customarily used for software interchange, for a price no 253 | more than your reasonable cost of physically performing this 254 | conveying of source, or (2) access to copy the 255 | Corresponding Source from a network server at no charge. 256 | 257 | c) Convey individual copies of the object code with a copy of the 258 | written offer to provide the Corresponding Source. This 259 | alternative is allowed only occasionally and noncommercially, and 260 | only if you received the object code with such an offer, in accord 261 | with subsection 6b. 262 | 263 | d) Convey the object code by offering access from a designated 264 | place (gratis or for a charge), and offer equivalent access to the 265 | Corresponding Source in the same way through the same place at no 266 | further charge. You need not require recipients to copy the 267 | Corresponding Source along with the object code. If the place to 268 | copy the object code is a network server, the Corresponding Source 269 | may be on a different server (operated by you or a third party) 270 | that supports equivalent copying facilities, provided you maintain 271 | clear directions next to the object code saying where to find the 272 | Corresponding Source. Regardless of what server hosts the 273 | Corresponding Source, you remain obligated to ensure that it is 274 | available for as long as needed to satisfy these requirements. 275 | 276 | e) Convey the object code using peer-to-peer transmission, provided 277 | you inform other peers where the object code and Corresponding 278 | Source of the work are being offered to the general public at no 279 | charge under subsection 6d. 280 | 281 | A separable portion of the object code, whose source code is excluded 282 | from the Corresponding Source as a System Library, need not be 283 | included in conveying the object code work. 284 | 285 | A "User Product" is either (1) a "consumer product", which means any 286 | tangible personal property which is normally used for personal, family, 287 | or household purposes, or (2) anything designed or sold for incorporation 288 | into a dwelling. In determining whether a product is a consumer product, 289 | doubtful cases shall be resolved in favor of coverage. For a particular 290 | product received by a particular user, "normally used" refers to a 291 | typical or common use of that class of product, regardless of the status 292 | of the particular user or of the way in which the particular user 293 | actually uses, or expects or is expected to use, the product. A product 294 | is a consumer product regardless of whether the product has substantial 295 | commercial, industrial or non-consumer uses, unless such uses represent 296 | the only significant mode of use of the product. 297 | 298 | "Installation Information" for a User Product means any methods, 299 | procedures, authorization keys, or other information required to install 300 | and execute modified versions of a covered work in that User Product from 301 | a modified version of its Corresponding Source. The information must 302 | suffice to ensure that the continued functioning of the modified object 303 | code is in no case prevented or interfered with solely because 304 | modification has been made. 305 | 306 | If you convey an object code work under this section in, or with, or 307 | specifically for use in, a User Product, and the conveying occurs as 308 | part of a transaction in which the right of possession and use of the 309 | User Product is transferred to the recipient in perpetuity or for a 310 | fixed term (regardless of how the transaction is characterized), the 311 | Corresponding Source conveyed under this section must be accompanied 312 | by the Installation Information. But this requirement does not apply 313 | if neither you nor any third party retains the ability to install 314 | modified object code on the User Product (for example, the work has 315 | been installed in ROM). 316 | 317 | The requirement to provide Installation Information does not include a 318 | requirement to continue to provide support service, warranty, or updates 319 | for a work that has been modified or installed by the recipient, or for 320 | the User Product in which it has been modified or installed. Access to a 321 | network may be denied when the modification itself materially and 322 | adversely affects the operation of the network or violates the rules and 323 | protocols for communication across the network. 324 | 325 | Corresponding Source conveyed, and Installation Information provided, 326 | in accord with this section must be in a format that is publicly 327 | documented (and with an implementation available to the public in 328 | source code form), and must require no special password or key for 329 | unpacking, reading or copying. 330 | 331 | 7. Additional Terms. 332 | 333 | "Additional permissions" are terms that supplement the terms of this 334 | License by making exceptions from one or more of its conditions. 335 | Additional permissions that are applicable to the entire Program shall 336 | be treated as though they were included in this License, to the extent 337 | that they are valid under applicable law. If additional permissions 338 | apply only to part of the Program, that part may be used separately 339 | under those permissions, but the entire Program remains governed by 340 | this License without regard to the additional permissions. 341 | 342 | When you convey a copy of a covered work, you may at your option 343 | remove any additional permissions from that copy, or from any part of 344 | it. (Additional permissions may be written to require their own 345 | removal in certain cases when you modify the work.) You may place 346 | additional permissions on material, added by you to a covered work, 347 | for which you have or can give appropriate copyright permission. 348 | 349 | Notwithstanding any other provision of this License, for material you 350 | add to a covered work, you may (if authorized by the copyright holders of 351 | that material) supplement the terms of this License with terms: 352 | 353 | a) Disclaiming warranty or limiting liability differently from the 354 | terms of sections 15 and 16 of this License; or 355 | 356 | b) Requiring preservation of specified reasonable legal notices or 357 | author attributions in that material or in the Appropriate Legal 358 | Notices displayed by works containing it; or 359 | 360 | c) Prohibiting misrepresentation of the origin of that material, or 361 | requiring that modified versions of such material be marked in 362 | reasonable ways as different from the original version; or 363 | 364 | d) Limiting the use for publicity purposes of names of licensors or 365 | authors of the material; or 366 | 367 | e) Declining to grant rights under trademark law for use of some 368 | trade names, trademarks, or service marks; or 369 | 370 | f) Requiring indemnification of licensors and authors of that 371 | material by anyone who conveys the material (or modified versions of 372 | it) with contractual assumptions of liability to the recipient, for 373 | any liability that these contractual assumptions directly impose on 374 | those licensors and authors. 375 | 376 | All other non-permissive additional terms are considered "further 377 | restrictions" within the meaning of section 10. If the Program as you 378 | received it, or any part of it, contains a notice stating that it is 379 | governed by this License along with a term that is a further 380 | restriction, you may remove that term. If a license document contains 381 | a further restriction but permits relicensing or conveying under this 382 | License, you may add to a covered work material governed by the terms 383 | of that license document, provided that the further restriction does 384 | not survive such relicensing or conveying. 385 | 386 | If you add terms to a covered work in accord with this section, you 387 | must place, in the relevant source files, a statement of the 388 | additional terms that apply to those files, or a notice indicating 389 | where to find the applicable terms. 390 | 391 | Additional terms, permissive or non-permissive, may be stated in the 392 | form of a separately written license, or stated as exceptions; 393 | the above requirements apply either way. 394 | 395 | 8. Termination. 396 | 397 | You may not propagate or modify a covered work except as expressly 398 | provided under this License. Any attempt otherwise to propagate or 399 | modify it is void, and will automatically terminate your rights under 400 | this License (including any patent licenses granted under the third 401 | paragraph of section 11). 402 | 403 | However, if you cease all violation of this License, then your 404 | license from a particular copyright holder is reinstated (a) 405 | provisionally, unless and until the copyright holder explicitly and 406 | finally terminates your license, and (b) permanently, if the copyright 407 | holder fails to notify you of the violation by some reasonable means 408 | prior to 60 days after the cessation. 409 | 410 | Moreover, your license from a particular copyright holder is 411 | reinstated permanently if the copyright holder notifies you of the 412 | violation by some reasonable means, this is the first time you have 413 | received notice of violation of this License (for any work) from that 414 | copyright holder, and you cure the violation prior to 30 days after 415 | your receipt of the notice. 416 | 417 | Termination of your rights under this section does not terminate the 418 | licenses of parties who have received copies or rights from you under 419 | this License. If your rights have been terminated and not permanently 420 | reinstated, you do not qualify to receive new licenses for the same 421 | material under section 10. 422 | 423 | 9. Acceptance Not Required for Having Copies. 424 | 425 | You are not required to accept this License in order to receive or 426 | run a copy of the Program. Ancillary propagation of a covered work 427 | occurring solely as a consequence of using peer-to-peer transmission 428 | to receive a copy likewise does not require acceptance. However, 429 | nothing other than this License grants you permission to propagate or 430 | modify any covered work. These actions infringe copyright if you do 431 | not accept this License. Therefore, by modifying or propagating a 432 | covered work, you indicate your acceptance of this License to do so. 433 | 434 | 10. Automatic Licensing of Downstream Recipients. 435 | 436 | Each time you convey a covered work, the recipient automatically 437 | receives a license from the original licensors, to run, modify and 438 | propagate that work, subject to this License. You are not responsible 439 | for enforcing compliance by third parties with this License. 440 | 441 | An "entity transaction" is a transaction transferring control of an 442 | organization, or substantially all assets of one, or subdividing an 443 | organization, or merging organizations. If propagation of a covered 444 | work results from an entity transaction, each party to that 445 | transaction who receives a copy of the work also receives whatever 446 | licenses to the work the party's predecessor in interest had or could 447 | give under the previous paragraph, plus a right to possession of the 448 | Corresponding Source of the work from the predecessor in interest, if 449 | the predecessor has it or can get it with reasonable efforts. 450 | 451 | You may not impose any further restrictions on the exercise of the 452 | rights granted or affirmed under this License. For example, you may 453 | not impose a license fee, royalty, or other charge for exercise of 454 | rights granted under this License, and you may not initiate litigation 455 | (including a cross-claim or counterclaim in a lawsuit) alleging that 456 | any patent claim is infringed by making, using, selling, offering for 457 | sale, or importing the Program or any portion of it. 458 | 459 | 11. Patents. 460 | 461 | A "contributor" is a copyright holder who authorizes use under this 462 | License of the Program or a work on which the Program is based. The 463 | work thus licensed is called the contributor's "contributor version". 464 | 465 | A contributor's "essential patent claims" are all patent claims 466 | owned or controlled by the contributor, whether already acquired or 467 | hereafter acquired, that would be infringed by some manner, permitted 468 | by this License, of making, using, or selling its contributor version, 469 | but do not include claims that would be infringed only as a 470 | consequence of further modification of the contributor version. For 471 | purposes of this definition, "control" includes the right to grant 472 | patent sublicenses in a manner consistent with the requirements of 473 | this License. 474 | 475 | Each contributor grants you a non-exclusive, worldwide, royalty-free 476 | patent license under the contributor's essential patent claims, to 477 | make, use, sell, offer for sale, import and otherwise run, modify and 478 | propagate the contents of its contributor version. 479 | 480 | In the following three paragraphs, a "patent license" is any express 481 | agreement or commitment, however denominated, not to enforce a patent 482 | (such as an express permission to practice a patent or covenant not to 483 | sue for patent infringement). To "grant" such a patent license to a 484 | party means to make such an agreement or commitment not to enforce a 485 | patent against the party. 486 | 487 | If you convey a covered work, knowingly relying on a patent license, 488 | and the Corresponding Source of the work is not available for anyone 489 | to copy, free of charge and under the terms of this License, through a 490 | publicly available network server or other readily accessible means, 491 | then you must either (1) cause the Corresponding Source to be so 492 | available, or (2) arrange to deprive yourself of the benefit of the 493 | patent license for this particular work, or (3) arrange, in a manner 494 | consistent with the requirements of this License, to extend the patent 495 | license to downstream recipients. "Knowingly relying" means you have 496 | actual knowledge that, but for the patent license, your conveying the 497 | covered work in a country, or your recipient's use of the covered work 498 | in a country, would infringe one or more identifiable patents in that 499 | country that you have reason to believe are valid. 500 | 501 | If, pursuant to or in connection with a single transaction or 502 | arrangement, you convey, or propagate by procuring conveyance of, a 503 | covered work, and grant a patent license to some of the parties 504 | receiving the covered work authorizing them to use, propagate, modify 505 | or convey a specific copy of the covered work, then the patent license 506 | you grant is automatically extended to all recipients of the covered 507 | work and works based on it. 508 | 509 | A patent license is "discriminatory" if it does not include within 510 | the scope of its coverage, prohibits the exercise of, or is 511 | conditioned on the non-exercise of one or more of the rights that are 512 | specifically granted under this License. You may not convey a covered 513 | work if you are a party to an arrangement with a third party that is 514 | in the business of distributing software, under which you make payment 515 | to the third party based on the extent of your activity of conveying 516 | the work, and under which the third party grants, to any of the 517 | parties who would receive the covered work from you, a discriminatory 518 | patent license (a) in connection with copies of the covered work 519 | conveyed by you (or copies made from those copies), or (b) primarily 520 | for and in connection with specific products or compilations that 521 | contain the covered work, unless you entered into that arrangement, 522 | or that patent license was granted, prior to 28 March 2007. 523 | 524 | Nothing in this License shall be construed as excluding or limiting 525 | any implied license or other defenses to infringement that may 526 | otherwise be available to you under applicable patent law. 527 | 528 | 12. No Surrender of Others' Freedom. 529 | 530 | If conditions are imposed on you (whether by court order, agreement or 531 | otherwise) that contradict the conditions of this License, they do not 532 | excuse you from the conditions of this License. If you cannot convey a 533 | covered work so as to satisfy simultaneously your obligations under this 534 | License and any other pertinent obligations, then as a consequence you may 535 | not convey it at all. For example, if you agree to terms that obligate you 536 | to collect a royalty for further conveying from those to whom you convey 537 | the Program, the only way you could satisfy both those terms and this 538 | License would be to refrain entirely from conveying the Program. 539 | 540 | 13. Remote Network Interaction; Use with the GNU General Public License. 541 | 542 | Notwithstanding any other provision of this License, if you modify the 543 | Program, your modified version must prominently offer all users 544 | interacting with it remotely through a computer network (if your version 545 | supports such interaction) an opportunity to receive the Corresponding 546 | Source of your version by providing access to the Corresponding Source 547 | from a network server at no charge, through some standard or customary 548 | means of facilitating copying of software. This Corresponding Source 549 | shall include the Corresponding Source for any work covered by version 3 550 | of the GNU General Public License that is incorporated pursuant to the 551 | following paragraph. 552 | 553 | Notwithstanding any other provision of this License, you have 554 | permission to link or combine any covered work with a work licensed 555 | under version 3 of the GNU General Public License into a single 556 | combined work, and to convey the resulting work. The terms of this 557 | License will continue to apply to the part which is the covered work, 558 | but the work with which it is combined will remain governed by version 559 | 3 of the GNU General Public License. 560 | 561 | 14. Revised Versions of this License. 562 | 563 | The Free Software Foundation may publish revised and/or new versions of 564 | the GNU Affero General Public License from time to time. Such new versions 565 | will be similar in spirit to the present version, but may differ in detail to 566 | address new problems or concerns. 567 | 568 | Each version is given a distinguishing version number. If the 569 | Program specifies that a certain numbered version of the GNU Affero General 570 | Public License "or any later version" applies to it, you have the 571 | option of following the terms and conditions either of that numbered 572 | version or of any later version published by the Free Software 573 | Foundation. If the Program does not specify a version number of the 574 | GNU Affero General Public License, you may choose any version ever published 575 | by the Free Software Foundation. 576 | 577 | If the Program specifies that a proxy can decide which future 578 | versions of the GNU Affero General Public License can be used, that proxy's 579 | public statement of acceptance of a version permanently authorizes you 580 | to choose that version for the Program. 581 | 582 | Later license versions may give you additional or different 583 | permissions. However, no additional obligations are imposed on any 584 | author or copyright holder as a result of your choosing to follow a 585 | later version. 586 | 587 | 15. Disclaimer of Warranty. 588 | 589 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 590 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 591 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 592 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 593 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 594 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 595 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 596 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 597 | 598 | 16. Limitation of Liability. 599 | 600 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 601 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 602 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 603 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 604 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 605 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 606 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 607 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 608 | SUCH DAMAGES. 609 | 610 | 17. Interpretation of Sections 15 and 16. 611 | 612 | If the disclaimer of warranty and limitation of liability provided 613 | above cannot be given local legal effect according to their terms, 614 | reviewing courts shall apply local law that most closely approximates 615 | an absolute waiver of all civil liability in connection with the 616 | Program, unless a warranty or assumption of liability accompanies a 617 | copy of the Program in return for a fee. 618 | 619 | END OF TERMS AND CONDITIONS 620 | 621 | How to Apply These Terms to Your New Programs 622 | 623 | If you develop a new program, and you want it to be of the greatest 624 | possible use to the public, the best way to achieve this is to make it 625 | free software which everyone can redistribute and change under these terms. 626 | 627 | To do so, attach the following notices to the program. It is safest 628 | to attach them to the start of each source file to most effectively 629 | state the exclusion of warranty; and each file should have at least 630 | the "copyright" line and a pointer to where the full notice is found. 631 | 632 | 633 | Copyright (C) 634 | 635 | This program is free software: you can redistribute it and/or modify 636 | it under the terms of the GNU Affero General Public License as published 637 | by the Free Software Foundation, either version 3 of the License, or 638 | (at your option) any later version. 639 | 640 | This program is distributed in the hope that it will be useful, 641 | but WITHOUT ANY WARRANTY; without even the implied warranty of 642 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 643 | GNU Affero General Public License for more details. 644 | 645 | You should have received a copy of the GNU Affero General Public License 646 | along with this program. If not, see . 647 | 648 | Also add information on how to contact you by electronic and paper mail. 649 | 650 | If your software can interact with users remotely through a computer 651 | network, you should also make sure that it provides a way for users to 652 | get its source. For example, if your program is a web application, its 653 | interface could display a "Source" link that leads users to an archive 654 | of the code. There are many ways you could offer source, and different 655 | solutions will be better for different programs; see section 13 for the 656 | specific requirements. 657 | 658 | You should also get your employer (if you work as a programmer) or school, 659 | if any, to sign a "copyright disclaimer" for the program, if necessary. 660 | For more information on this, and how to apply and follow the GNU AGPL, see 661 | . 662 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Railboard 2 | 3 | Railboard is a web-app to easily view information like delay, platform(-changes) and more 4 | base upon the German Train Service's ([Deutsche Bahn](https://www.deutschebahn.com/)) API. 5 | 6 | The Website is only available in German since the API basically only has German Train data, 7 | I might add localization when Next.js 13 has a good way of doing that. 8 | 9 | ## Features / Demos 10 | 11 | - Search with Favorites \ 12 | ![demo video](img/search.gif) 13 | - View Station Boards with Arrival & Darture Date + their delay and show platform(-change) \ 14 | ![demo photo](img/station_board.png) 15 | - Filter which Trains you want to see on the Station Board \ 16 | ![demo video](img/filter_station_board.gif) 17 | - View Journey Details of Train with important Messages \ 18 | ![demo video](img/journey_details.gif) 19 | -------------------------------------------------------------------------------- /img/filter_station_board.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emmaboecker/railboard/eb8c4001e00c844bde76bf117dfb67d9283bfe3c/img/filter_station_board.gif -------------------------------------------------------------------------------- /img/journey_details.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emmaboecker/railboard/eb8c4001e00c844bde76bf117dfb67d9283bfe3c/img/journey_details.gif -------------------------------------------------------------------------------- /img/search.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emmaboecker/railboard/eb8c4001e00c844bde76bf117dfb67d9283bfe3c/img/search.gif -------------------------------------------------------------------------------- /img/station_board.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emmaboecker/railboard/eb8c4001e00c844bde76bf117dfb67d9283bfe3c/img/station_board.png -------------------------------------------------------------------------------- /next-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | /// 4 | 5 | // NOTE: This file should not be edited 6 | // see https://nextjs.org/docs/basic-features/typescript for more information. 7 | -------------------------------------------------------------------------------- /next.config.js: -------------------------------------------------------------------------------- 1 | const withPWA = require("next-pwa")({ 2 | dest: "public", 3 | disable: process.env.NODE_ENV === "development", 4 | }); 5 | 6 | module.exports = withPWA({ 7 | reactStrictMode: true, 8 | swcMinify: true, 9 | productionBrowserSourceMaps: true, 10 | experimental: { 11 | appDir: true, 12 | }, 13 | }); 14 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "railboard", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "build": "next build", 7 | "dev": "next dev", 8 | "lint": "next lint", 9 | "start": "next start" 10 | }, 11 | "dependencies": { 12 | "@fontsource/source-sans-pro": "^5.0.0", 13 | "@fontsource/ubuntu": "^5.0.0", 14 | "@headlessui/react": "^1.7.3", 15 | "@mantine/hooks": "^6.0.0", 16 | "@upstash/redis": "^1.16.1", 17 | "clsx": "^2.0.0", 18 | "dayjs": "^1.11.5", 19 | "nanoid": "^4.0.0", 20 | "nanoid-dictionary": "^4.3.0", 21 | "next": "13.4.12", 22 | "next-pwa": "^5.6.0", 23 | "react": "18.2.0", 24 | "react-dom": "18.2.0", 25 | "react-icons": "^4.6.0", 26 | "react-loader-spinner": "^5.3.4", 27 | "react-virtualized-auto-sizer": "^1.0.7", 28 | "react-window": "^1.8.7", 29 | "swr": "^2.0.0", 30 | "tabler-icons-react": "^1.55.0", 31 | "use-detect-keyboard-open": "^0.4.0", 32 | "zod": "^3.19.1" 33 | }, 34 | "devDependencies": { 35 | "@tanstack/query-core": "^4.12.0", 36 | "@types/nanoid-dictionary": "^4.2.0", 37 | "@types/node": "18.17.1", 38 | "@types/react": "18.2.18", 39 | "@types/react-dom": "18.2.7", 40 | "@types/react-virtualized-auto-sizer": "^1.0.1", 41 | "@types/react-window": "^1.8.5", 42 | "@types/hafas-client": "^6.0.0", 43 | "@typescript-eslint/eslint-plugin": "^6.0.0", 44 | "@typescript-eslint/parser": "^6.0.0", 45 | "autoprefixer": "^10.4.7", 46 | "eslint": "8.46.0", 47 | "eslint-config-next": "13.4.12", 48 | "postcss": "^8.4.14", 49 | "prettier": "^3.0.0", 50 | "prettier-plugin-tailwindcss": "^0.4.0", 51 | "tailwindcss": "^3.1.6", 52 | "@tailwindcss/typography": "^0.5.9", 53 | "typescript": "^5.0.0" 54 | }, 55 | "ct3aMetadata": { 56 | "initVersion": "6.3.0" 57 | }, 58 | "packageManager": "pnpm@9.7.1+sha512.faf344af2d6ca65c4c5c8c2224ea77a81a5e8859cbc4e06b1511ddce2f0151512431dd19e6aff31f2c6a8f5f2aced9bd2273e1fed7dd4de1868984059d2c4247" 59 | } 60 | -------------------------------------------------------------------------------- /postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: { 3 | tailwindcss: {}, 4 | autoprefixer: {}, 5 | }, 6 | } 7 | -------------------------------------------------------------------------------- /prettier.config.cjs: -------------------------------------------------------------------------------- 1 | /** @type {import("prettier").Config} */ 2 | module.exports = { 3 | plugins: [require.resolve("prettier-plugin-tailwindcss")], 4 | }; 5 | -------------------------------------------------------------------------------- /public/assets/railboard_180x180_violet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emmaboecker/railboard/eb8c4001e00c844bde76bf117dfb67d9283bfe3c/public/assets/railboard_180x180_violet.png -------------------------------------------------------------------------------- /public/assets/railboard_192x192_violet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emmaboecker/railboard/eb8c4001e00c844bde76bf117dfb67d9283bfe3c/public/assets/railboard_192x192_violet.png -------------------------------------------------------------------------------- /public/assets/railboard_384x384_violet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emmaboecker/railboard/eb8c4001e00c844bde76bf117dfb67d9283bfe3c/public/assets/railboard_384x384_violet.png -------------------------------------------------------------------------------- /public/assets/railboard_512x512_violet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emmaboecker/railboard/eb8c4001e00c844bde76bf117dfb67d9283bfe3c/public/assets/railboard_512x512_violet.png -------------------------------------------------------------------------------- /public/assets/railboard_favicon_gray.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emmaboecker/railboard/eb8c4001e00c844bde76bf117dfb67d9283bfe3c/public/assets/railboard_favicon_gray.png -------------------------------------------------------------------------------- /public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Railboard", 3 | "short_name": "Railboard", 4 | "theme_color": "#5b21b6", 5 | "background_color": "#18181b", 6 | "start_url": "/", 7 | "display": "standalone", 8 | "orientation": "portrait", 9 | "prefer_related_applications": false, 10 | "related_applications": [], 11 | "icons": [ 12 | { 13 | "src": "/assets/railboard_192x192_violet.png", 14 | "sizes": "192x192", 15 | "type": "image/png", 16 | "purpose": "any maskable" 17 | }, 18 | { 19 | "src": "/assets/railboard_384x384_violet.png", 20 | "sizes": "384x384", 21 | "type": "image/png" 22 | }, 23 | { 24 | "src": "/assets/railboard_512x512_violet.png", 25 | "sizes": "512x512", 26 | "type": "image/png" 27 | } 28 | ] 29 | } 30 | -------------------------------------------------------------------------------- /public/sw.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"sw.js","sources":["../../AppData/Local/Temp/60f17be679d34cd706bf366f71edbe33/sw.js"],"sourcesContent":["import {registerRoute as workbox_routing_registerRoute} from 'C:/Users/emmas/IdeaProjects/railboard/node_modules/.pnpm/workbox-routing@6.5.4/node_modules/workbox-routing/registerRoute.mjs';\nimport {NetworkFirst as workbox_strategies_NetworkFirst} from 'C:/Users/emmas/IdeaProjects/railboard/node_modules/.pnpm/workbox-strategies@6.5.4/node_modules/workbox-strategies/NetworkFirst.mjs';\nimport {ExpirationPlugin as workbox_expiration_ExpirationPlugin} from 'C:/Users/emmas/IdeaProjects/railboard/node_modules/.pnpm/workbox-expiration@6.5.4/node_modules/workbox-expiration/ExpirationPlugin.mjs';\nimport {CacheFirst as workbox_strategies_CacheFirst} from 'C:/Users/emmas/IdeaProjects/railboard/node_modules/.pnpm/workbox-strategies@6.5.4/node_modules/workbox-strategies/CacheFirst.mjs';\nimport {StaleWhileRevalidate as workbox_strategies_StaleWhileRevalidate} from 'C:/Users/emmas/IdeaProjects/railboard/node_modules/.pnpm/workbox-strategies@6.5.4/node_modules/workbox-strategies/StaleWhileRevalidate.mjs';\nimport {RangeRequestsPlugin as workbox_range_requests_RangeRequestsPlugin} from 'C:/Users/emmas/IdeaProjects/railboard/node_modules/.pnpm/workbox-range-requests@6.5.4/node_modules/workbox-range-requests/RangeRequestsPlugin.mjs';\nimport {clientsClaim as workbox_core_clientsClaim} from 'C:/Users/emmas/IdeaProjects/railboard/node_modules/.pnpm/workbox-core@6.5.4/node_modules/workbox-core/clientsClaim.mjs';\nimport {precacheAndRoute as workbox_precaching_precacheAndRoute} from 'C:/Users/emmas/IdeaProjects/railboard/node_modules/.pnpm/workbox-precaching@6.5.4/node_modules/workbox-precaching/precacheAndRoute.mjs';\nimport {cleanupOutdatedCaches as workbox_precaching_cleanupOutdatedCaches} from 'C:/Users/emmas/IdeaProjects/railboard/node_modules/.pnpm/workbox-precaching@6.5.4/node_modules/workbox-precaching/cleanupOutdatedCaches.mjs';/**\n * Welcome to your Workbox-powered service worker!\n *\n * You'll need to register this file in your web app.\n * See https://goo.gl/nhQhGp\n *\n * The rest of the code is auto-generated. Please don't update this file\n * directly; instead, make changes to your Workbox build configuration\n * and re-run your build process.\n * See https://goo.gl/2aRDsh\n */\n\n\nimportScripts(\n \n);\n\n\n\n\n\n\n\nself.skipWaiting();\n\nworkbox_core_clientsClaim();\n\n\n/**\n * The precacheAndRoute() method efficiently caches and responds to\n * requests for URLs in the manifest.\n * See https://goo.gl/S9QRab\n */\nworkbox_precaching_precacheAndRoute([\n {\n \"url\": \"/_next/app-build-manifest.json\",\n \"revision\": \"889162465a45802f514d12229faaceb8\"\n },\n {\n \"url\": \"/_next/static/1dX-0IcimE8jX4p-W3sRg/_buildManifest.js\",\n \"revision\": \"f07f829255539ea61fcab043aab8e5eb\"\n },\n {\n \"url\": \"/_next/static/1dX-0IcimE8jX4p-W3sRg/_ssgManifest.js\",\n \"revision\": \"b6652df95db52feb4daf4eca35380933\"\n },\n {\n \"url\": \"/_next/static/chunks/191-0c351d25b4901df4.js\",\n \"revision\": \"1dX-0IcimE8jX4p-W3sRg\"\n },\n {\n \"url\": \"/_next/static/chunks/191-0c351d25b4901df4.js.map\",\n \"revision\": \"bd07cc5f3fffe95cbc724a8f6e7f16c8\"\n },\n {\n \"url\": \"/_next/static/chunks/244-aebebd8ece15b1a5.js\",\n \"revision\": \"1dX-0IcimE8jX4p-W3sRg\"\n },\n {\n \"url\": \"/_next/static/chunks/244-aebebd8ece15b1a5.js.map\",\n \"revision\": \"500cfab1959af712395a422b1fd6473a\"\n },\n {\n \"url\": \"/_next/static/chunks/253-85d435d5dfc320c6.js\",\n \"revision\": \"1dX-0IcimE8jX4p-W3sRg\"\n },\n {\n \"url\": \"/_next/static/chunks/253-85d435d5dfc320c6.js.map\",\n \"revision\": \"aa6a1f7e793979604aed2cd78f07d1db\"\n },\n {\n \"url\": \"/_next/static/chunks/404-6df0245d26b88feb.js\",\n \"revision\": \"1dX-0IcimE8jX4p-W3sRg\"\n },\n {\n \"url\": \"/_next/static/chunks/404-6df0245d26b88feb.js.map\",\n \"revision\": \"6977b1b560575bd858461aba740604d3\"\n },\n {\n \"url\": \"/_next/static/chunks/556-4fe918942413426e.js\",\n \"revision\": \"1dX-0IcimE8jX4p-W3sRg\"\n },\n {\n \"url\": \"/_next/static/chunks/556-4fe918942413426e.js.map\",\n \"revision\": \"df79d85db32c46f7af33502a435ab40f\"\n },\n {\n \"url\": \"/_next/static/chunks/71f97449-a602e217bb9a90ba.js\",\n \"revision\": \"1dX-0IcimE8jX4p-W3sRg\"\n },\n {\n \"url\": \"/_next/static/chunks/726-10f4cf786ce0fa6d.js\",\n \"revision\": \"1dX-0IcimE8jX4p-W3sRg\"\n },\n {\n \"url\": \"/_next/static/chunks/726-10f4cf786ce0fa6d.js.map\",\n \"revision\": \"63216b8990693cc3af69aeb739e6a690\"\n },\n {\n \"url\": \"/_next/static/chunks/79b442ea-b11c562674f4f0de.js\",\n \"revision\": \"1dX-0IcimE8jX4p-W3sRg\"\n },\n {\n \"url\": \"/_next/static/chunks/79b442ea-b11c562674f4f0de.js.map\",\n \"revision\": \"d479366fe5303818ac65271a2ed082ba\"\n },\n {\n \"url\": \"/_next/static/chunks/91-02b80619636ea3e1.js\",\n \"revision\": \"1dX-0IcimE8jX4p-W3sRg\"\n },\n {\n \"url\": \"/_next/static/chunks/91-02b80619636ea3e1.js.map\",\n \"revision\": \"4ff6b7156a43ca5303ab338fb8847aa0\"\n },\n {\n \"url\": \"/_next/static/chunks/932ddf8c-b5b3fb94d5772dc5.js\",\n \"revision\": \"1dX-0IcimE8jX4p-W3sRg\"\n },\n {\n \"url\": \"/_next/static/chunks/932ddf8c-b5b3fb94d5772dc5.js.map\",\n \"revision\": \"5e63b79a4d8f3fa84fd1b493efeb61a9\"\n },\n {\n \"url\": \"/_next/static/chunks/98f3ca1d-0c0c43afd8fcd6b5.js\",\n \"revision\": \"1dX-0IcimE8jX4p-W3sRg\"\n },\n {\n \"url\": \"/_next/static/chunks/98f3ca1d-0c0c43afd8fcd6b5.js.map\",\n \"revision\": \"4dfd562a466acf6091eff065898012d6\"\n },\n {\n \"url\": \"/_next/static/chunks/9d8aaa44-5a87817b25518c80.js\",\n \"revision\": \"1dX-0IcimE8jX4p-W3sRg\"\n },\n {\n \"url\": \"/_next/static/chunks/9d8aaa44-5a87817b25518c80.js.map\",\n \"revision\": \"e685e2f6204648a84d28460d0f2298be\"\n },\n {\n \"url\": \"/_next/static/chunks/af0efb5a-b7d998f07e9a13d7.js\",\n \"revision\": \"1dX-0IcimE8jX4p-W3sRg\"\n },\n {\n \"url\": \"/_next/static/chunks/af0efb5a-b7d998f07e9a13d7.js.map\",\n \"revision\": \"12c8a18933c71bb9135a876307da704d\"\n },\n {\n \"url\": \"/_next/static/chunks/app/about/page-4958c63ccb95fc4a.js\",\n \"revision\": \"1dX-0IcimE8jX4p-W3sRg\"\n },\n {\n \"url\": \"/_next/static/chunks/app/about/page-4958c63ccb95fc4a.js.map\",\n \"revision\": \"6c8c2db46c493ea9e05ee820f151611a\"\n },\n {\n \"url\": \"/_next/static/chunks/app/journey/%5Bjourney%5D/loading-5e363c09253f9702.js\",\n \"revision\": \"1dX-0IcimE8jX4p-W3sRg\"\n },\n {\n \"url\": \"/_next/static/chunks/app/journey/%5Bjourney%5D/loading-5e363c09253f9702.js.map\",\n \"revision\": \"ddd5b8eb685a53aa9103cf1eb21b1f01\"\n },\n {\n \"url\": \"/_next/static/chunks/app/journey/%5Bjourney%5D/page-0f403d873c5f2788.js\",\n \"revision\": \"1dX-0IcimE8jX4p-W3sRg\"\n },\n {\n \"url\": \"/_next/static/chunks/app/journey/%5Bjourney%5D/page-0f403d873c5f2788.js.map\",\n \"revision\": \"2b3bb039656c2d56e68da44aec5aad65\"\n },\n {\n \"url\": \"/_next/static/chunks/app/layout-468a8195bcdcfcd8.js\",\n \"revision\": \"1dX-0IcimE8jX4p-W3sRg\"\n },\n {\n \"url\": \"/_next/static/chunks/app/layout-468a8195bcdcfcd8.js.map\",\n \"revision\": \"f2d82d986bdc961889ceefc3485583d0\"\n },\n {\n \"url\": \"/_next/static/chunks/app/page-71fdf849e99fed4f.js\",\n \"revision\": \"1dX-0IcimE8jX4p-W3sRg\"\n },\n {\n \"url\": \"/_next/static/chunks/app/page-71fdf849e99fed4f.js.map\",\n \"revision\": \"b6342a69ab5e0d8efc5cd60299b12fdc\"\n },\n {\n \"url\": \"/_next/static/chunks/app/station/%5Bstation%5D/%5Bdatetime%5D/loading-5a788ceffb29d695.js\",\n \"revision\": \"1dX-0IcimE8jX4p-W3sRg\"\n },\n {\n \"url\": \"/_next/static/chunks/app/station/%5Bstation%5D/%5Bdatetime%5D/loading-5a788ceffb29d695.js.map\",\n \"revision\": \"78c2f8cba8ee81e280949af24e00a959\"\n },\n {\n \"url\": \"/_next/static/chunks/app/station/%5Bstation%5D/%5Bdatetime%5D/page-07954e53a7bd6e03.js\",\n \"revision\": \"1dX-0IcimE8jX4p-W3sRg\"\n },\n {\n \"url\": \"/_next/static/chunks/app/station/%5Bstation%5D/%5Bdatetime%5D/page-07954e53a7bd6e03.js.map\",\n \"revision\": \"9c2d36997087c9873f393bb71ae3bb47\"\n },\n {\n \"url\": \"/_next/static/chunks/app/station/%5Bstation%5D/layout-1ef671c18fa40f46.js\",\n \"revision\": \"1dX-0IcimE8jX4p-W3sRg\"\n },\n {\n \"url\": \"/_next/static/chunks/app/station/%5Bstation%5D/layout-1ef671c18fa40f46.js.map\",\n \"revision\": \"46b592f60046a70bbce7a59d60cc278f\"\n },\n {\n \"url\": \"/_next/static/chunks/app/station/%5Bstation%5D/page-0820a35e3af9afbf.js\",\n \"revision\": \"1dX-0IcimE8jX4p-W3sRg\"\n },\n {\n \"url\": \"/_next/static/chunks/app/station/%5Bstation%5D/page-0820a35e3af9afbf.js.map\",\n \"revision\": \"64460eed01bbad6866aac91f1b50e984\"\n },\n {\n \"url\": \"/_next/static/chunks/dfb59f34-ef450fb7d6e73631.js\",\n \"revision\": \"1dX-0IcimE8jX4p-W3sRg\"\n },\n {\n \"url\": \"/_next/static/chunks/dfb59f34-ef450fb7d6e73631.js.map\",\n \"revision\": \"7fad83e43141621a0a062cd653f791d2\"\n },\n {\n \"url\": \"/_next/static/chunks/ffcedf8d-b6b3482e06d6e0cf.js\",\n \"revision\": \"1dX-0IcimE8jX4p-W3sRg\"\n },\n {\n \"url\": \"/_next/static/chunks/ffcedf8d-b6b3482e06d6e0cf.js.map\",\n \"revision\": \"12cc35c8dce4d5c98628cdaff0512c8a\"\n },\n {\n \"url\": \"/_next/static/chunks/framework-bf7b0c24e91915e1.js\",\n \"revision\": \"1dX-0IcimE8jX4p-W3sRg\"\n },\n {\n \"url\": \"/_next/static/chunks/framework-bf7b0c24e91915e1.js.map\",\n \"revision\": \"caabc008ae58315521cd7994404b29e7\"\n },\n {\n \"url\": \"/_next/static/chunks/main-5f4ffbcbd2d5bbcf.js\",\n \"revision\": \"1dX-0IcimE8jX4p-W3sRg\"\n },\n {\n \"url\": \"/_next/static/chunks/main-5f4ffbcbd2d5bbcf.js.map\",\n \"revision\": \"73d0c385eef5a6fb0c362f0a83ff612f\"\n },\n {\n \"url\": \"/_next/static/chunks/main-app-be21d4da5e7143e8.js\",\n \"revision\": \"1dX-0IcimE8jX4p-W3sRg\"\n },\n {\n \"url\": \"/_next/static/chunks/main-app-be21d4da5e7143e8.js.map\",\n \"revision\": \"1ef27cb9bac4f3ecc6cb8b29036bf106\"\n },\n {\n \"url\": \"/_next/static/chunks/pages/_app-37e2b62d62bc77fa.js\",\n \"revision\": \"1dX-0IcimE8jX4p-W3sRg\"\n },\n {\n \"url\": \"/_next/static/chunks/pages/_app-37e2b62d62bc77fa.js.map\",\n \"revision\": \"84d7e9c48c9783e1a81de0c7e730d4c2\"\n },\n {\n \"url\": \"/_next/static/chunks/pages/_error-dbd377d934b80457.js\",\n \"revision\": \"1dX-0IcimE8jX4p-W3sRg\"\n },\n {\n \"url\": \"/_next/static/chunks/pages/_error-dbd377d934b80457.js.map\",\n \"revision\": \"6d891784ca378dc9d7b857e30aa2dfe9\"\n },\n {\n \"url\": \"/_next/static/chunks/polyfills-78c92fac7aa8fdd8.js\",\n \"revision\": \"79330112775102f91e1010318bae2bd3\"\n },\n {\n \"url\": \"/_next/static/chunks/webpack-deb9db6185d035af.js\",\n \"revision\": \"1dX-0IcimE8jX4p-W3sRg\"\n },\n {\n \"url\": \"/_next/static/chunks/webpack-deb9db6185d035af.js.map\",\n \"revision\": \"d20a47180f08b82e03c5245259f3a8c1\"\n },\n {\n \"url\": \"/_next/static/css/6fdaf54a3b50e3b5.css\",\n \"revision\": \"6fdaf54a3b50e3b5\"\n },\n {\n \"url\": \"/_next/static/css/6fdaf54a3b50e3b5.css.map\",\n \"revision\": \"1f7213c7063bf4fae5cc023162147996\"\n },\n {\n \"url\": \"/_next/static/media/source-sans-pro-cyrillic-400-normal.43c57a21.woff\",\n \"revision\": \"43c57a21\"\n },\n {\n \"url\": \"/_next/static/media/source-sans-pro-cyrillic-400-normal.54720925.woff2\",\n \"revision\": \"54720925\"\n },\n {\n \"url\": \"/_next/static/media/source-sans-pro-cyrillic-ext-400-normal.90ce457e.woff2\",\n \"revision\": \"90ce457e\"\n },\n {\n \"url\": \"/_next/static/media/source-sans-pro-cyrillic-ext-400-normal.ce9aafef.woff\",\n \"revision\": \"ce9aafef\"\n },\n {\n \"url\": \"/_next/static/media/source-sans-pro-greek-400-normal.5382de85.woff\",\n \"revision\": \"5382de85\"\n },\n {\n \"url\": \"/_next/static/media/source-sans-pro-greek-400-normal.af9d511c.woff2\",\n \"revision\": \"af9d511c\"\n },\n {\n \"url\": \"/_next/static/media/source-sans-pro-greek-ext-400-normal.0cc27096.woff\",\n \"revision\": \"0cc27096\"\n },\n {\n \"url\": \"/_next/static/media/source-sans-pro-greek-ext-400-normal.bb83722c.woff2\",\n \"revision\": \"bb83722c\"\n },\n {\n \"url\": \"/_next/static/media/source-sans-pro-latin-400-normal.0a598dac.woff2\",\n \"revision\": \"0a598dac\"\n },\n {\n \"url\": \"/_next/static/media/source-sans-pro-latin-400-normal.4ca9c27c.woff\",\n \"revision\": \"4ca9c27c\"\n },\n {\n \"url\": \"/_next/static/media/source-sans-pro-latin-ext-400-normal.5b53e305.woff2\",\n \"revision\": \"5b53e305\"\n },\n {\n \"url\": \"/_next/static/media/source-sans-pro-latin-ext-400-normal.d4acccc9.woff\",\n \"revision\": \"d4acccc9\"\n },\n {\n \"url\": \"/_next/static/media/source-sans-pro-vietnamese-400-normal.253761cb.woff\",\n \"revision\": \"253761cb\"\n },\n {\n \"url\": \"/_next/static/media/source-sans-pro-vietnamese-400-normal.2bfd4e61.woff2\",\n \"revision\": \"2bfd4e61\"\n },\n {\n \"url\": \"/_next/static/media/ubuntu-cyrillic-400-normal.06d44b86.woff\",\n \"revision\": \"06d44b86\"\n },\n {\n \"url\": \"/_next/static/media/ubuntu-cyrillic-400-normal.cd977eb5.woff2\",\n \"revision\": \"cd977eb5\"\n },\n {\n \"url\": \"/_next/static/media/ubuntu-cyrillic-ext-400-normal.38dc9e56.woff2\",\n \"revision\": \"38dc9e56\"\n },\n {\n \"url\": \"/_next/static/media/ubuntu-cyrillic-ext-400-normal.df77d78c.woff\",\n \"revision\": \"df77d78c\"\n },\n {\n \"url\": \"/_next/static/media/ubuntu-greek-400-normal.5d9d84cd.woff\",\n \"revision\": \"5d9d84cd\"\n },\n {\n \"url\": \"/_next/static/media/ubuntu-greek-400-normal.fd714fb2.woff2\",\n \"revision\": \"fd714fb2\"\n },\n {\n \"url\": \"/_next/static/media/ubuntu-greek-ext-400-normal.420a56f2.woff2\",\n \"revision\": \"420a56f2\"\n },\n {\n \"url\": \"/_next/static/media/ubuntu-greek-ext-400-normal.78a578ed.woff\",\n \"revision\": \"78a578ed\"\n },\n {\n \"url\": \"/_next/static/media/ubuntu-latin-400-normal.cc39a7a5.woff\",\n \"revision\": \"cc39a7a5\"\n },\n {\n \"url\": \"/_next/static/media/ubuntu-latin-400-normal.e82090ff.woff2\",\n \"revision\": \"e82090ff\"\n },\n {\n \"url\": \"/_next/static/media/ubuntu-latin-ext-400-normal.87d0bf89.woff2\",\n \"revision\": \"87d0bf89\"\n },\n {\n \"url\": \"/_next/static/media/ubuntu-latin-ext-400-normal.94a16607.woff\",\n \"revision\": \"94a16607\"\n },\n {\n \"url\": \"/assets/railboard_180x180_violet.png\",\n \"revision\": \"208babcb4949fc27bb14c720d1b01750\"\n },\n {\n \"url\": \"/assets/railboard_192x192_violet.png\",\n \"revision\": \"e2d385206def15922fe231e283aabd7b\"\n },\n {\n \"url\": \"/assets/railboard_384x384_violet.png\",\n \"revision\": \"79e4721448583008da9dd7f9f6f4bdda\"\n },\n {\n \"url\": \"/assets/railboard_512x512_violet.png\",\n \"revision\": \"4e6b45f9f6c07688cff7ecb215bc2f4e\"\n },\n {\n \"url\": \"/assets/railboard_favicon_gray.png\",\n \"revision\": \"3c85463d15346746c6fe6417450eb6e4\"\n },\n {\n \"url\": \"/manifest.json\",\n \"revision\": \"607ee950ede1dce5f1f33d89bcd6fbf2\"\n }\n], {\n \"ignoreURLParametersMatching\": []\n});\nworkbox_precaching_cleanupOutdatedCaches();\n\n\n\nworkbox_routing_registerRoute(\"/\", new workbox_strategies_NetworkFirst({ \"cacheName\":\"start-url\", plugins: [{ cacheWillUpdate: async ({ request, response, event, state }) => { if (response && response.type === 'opaqueredirect') { return new Response(response.body, { status: 200, statusText: 'OK', headers: response.headers }) } return response } }] }), 'GET');\nworkbox_routing_registerRoute(/^https:\\/\\/fonts\\.(?:gstatic)\\.com\\/.*/i, new workbox_strategies_CacheFirst({ \"cacheName\":\"google-fonts-webfonts\", plugins: [new workbox_expiration_ExpirationPlugin({ maxEntries: 4, maxAgeSeconds: 31536000 })] }), 'GET');\nworkbox_routing_registerRoute(/^https:\\/\\/fonts\\.(?:googleapis)\\.com\\/.*/i, new workbox_strategies_StaleWhileRevalidate({ \"cacheName\":\"google-fonts-stylesheets\", plugins: [new workbox_expiration_ExpirationPlugin({ maxEntries: 4, maxAgeSeconds: 604800 })] }), 'GET');\nworkbox_routing_registerRoute(/\\.(?:eot|otf|ttc|ttf|woff|woff2|font.css)$/i, new workbox_strategies_StaleWhileRevalidate({ \"cacheName\":\"static-font-assets\", plugins: [new workbox_expiration_ExpirationPlugin({ maxEntries: 4, maxAgeSeconds: 604800 })] }), 'GET');\nworkbox_routing_registerRoute(/\\.(?:jpg|jpeg|gif|png|svg|ico|webp)$/i, new workbox_strategies_StaleWhileRevalidate({ \"cacheName\":\"static-image-assets\", plugins: [new workbox_expiration_ExpirationPlugin({ maxEntries: 64, maxAgeSeconds: 86400 })] }), 'GET');\nworkbox_routing_registerRoute(/\\/_next\\/image\\?url=.+$/i, new workbox_strategies_StaleWhileRevalidate({ \"cacheName\":\"next-image\", plugins: [new workbox_expiration_ExpirationPlugin({ maxEntries: 64, maxAgeSeconds: 86400 })] }), 'GET');\nworkbox_routing_registerRoute(/\\.(?:mp3|wav|ogg)$/i, new workbox_strategies_CacheFirst({ \"cacheName\":\"static-audio-assets\", plugins: [new workbox_range_requests_RangeRequestsPlugin(), new workbox_expiration_ExpirationPlugin({ maxEntries: 32, maxAgeSeconds: 86400 })] }), 'GET');\nworkbox_routing_registerRoute(/\\.(?:mp4)$/i, new workbox_strategies_CacheFirst({ \"cacheName\":\"static-video-assets\", plugins: [new workbox_range_requests_RangeRequestsPlugin(), new workbox_expiration_ExpirationPlugin({ maxEntries: 32, maxAgeSeconds: 86400 })] }), 'GET');\nworkbox_routing_registerRoute(/\\.(?:js)$/i, new workbox_strategies_StaleWhileRevalidate({ \"cacheName\":\"static-js-assets\", plugins: [new workbox_expiration_ExpirationPlugin({ maxEntries: 32, maxAgeSeconds: 86400 })] }), 'GET');\nworkbox_routing_registerRoute(/\\.(?:css|less)$/i, new workbox_strategies_StaleWhileRevalidate({ \"cacheName\":\"static-style-assets\", plugins: [new workbox_expiration_ExpirationPlugin({ maxEntries: 32, maxAgeSeconds: 86400 })] }), 'GET');\nworkbox_routing_registerRoute(/\\/_next\\/data\\/.+\\/.+\\.json$/i, new workbox_strategies_StaleWhileRevalidate({ \"cacheName\":\"next-data\", plugins: [new workbox_expiration_ExpirationPlugin({ maxEntries: 32, maxAgeSeconds: 86400 })] }), 'GET');\nworkbox_routing_registerRoute(/\\.(?:json|xml|csv)$/i, new workbox_strategies_NetworkFirst({ \"cacheName\":\"static-data-assets\", plugins: [new workbox_expiration_ExpirationPlugin({ maxEntries: 32, maxAgeSeconds: 86400 })] }), 'GET');\nworkbox_routing_registerRoute(({ url }) => {\n const isSameOrigin = self.origin === url.origin\n if (!isSameOrigin) return false\n const pathname = url.pathname\n // Exclude /api/auth/callback/* to fix OAuth workflow in Safari without impact other environment\n // Above route is default for next-auth, you may need to change it if your OAuth workflow has a different callback route\n // Issue: https://github.com/shadowwalker/next-pwa/issues/131#issuecomment-821894809\n if (pathname.startsWith('/api/auth/')) return false\n if (pathname.startsWith('/api/')) return true\n return false\n }, new workbox_strategies_NetworkFirst({ \"cacheName\":\"apis\",\"networkTimeoutSeconds\":10, plugins: [new workbox_expiration_ExpirationPlugin({ maxEntries: 16, maxAgeSeconds: 86400 })] }), 'GET');\nworkbox_routing_registerRoute(({ url }) => {\n const isSameOrigin = self.origin === url.origin\n if (!isSameOrigin) return false\n const pathname = url.pathname\n if (pathname.startsWith('/api/')) return false\n return true\n }, new workbox_strategies_NetworkFirst({ \"cacheName\":\"others\",\"networkTimeoutSeconds\":10, plugins: [new workbox_expiration_ExpirationPlugin({ maxEntries: 32, maxAgeSeconds: 86400 })] }), 'GET');\nworkbox_routing_registerRoute(({ url }) => {\n const isSameOrigin = self.origin === url.origin\n return !isSameOrigin\n }, new workbox_strategies_NetworkFirst({ \"cacheName\":\"cross-origin\",\"networkTimeoutSeconds\":10, plugins: [new workbox_expiration_ExpirationPlugin({ maxEntries: 32, maxAgeSeconds: 3600 })] }), 'GET');\n\n\n\n\n"],"names":["importScripts","self","skipWaiting","workbox_core_clientsClaim","workbox_precaching_precacheAndRoute","url","revision","ignoreURLParametersMatching","workbox_precaching_cleanupOutdatedCaches","workbox_routing_registerRoute","workbox_strategies_NetworkFirst","cacheName","plugins","cacheWillUpdate","async","request","response","event","state","type","Response","body","status","statusText","headers","workbox_strategies_CacheFirst","workbox_expiration_ExpirationPlugin","maxEntries","maxAgeSeconds","workbox_strategies_StaleWhileRevalidate","workbox_range_requests_RangeRequestsPlugin","origin","pathname","startsWith","networkTimeoutSeconds"],"mappings":"0nBAqBAA,gBAUAC,KAAKC,cAELC,EAAAA,eAQAC,EAAAA,iBAAoC,CAClC,CACEC,IAAO,iCACPC,SAAY,oCAEd,CACED,IAAO,wDACPC,SAAY,oCAEd,CACED,IAAO,sDACPC,SAAY,oCAEd,CACED,IAAO,+CACPC,SAAY,yBAEd,CACED,IAAO,mDACPC,SAAY,oCAEd,CACED,IAAO,+CACPC,SAAY,yBAEd,CACED,IAAO,mDACPC,SAAY,oCAEd,CACED,IAAO,+CACPC,SAAY,yBAEd,CACED,IAAO,mDACPC,SAAY,oCAEd,CACED,IAAO,+CACPC,SAAY,yBAEd,CACED,IAAO,mDACPC,SAAY,oCAEd,CACED,IAAO,+CACPC,SAAY,yBAEd,CACED,IAAO,mDACPC,SAAY,oCAEd,CACED,IAAO,oDACPC,SAAY,yBAEd,CACED,IAAO,+CACPC,SAAY,yBAEd,CACED,IAAO,mDACPC,SAAY,oCAEd,CACED,IAAO,oDACPC,SAAY,yBAEd,CACED,IAAO,wDACPC,SAAY,oCAEd,CACED,IAAO,8CACPC,SAAY,yBAEd,CACED,IAAO,kDACPC,SAAY,oCAEd,CACED,IAAO,oDACPC,SAAY,yBAEd,CACED,IAAO,wDACPC,SAAY,oCAEd,CACED,IAAO,oDACPC,SAAY,yBAEd,CACED,IAAO,wDACPC,SAAY,oCAEd,CACED,IAAO,oDACPC,SAAY,yBAEd,CACED,IAAO,wDACPC,SAAY,oCAEd,CACED,IAAO,oDACPC,SAAY,yBAEd,CACED,IAAO,wDACPC,SAAY,oCAEd,CACED,IAAO,0DACPC,SAAY,yBAEd,CACED,IAAO,8DACPC,SAAY,oCAEd,CACED,IAAO,6EACPC,SAAY,yBAEd,CACED,IAAO,iFACPC,SAAY,oCAEd,CACED,IAAO,0EACPC,SAAY,yBAEd,CACED,IAAO,8EACPC,SAAY,oCAEd,CACED,IAAO,sDACPC,SAAY,yBAEd,CACED,IAAO,0DACPC,SAAY,oCAEd,CACED,IAAO,oDACPC,SAAY,yBAEd,CACED,IAAO,wDACPC,SAAY,oCAEd,CACED,IAAO,4FACPC,SAAY,yBAEd,CACED,IAAO,gGACPC,SAAY,oCAEd,CACED,IAAO,yFACPC,SAAY,yBAEd,CACED,IAAO,6FACPC,SAAY,oCAEd,CACED,IAAO,4EACPC,SAAY,yBAEd,CACED,IAAO,gFACPC,SAAY,oCAEd,CACED,IAAO,0EACPC,SAAY,yBAEd,CACED,IAAO,8EACPC,SAAY,oCAEd,CACED,IAAO,oDACPC,SAAY,yBAEd,CACED,IAAO,wDACPC,SAAY,oCAEd,CACED,IAAO,oDACPC,SAAY,yBAEd,CACED,IAAO,wDACPC,SAAY,oCAEd,CACED,IAAO,qDACPC,SAAY,yBAEd,CACED,IAAO,yDACPC,SAAY,oCAEd,CACED,IAAO,gDACPC,SAAY,yBAEd,CACED,IAAO,oDACPC,SAAY,oCAEd,CACED,IAAO,oDACPC,SAAY,yBAEd,CACED,IAAO,wDACPC,SAAY,oCAEd,CACED,IAAO,sDACPC,SAAY,yBAEd,CACED,IAAO,0DACPC,SAAY,oCAEd,CACED,IAAO,wDACPC,SAAY,yBAEd,CACED,IAAO,4DACPC,SAAY,oCAEd,CACED,IAAO,qDACPC,SAAY,oCAEd,CACED,IAAO,mDACPC,SAAY,yBAEd,CACED,IAAO,uDACPC,SAAY,oCAEd,CACED,IAAO,yCACPC,SAAY,oBAEd,CACED,IAAO,6CACPC,SAAY,oCAEd,CACED,IAAO,wEACPC,SAAY,YAEd,CACED,IAAO,yEACPC,SAAY,YAEd,CACED,IAAO,6EACPC,SAAY,YAEd,CACED,IAAO,4EACPC,SAAY,YAEd,CACED,IAAO,qEACPC,SAAY,YAEd,CACED,IAAO,sEACPC,SAAY,YAEd,CACED,IAAO,yEACPC,SAAY,YAEd,CACED,IAAO,0EACPC,SAAY,YAEd,CACED,IAAO,sEACPC,SAAY,YAEd,CACED,IAAO,qEACPC,SAAY,YAEd,CACED,IAAO,0EACPC,SAAY,YAEd,CACED,IAAO,yEACPC,SAAY,YAEd,CACED,IAAO,0EACPC,SAAY,YAEd,CACED,IAAO,2EACPC,SAAY,YAEd,CACED,IAAO,+DACPC,SAAY,YAEd,CACED,IAAO,gEACPC,SAAY,YAEd,CACED,IAAO,oEACPC,SAAY,YAEd,CACED,IAAO,mEACPC,SAAY,YAEd,CACED,IAAO,4DACPC,SAAY,YAEd,CACED,IAAO,6DACPC,SAAY,YAEd,CACED,IAAO,iEACPC,SAAY,YAEd,CACED,IAAO,gEACPC,SAAY,YAEd,CACED,IAAO,4DACPC,SAAY,YAEd,CACED,IAAO,6DACPC,SAAY,YAEd,CACED,IAAO,iEACPC,SAAY,YAEd,CACED,IAAO,gEACPC,SAAY,YAEd,CACED,IAAO,uCACPC,SAAY,oCAEd,CACED,IAAO,uCACPC,SAAY,oCAEd,CACED,IAAO,uCACPC,SAAY,oCAEd,CACED,IAAO,uCACPC,SAAY,oCAEd,CACED,IAAO,qCACPC,SAAY,oCAEd,CACED,IAAO,iBACPC,SAAY,qCAEb,CACDC,4BAA+B,KAEjCC,EAAAA,wBAIAC,EAAAA,cAA8B,IAAK,IAAIC,eAAgC,CAAEC,UAAY,YAAaC,QAAS,CAAC,CAAEC,gBAAiBC,OAASC,UAASC,WAAUC,QAAOC,WAAkBF,GAA8B,mBAAlBA,EAASG,KAAoC,IAAIC,SAASJ,EAASK,KAAM,CAAEC,OAAQ,IAAKC,WAAY,KAAMC,QAASR,EAASQ,UAAoBR,MAAkB,OAClWP,EAAAA,cAA8B,0CAA2C,IAAIgB,aAA8B,CAAEd,UAAY,wBAAyBC,QAAS,CAAC,IAAIc,mBAAoC,CAAEC,WAAY,EAAGC,cAAe,aAAiB,OACrPnB,EAAAA,cAA8B,6CAA8C,IAAIoB,uBAAwC,CAAElB,UAAY,2BAA4BC,QAAS,CAAC,IAAIc,mBAAoC,CAAEC,WAAY,EAAGC,cAAe,YAAe,OACnQnB,EAAAA,cAA8B,8CAA+C,IAAIoB,uBAAwC,CAAElB,UAAY,qBAAsBC,QAAS,CAAC,IAAIc,mBAAoC,CAAEC,WAAY,EAAGC,cAAe,YAAe,OAC9PnB,EAAAA,cAA8B,wCAAyC,IAAIoB,uBAAwC,CAAElB,UAAY,sBAAuBC,QAAS,CAAC,IAAIc,mBAAoC,CAAEC,WAAY,GAAIC,cAAe,WAAc,OACzPnB,EAAAA,cAA8B,2BAA4B,IAAIoB,uBAAwC,CAAElB,UAAY,aAAcC,QAAS,CAAC,IAAIc,mBAAoC,CAAEC,WAAY,GAAIC,cAAe,WAAc,OACnOnB,EAAAA,cAA8B,sBAAuB,IAAIgB,aAA8B,CAAEd,UAAY,sBAAuBC,QAAS,CAAC,IAAIkB,sBAA8C,IAAIJ,EAAAA,iBAAoC,CAAEC,WAAY,GAAIC,cAAe,WAAc,OAC/QnB,EAAAA,cAA8B,cAAe,IAAIgB,aAA8B,CAAEd,UAAY,sBAAuBC,QAAS,CAAC,IAAIkB,sBAA8C,IAAIJ,EAAAA,iBAAoC,CAAEC,WAAY,GAAIC,cAAe,WAAc,OACvQnB,EAAAA,cAA8B,aAAc,IAAIoB,uBAAwC,CAAElB,UAAY,mBAAoBC,QAAS,CAAC,IAAIc,mBAAoC,CAAEC,WAAY,GAAIC,cAAe,WAAc,OAC3NnB,EAAAA,cAA8B,mBAAoB,IAAIoB,uBAAwC,CAAElB,UAAY,sBAAuBC,QAAS,CAAC,IAAIc,mBAAoC,CAAEC,WAAY,GAAIC,cAAe,WAAc,OACpOnB,EAAAA,cAA8B,gCAAiC,IAAIoB,uBAAwC,CAAElB,UAAY,YAAaC,QAAS,CAAC,IAAIc,mBAAoC,CAAEC,WAAY,GAAIC,cAAe,WAAc,OACvOnB,EAAAA,cAA8B,uBAAwB,IAAIC,eAAgC,CAAEC,UAAY,qBAAsBC,QAAS,CAAC,IAAIc,mBAAoC,CAAEC,WAAY,GAAIC,cAAe,WAAc,OAC/NnB,EAAAA,eAA8B,EAAGJ,UAE3B,KADqBJ,KAAK8B,SAAW1B,EAAI0B,QACtB,OAAO,EAC1B,MAAMC,EAAW3B,EAAI2B,SAIrB,OAAIA,EAASC,WAAW,iBACpBD,EAASC,WAAW,QACZ,GACX,IAAIvB,EAAAA,aAAgC,CAAEC,UAAY,OAAOuB,sBAAwB,GAAItB,QAAS,CAAC,IAAIc,mBAAoC,CAAEC,WAAY,GAAIC,cAAe,WAAc,OAC7LnB,EAAAA,eAA8B,EAAGJ,UAE3B,KADqBJ,KAAK8B,SAAW1B,EAAI0B,QACtB,OAAO,EAE1B,OADiB1B,EAAI2B,SACRC,WAAW,QACb,GACV,IAAIvB,EAAAA,aAAgC,CAAEC,UAAY,SAASuB,sBAAwB,GAAItB,QAAS,CAAC,IAAIc,mBAAoC,CAAEC,WAAY,GAAIC,cAAe,WAAc,OAC/LnB,EAAAA,eAA8B,EAAGJ,WACNJ,KAAK8B,SAAW1B,EAAI0B,SAExC,IAAIrB,EAAAA,aAAgC,CAAEC,UAAY,eAAeuB,sBAAwB,GAAItB,QAAS,CAAC,IAAIc,mBAAoC,CAAEC,WAAY,GAAIC,cAAe,UAAa"} -------------------------------------------------------------------------------- /renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://docs.renovatebot.com/renovate-schema.json", 3 | "extends": ["config:base"], 4 | "branchConcurrentLimit": 0, 5 | "baseBranches": ["dev"] 6 | } 7 | -------------------------------------------------------------------------------- /src/app/HomePage.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import useDetectKeyboardOpen from "use-detect-keyboard-open"; 4 | import { Tab } from "@headlessui/react"; 5 | import clsx from "clsx"; 6 | import { TabSelection } from "../components/ui/TabSelection"; 7 | import { Search, Train } from "tabler-icons-react"; 8 | import StationBoardPanel from "./StationBoardPanel"; 9 | import TrainSearchPanel from "./TrainSearchPanel"; 10 | import RailboardInfo from "./RailboardInfo"; 11 | 12 | export default function HomePageComponent() { 13 | const isKeyboardOpen = useDetectKeyboardOpen(); 14 | 15 | return ( 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 |
28 |
29 | 35 | } /> 36 | } /> 37 | 38 |
39 |
40 | ); 41 | } 42 | -------------------------------------------------------------------------------- /src/app/RailboardInfo.tsx: -------------------------------------------------------------------------------- 1 | import { FaGithub } from "react-icons/fa"; 2 | import Link from "next/link"; 3 | import { IoIosInformationCircle } from "react-icons/io"; 4 | import React from "react"; 5 | 6 | export default function RailboardInfo() { 7 | return ( 8 |
9 | 16 | 17 |

GitHub

18 | 19 |
20 | 26 | 27 |

Über Railboard

28 | 29 |
30 | ); 31 | } 32 | -------------------------------------------------------------------------------- /src/app/StationBoardPanel.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import { useState } from "react"; 4 | import { useRouter } from "next/navigation"; 5 | import { PageTitle } from "../components/ui/PageTitle"; 6 | import StationSearchBar from "../components/search/StationSearchBar"; 7 | import Button from "../components/ui/button/Button"; 8 | import TransportTypeFilterButtonPopup, { 9 | TransportType, 10 | transportTypes, 11 | } from "../components/station_board/filter/TransportTypeFilter"; 12 | import { useLocalStorage } from "@mantine/hooks"; 13 | import dayjs from "dayjs"; 14 | 15 | export default function StationBoardPanel() { 16 | const [selectedStationId, setSelectedStationId] = useState(undefined); 17 | 18 | const [date, setDate] = useState(new Date()); 19 | 20 | const router = useRouter(); 21 | 22 | const [redirecting, setRedirecting] = useState(false); 23 | 24 | const [currentTransportTypes, setTransportTypes] = useLocalStorage({ 25 | key: "transport-types", 26 | defaultValue: transportTypes, 27 | }); 28 | 29 | return ( 30 | <> 31 |
32 | 33 |
34 |
35 |
36 | 37 |
38 | 42 |
43 |
44 |
45 |
46 | { 49 | setDate(new Date(event.target.value)); 50 | }} 51 | value={formatDate(date)} 52 | className="w-full rounded-md bg-zinc-800 p-2 text-white outline-none" 53 | /> 54 | 62 |
63 |
64 | 78 |
79 | 80 | ); 81 | } 82 | 83 | export function formatDate(date: Date, full = true): string { 84 | let formattedDate = ""; 85 | formattedDate = formattedDate.concat(date.getFullYear().toString(), "-"); 86 | formattedDate = formattedDate.concat((date.getMonth() + 1).toString().padStart(2, "0"), "-"); 87 | formattedDate = formattedDate.concat(date.getDate().toString().padStart(2, "0")); 88 | if (full) { 89 | formattedDate = formattedDate.concat("T"); 90 | formattedDate = formattedDate.concat(date.getHours().toString().padStart(2, "0"), ":"); 91 | formattedDate = formattedDate.concat(date.getMinutes().toString().padStart(2, "0")); 92 | } 93 | return formattedDate; 94 | } 95 | -------------------------------------------------------------------------------- /src/app/TrainSearchPanel.tsx: -------------------------------------------------------------------------------- 1 | import { PageTitle } from "../components/ui/PageTitle"; 2 | import { useState } from "react"; 3 | import TrainSearchBar from "../components/search/TrainSearchBar"; 4 | import { formatDate } from "./StationBoardPanel"; 5 | import Button from "../components/ui/button/Button"; 6 | 7 | export default function TrainSearchPanel() { 8 | const [date, setDate] = useState(new Date()); 9 | 10 | return ( 11 | <> 12 |
13 |
14 | 15 |
16 |
17 |
18 |
19 |
20 | { 23 | setDate(new Date(event.target.value)); 24 | }} 25 | value={formatDate(date, false)} 26 | className="w-full rounded-md bg-zinc-800 p-2 text-white outline-none" 27 | /> 28 | 36 |
37 | 38 |
39 |
40 |
41 | 42 | ); 43 | } 44 | -------------------------------------------------------------------------------- /src/app/about/page.tsx: -------------------------------------------------------------------------------- 1 | import Link from "next/link"; 2 | import GoBackButton from "../../components/ui/button/GoBackButton"; 3 | 4 | export default function AboutPage() { 5 | return ( 6 |
7 |
8 |
9 | 10 |

Über Railboard

11 |
12 |

13 | Entwickelt von 14 | / 15 | 16 |

17 |

18 | Railboard ist eine Website (und PWA) um möglichst einfach Informationen über Züge, ihre Verspätung, ihre 19 | Wagenreihung (Coming soon™) usw. zu erhalten.
20 | Sehr inspiriert von 21 | 22 | wollte ich jedoch eine etwas übersichtlichere und schönere Version machen, außerdem hat mich die neue Bahn-API 23 | namens 24 | 30 | die von 31 | 32 | benutzt wird sehr interessiert, was mir die Motivation gegeben hat, dieses Projekt zu starten. Ich habe jedoch 33 | mittlerweile gemerkt, dass die API nicht genug Daten/Informationen liefert.
34 | Mittlerweile baue ich auf einer Kombination von mehreren mehr oder weniger internen APIs auf, die ich 35 | reverse-engineered habe.
36 | Die Daten kann man auch in eigenen Projekten benutzen, da ich das Backend ebenfalls Open-Source entwickle und 37 | eine öffentliche API bereitstelle. Diese ist hier zu finden:{" "} 38 | 39 |

40 |

Bugs & Feature Requests

41 |

42 | Bei eventuell gefundenen Bugs (Typos, Layout Bugs oder anderen Problemen) sowie bei Feature Requests melde 43 | dich bitte auf Github indem du ein 44 | 45 | erstellst. 46 |

47 |

48 | Diese Website steht nicht in Verbindung mit der Deutschen Bahn AG, jeweiligen Tochterunternehmen o.Ä. 49 |

50 |
51 |
52 | ); 53 | } 54 | 55 | function ExternalLink(props: { link: string; text: string }) { 56 | return ( 57 | <> 58 | {" "} 59 | 64 | {props.text} 65 | {" "} 66 | 67 | ); 68 | } 69 | -------------------------------------------------------------------------------- /src/app/globals.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; 4 | 5 | @layer base { 6 | html { 7 | font-family: "Source Sans Pro", system-ui, sans-serif; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/app/journey/[journey]/JourneyShareButton.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import { useCallback } from "react"; 4 | import ShareButton from "../../../components/ui/button/ShareButton"; 5 | import { createShare } from "../../../utils/share"; 6 | import { RisJourneyDetails } from "../../../requests/ris/journeyDetails"; 7 | 8 | export default function JourneyShareButton({ 9 | journeyId, 10 | className, 11 | journey, 12 | }: { 13 | journeyId: string; 14 | className?: string; 15 | journey: RisJourneyDetails; 16 | }) { 17 | const names = journey.stops.map( 18 | (stop) => stop.transport.category + " " + (stop.transport.line ?? stop.transport.number.toString()) 19 | ); 20 | 21 | const uniqueNames = names.filter((element, index) => { 22 | return names.indexOf(element) === index; 23 | }); 24 | 25 | const shareJourney = useCallback(() => { 26 | (async () => { 27 | const share = await createShare({ 28 | type: "journey", 29 | journeyId, 30 | }); 31 | await navigator.share({ 32 | url: share, 33 | text: `${uniqueNames.join(", ")} auf ${document.location.host}`, 34 | }); 35 | })(); 36 | }, [journeyId, uniqueNames]); 37 | 38 | return ; 39 | } 40 | -------------------------------------------------------------------------------- /src/app/journey/[journey]/MessageDisplay.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import { IoIosInformationCircle } from "react-icons/io"; 4 | import { useState } from "react"; 5 | import clsx from "clsx"; 6 | 7 | export default function MessageDisplay(props: { 8 | text: string; 9 | shortText?: string; 10 | color: "gray" | "red"; 11 | showIcon?: boolean; 12 | disabled?: boolean; 13 | }) { 14 | const [clicked, setClicked] = useState(false); 15 | 16 | const markup = { __html: props.shortText && !clicked ? props.shortText : props.text }; 17 | 18 | if (!props.disabled) { 19 | return ( 20 | 46 | ); 47 | } 48 | 49 | return ( 50 |
56 | {props.showIcon && ( 57 | 62 | )} 63 | 64 |
65 | ); 66 | } 67 | -------------------------------------------------------------------------------- /src/app/journey/[journey]/StopDisplay.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import { RisJourneyStop } from "../../../requests/ris/journeyDetails"; 4 | import { useState } from "react"; 5 | import StopDetailsPopup from "../../../components/station_board/details/StopDetailsPopup"; 6 | import StopTimeDisplay from "./StopTimeDisplay"; 7 | import MessageDisplay from "./MessageDisplay"; 8 | import PlatformDisplay from "../../../components/station_board/elements/PlatformDisplay"; 9 | import clsx from "clsx"; 10 | 11 | export default function StopDisplay(props: { 12 | stop: RisJourneyStop; 13 | stops: RisJourneyStop[]; 14 | index: number; 15 | commonMessages: string[]; 16 | }) { 17 | const stop = props.stop; 18 | 19 | const scheduledPlatform = stop.scheduledPlatform; 20 | const platform = stop.realPlatform; 21 | 22 | const commonMessages = props.commonMessages; 23 | 24 | const [open, setOpen] = useState(false); 25 | 26 | return ( 27 | <> 28 | 29 | 115 | 116 | ); 117 | } 118 | -------------------------------------------------------------------------------- /src/app/journey/[journey]/StopTimeDisplay.tsx: -------------------------------------------------------------------------------- 1 | import { InternalTimeDisplay } from "../../../components/station_board/elements/TimeDisplay"; 2 | 3 | export type TimeDisplayProps = { 4 | arrivalTime?: { 5 | scheduled?: string; 6 | realtime?: string; 7 | cancelled?: boolean; 8 | additional?: boolean; 9 | timeType?: string; 10 | }; 11 | departureTime?: { 12 | scheduled?: string; 13 | realtime?: string; 14 | cancelled?: boolean; 15 | additional?: boolean; 16 | timeType?: string; 17 | }; 18 | }; 19 | 20 | export default function StopTimeDisplay(props: TimeDisplayProps): JSX.Element { 21 | const scheduledArrival = props.arrivalTime?.scheduled; 22 | const actualArrival = props.arrivalTime?.realtime; 23 | 24 | const scheduledDepart = props.departureTime?.scheduled; 25 | const actualDepart = props.departureTime?.realtime; 26 | 27 | return ( 28 |
29 |
30 | {scheduledArrival && ( 31 | 38 | )} 39 |
40 |
41 | {scheduledDepart && ( 42 | 49 | )} 50 |
51 |
52 | ); 53 | } 54 | -------------------------------------------------------------------------------- /src/app/journey/[journey]/loading.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import { Bars } from "react-loader-spinner"; 4 | import GoBackButton from "../../../components/ui/button/GoBackButton"; 5 | 6 | export default function JourneyLoading() { 7 | return ( 8 | <> 9 |
10 |
11 |
12 | 13 |
14 |
15 |
16 | 17 |
18 |
19 | 20 | ); 21 | } 22 | -------------------------------------------------------------------------------- /src/app/journey/[journey]/page.tsx: -------------------------------------------------------------------------------- 1 | import MessageDisplay from "./MessageDisplay"; 2 | import GoBackButton from "../../../components/ui/button/GoBackButton"; 3 | import JourneyShareButton from "./JourneyShareButton"; 4 | import journeyDetails from "../../../requests/ris/journeyDetails"; 5 | import StopDisplay from "./StopDisplay"; 6 | import { Metadata } from "next"; 7 | 8 | export const revalidate = 60; 9 | 10 | export const dynamic = "force-dynamic"; 11 | 12 | type Props = { params: { journey: string } }; 13 | 14 | export async function generateMetadata({ params }: Props): Promise { 15 | const data = await journeyDetails(params.journey); 16 | 17 | const names = data.stops.map( 18 | (stop) => stop.transport.category + " " + (stop.transport.line ?? stop.transport.number.toString()) 19 | ); 20 | 21 | const uniqueNames = names.filter((element, index) => { 22 | return names.indexOf(element) === index; 23 | }); 24 | return { 25 | title: `${uniqueNames.join(", ")} - Reise | Railboard`, 26 | openGraph: { 27 | type: "website", 28 | title: `${uniqueNames.join(", ")} auf Railboard`, 29 | description: `Die aktuelle Reise von ${uniqueNames.join(", ")} auf Railboard.`, 30 | siteName: "Railboard", 31 | }, 32 | }; 33 | } 34 | 35 | export default async function Page({ params }: Props): Promise { 36 | const data = await journeyDetails(params.journey); 37 | 38 | const names = data.stops.map( 39 | (stop) => stop.transport.category + " " + (stop.transport.line ?? stop.transport.number.toString()) 40 | ); 41 | 42 | const uniqueNames = names.filter((element, index) => { 43 | return names.indexOf(element) === index; 44 | }); 45 | 46 | const numbers = data.stops.map((stop) => stop.transport.number); 47 | 48 | const uniqueNumbers = numbers.filter((element, index) => { 49 | return numbers.indexOf(element) === index; 50 | }); 51 | 52 | const admins = data.stops.map((stop) => { 53 | let adminName; 54 | if (stop.administration.name !== stop.administration.risName) { 55 | adminName = stop.administration.name + " (" + stop.administration.risName + ")"; 56 | } else { 57 | adminName = stop.administration.name; 58 | } 59 | 60 | if (adminName.includes("Nahverkehrszug") || adminName.includes("Nahreisezug")) { 61 | adminName = stop.administration.id + ` (${adminName})`; 62 | } 63 | 64 | return adminName; 65 | }); 66 | 67 | const uniqueAdmins = admins.filter((element, index) => { 68 | return admins.indexOf(element) === index; 69 | }); 70 | 71 | const isDifferentNumber = data.stops.some((stop) => { 72 | return stop.transport.line != null && stop.transport.line !== stop.transport.number.toString(); 73 | }); 74 | 75 | const commonMessages = data.stops 76 | .map((stop) => stop.messages.map((message) => message)) 77 | .reduce((a, b) => a.filter((c) => b.map((m) => m.text).includes(c.text))); 78 | 79 | return ( 80 | <> 81 |
82 |
83 |
84 | 85 |
{uniqueNames.join(", ")}
86 |
nach
87 |
{data.destinationName}
88 |
89 | 90 |
91 |
92 |
93 | 94 | {uniqueNames.join(", ")} {isDifferentNumber && <>({uniqueNumbers.join(", ")})} 95 | 96 | <> 97 | betrieben durch 98 | {uniqueAdmins.join(", ")} 99 | 100 |
101 |
102 |
103 | {commonMessages 104 | .sort((a, b) => (a.displayPriority ?? 0) - (b.displayPriority ?? b.type === "CUSTOMER_TEXT" ? 1 : 0)) 105 | .map((message) => ( 106 | 112 | ))} 113 |
114 |
115 | {data.stops.map((stop, index) => { 116 | return ( 117 | message.text)} 120 | stops={data.stops} 121 | index={index} 122 | key={stop.stopName} 123 | /> 124 | ); 125 | })} 126 |
127 |
128 | 129 | ); 130 | } 131 | -------------------------------------------------------------------------------- /src/app/layout.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | import "./globals.css"; 4 | 5 | import "@fontsource/ubuntu"; 6 | import "@fontsource/source-sans-pro"; 7 | 8 | export default function RootLayout({ children }: { children: React.ReactNode }) { 9 | return ( 10 | <> 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | {children} 36 | 37 | 38 | ); 39 | } 40 | -------------------------------------------------------------------------------- /src/app/page.tsx: -------------------------------------------------------------------------------- 1 | import { Metadata } from "next"; 2 | import HomePageComponent from "./HomePage"; 3 | 4 | export const metadata: Metadata = { 5 | title: "Railboard", 6 | description: 7 | "Railboard ist eine Web-App, mit der Du Informationen wie Verspätungen, Gleis(-wechsel) deiner Züge einfach einsehen kannst.", 8 | openGraph: { 9 | type: "website", 10 | title: "Railboard", 11 | description: 12 | "Railboard ist eine Web-App, mit der Du Informationen wie Verspätungen, Gleis(-wechsel) deiner Züge einfach einsehen kannst.", 13 | siteName: "Railboard", 14 | }, 15 | }; 16 | 17 | export default function HomePage() { 18 | return ; 19 | } 20 | -------------------------------------------------------------------------------- /src/app/station/[station]/ReloadButton.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import { usePathname, useRouter } from "next/navigation"; 4 | import { Reload } from "tabler-icons-react"; 5 | import Button from "../../../components/ui/button/Button"; 6 | import dayjs from "dayjs"; 7 | import { useEffect, useState } from "react"; 8 | import { TailSpin } from "react-loader-spinner"; 9 | 10 | export default function ReloadButton(props: { stationId: string; className: string }) { 11 | const router = useRouter(); 12 | 13 | const [reloading, setReloading] = useState(false); 14 | 15 | const path = usePathname(); 16 | 17 | useEffect(() => { 18 | setReloading(false); 19 | }, [path]); 20 | 21 | return ( 22 | 48 | ); 49 | } 50 | -------------------------------------------------------------------------------- /src/app/station/[station]/StationBoardTopBar.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import { useLocalStorage } from "@mantine/hooks"; 4 | import { Dispatch, SetStateAction, useState } from "react"; 5 | import { FaFilter } from "react-icons/fa"; 6 | import { GiHamburgerMenu } from "react-icons/gi"; 7 | import TransportTypeFilterButtonPopup, { 8 | TransportType, 9 | transportTypes, 10 | } from "../../../components/station_board/filter/TransportTypeFilter"; 11 | import Button from "../../../components/ui/button/Button"; 12 | import GoBackButton from "../../../components/ui/button/GoBackButton"; 13 | import Popup from "../../../components/ui/Popup"; 14 | import { StationInformation } from "../../../requests/ris/stationInformation"; 15 | import ReloadButton from "./ReloadButton"; 16 | import StationShareButton from "./StationShareButton"; 17 | 18 | export default function StationBoardTopBar(props: { 19 | data: StationInformation; 20 | station: string; 21 | datetime?: number; 22 | children?: React.ReactNode; 23 | }) { 24 | const [currentTransportTypes, setTransportTypes] = useLocalStorage({ 25 | key: "transport-types", 26 | defaultValue: transportTypes, 27 | }); 28 | 29 | const { data, datetime, station, children } = props; 30 | 31 | const [open, setOpen] = useState(false); 32 | 33 | return ( 34 | <> 35 |
36 |
37 |
38 | 39 |
40 |
41 |

{data.names.nameLong}

42 |
43 |
44 | 45 | 57 |
58 |
59 | 62 |

Optionen

63 | 69 |

Station teilen

70 |
71 |
72 | } 73 | open={open} 74 | setOpen={setOpen} 75 | > 76 | 77 | 78 |
{children}
79 |
80 | 81 | ); 82 | } 83 | 84 | function PopupContent(props: { 85 | setTransportTypes: Dispatch>; 86 | currentTransportTypes: TransportType[]; 87 | }) { 88 | return ( 89 | <> 90 |
91 | 95 |
96 | 97 |

Filter

98 |
99 |
100 |
101 | 102 | ); 103 | } 104 | -------------------------------------------------------------------------------- /src/app/station/[station]/StationShareButton.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import { ReactNode, useCallback } from "react"; 4 | import ShareButton from "../../../components/ui/button/ShareButton"; 5 | import { stationInformation } from "../../../requests/ris/stationInformation"; 6 | import { createShare } from "../../../utils/share"; 7 | 8 | export default function StationShareButton({ 9 | station, 10 | datetime, 11 | className, 12 | size, 13 | children, 14 | }: { 15 | station: string; 16 | datetime?: number; 17 | className?: string; 18 | size?: number; 19 | children?: ReactNode; 20 | }) { 21 | const shareStation = useCallback(() => { 22 | (async () => { 23 | const [share, data] = await Promise.all([ 24 | createShare({ 25 | type: "station", 26 | eva: station, 27 | timestamp: datetime, 28 | }), 29 | stationInformation(station), 30 | ]); 31 | await navigator.share({ 32 | url: share, 33 | text: `${data.names.nameLong} auf ${document.location.host}`, 34 | }); 35 | })(); 36 | }, [datetime, station]); 37 | 38 | return {children}; 39 | } 40 | -------------------------------------------------------------------------------- /src/app/station/[station]/[datetime]/loading.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import { Bars } from "react-loader-spinner"; 4 | 5 | export default function Loading() { 6 | return ( 7 |
8 | 14 |
15 | ); 16 | } 17 | -------------------------------------------------------------------------------- /src/app/station/[station]/[datetime]/page.tsx: -------------------------------------------------------------------------------- 1 | import StationBoardDisplayContainer from "../../../../components/station_board/StationBoardDisplayContainer"; 2 | import dayjs from "dayjs"; 3 | import { stationBoard } from "../../../../requests/custom/stationBoard"; 4 | import { Metadata } from "next"; 5 | import { stationInformation } from "../../../../requests/ris/stationInformation"; 6 | 7 | export const dynamic = "force-dynamic"; 8 | 9 | type Props = { 10 | params: { station: string; datetime: string }; 11 | searchParams: { [key: string]: string | string[] | undefined }; 12 | }; 13 | 14 | export async function generateMetadata({ params }: Props): Promise { 15 | const data = await stationInformation(params.station); 16 | 17 | return { 18 | title: `${data.names.nameLong} - StationBoard | Railboard`, 19 | openGraph: { 20 | type: "website", 21 | title: `${data.names.nameLong} auf Railboard`, 22 | description: `Aktuelle Abfahrten und Ankünfte von ${data.names.nameLong} auf Railboard.`, 23 | siteName: "Railboard", 24 | }, 25 | }; 26 | } 27 | 28 | export default async function Page({ params, searchParams }: Props) { 29 | let lookbehind = undefined; 30 | let lookahead = undefined; 31 | if (searchParams?.lookbehind != null) { 32 | lookbehind = parseInt(searchParams.lookbehind as string); 33 | } 34 | if (searchParams?.lookahead != null) { 35 | lookahead = parseInt(searchParams.lookahead as string); 36 | } 37 | 38 | console.log(JSON.stringify(params)); 39 | 40 | const date = dayjs(decodeURIComponent(params.datetime)); 41 | 42 | const data = await stationBoard(params.station, date, lookbehind, lookahead); 43 | 44 | return ( 45 | <> 46 |
47 | 48 |
49 | 50 | ); 51 | } 52 | -------------------------------------------------------------------------------- /src/app/station/[station]/layout.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { stationInformation } from "../../../requests/ris/stationInformation"; 3 | import StationBoardTopBar from "./StationBoardTopBar"; 4 | 5 | export default async function Layout({ 6 | children, 7 | params, 8 | }: { 9 | children?: React.ReactNode; 10 | params?: { station?: string; datetime?: string }; 11 | }) { 12 | const station = params?.station ?? "8000105"; 13 | const data = await stationInformation(station); 14 | 15 | const datetime = (params?.datetime && parseInt(params.datetime)) || Date.now(); 16 | 17 | return ( 18 | 19 | {children} 20 | 21 | ); 22 | } 23 | -------------------------------------------------------------------------------- /src/app/station/[station]/page.tsx: -------------------------------------------------------------------------------- 1 | import { redirect } from "next/navigation"; 2 | import dayjs from "dayjs"; 3 | 4 | export const dynamic = "force-dynamic"; 5 | 6 | export default function StationBoardPage({ params }: { params: { station: string } }): JSX.Element { 7 | const date = new Date(); 8 | 9 | redirect(`/station/${params.station}/${dayjs(date).toISOString()}`); 10 | 11 | return <>; 12 | } 13 | -------------------------------------------------------------------------------- /src/components/coach_sequence/CoachSequence.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import { Bars } from "react-loader-spinner"; 4 | import useSWR from "swr"; 5 | import coachSequence from "../../requests/coach_sequence/coach_sequence"; 6 | 7 | export type CoachSequenceProps = { 8 | lineNummer: string; 9 | time: string; 10 | visible: boolean; 11 | }; 12 | 13 | export default function CoachSequence(props: CoachSequenceProps) { 14 | const { data } = useSWR(props.lineNummer, (key) => coachSequence(key, props.time), {}); 15 | 16 | return ( 17 | <> 18 | {!data ? ( 19 | 20 | ) : "error" in data ? ( 21 | <>Wagenreihung nicht gefunden 22 | ) : ( 23 | <>{data.data.istformation.zuggattung} 24 | )} 25 | 26 | ); 27 | } 28 | -------------------------------------------------------------------------------- /src/components/search/StationSearchBar.tsx: -------------------------------------------------------------------------------- 1 | import { Dialog, Transition } from "@headlessui/react"; 2 | import { useClickOutside, useDebouncedValue, useLocalStorage } from "@mantine/hooks"; 3 | import { Dispatch, Fragment, SetStateAction, useState } from "react"; 4 | import { Star } from "tabler-icons-react"; 5 | import searchStation from "../../requests/ris/stationSearch"; 6 | import Favourite from "../../utils/favourites"; 7 | import useSWR from "swr"; 8 | import Button from "../ui/button/Button"; 9 | import { FiMapPin } from "react-icons/fi"; 10 | import { IoCloseOutline } from "react-icons/io5"; 11 | 12 | export type StationSearchBarProps = { 13 | setSelectedStationId: Dispatch>; 14 | }; 15 | 16 | export default function StationSearchBar(props: StationSearchBarProps): JSX.Element { 17 | const [search, setSearch] = useState(""); 18 | const [debouncedSearch] = useDebouncedValue(search, 500); 19 | 20 | const [favourites, setFavourites] = useLocalStorage({ 21 | key: "favourites", 22 | defaultValue: [], 23 | }); 24 | 25 | const [open, setOpen] = useState(false); 26 | const ref = useClickOutside(() => setOpen(false)); 27 | 28 | const { data } = useSWR(debouncedSearch, (key) => searchStation(key)); 29 | 30 | const [locatePopup, setLocatePopup] = useState(false); 31 | 32 | // idc enough to write a type 33 | // eslint-disable-next-line @typescript-eslint/no-explicit-any 34 | const [locateData, setLocateData] = useState(undefined); 35 | 36 | return ( 37 | <> 38 |
39 |
40 | setOpen(true)} 43 | onChange={(e) => { 44 | setSearch(e.currentTarget.value); 45 | props.setSelectedStationId(undefined); 46 | }} 47 | onClick={() => { 48 | setOpen(true); 49 | }} 50 | value={search} 51 | placeholder={"Suche eine Station"} 52 | /> 53 | 72 |
73 | 83 |
84 | {search == "" ? ( 85 |
86 |

Favoriten

87 | {favourites.length > 0 ? ( 88 |
89 | {favourites.map((favourite) => ( 90 | { 96 | setSearch(station.name); 97 | setOpen(false); 98 | props.setSelectedStationId(station.evaNr); 99 | }} 100 | /> 101 | ))} 102 |
103 | ) : ( 104 |

Du hast keine Favoriten

105 | )} 106 |
107 | ) : ( 108 | <> 109 | {!data ? ( 110 |
111 |

Lädt...

112 |
113 | ) : ( 114 |
115 | {data 116 | .filter((station) => station.evaNumber != null) 117 | .map((station) => ( 118 | { 127 | props.setSelectedStationId(station.evaNr); 128 | setSearch(station.name); 129 | setOpen(false); 130 | }} 131 | /> 132 | ))} 133 |
134 | )} 135 | 136 | )} 137 |
138 |
139 |
140 | 141 | {}} 146 | > 147 | 156 |
157 | 158 |
159 |
160 | 169 | 174 | 175 |

Stationen in deiner Nähe

176 | 182 |
183 | 187 | {locateData && 188 | locateData 189 | .filter((station) => station.id != null) 190 | .map((station) => ( 191 | 205 | ))} 206 | 207 |
208 |
209 |
210 |
211 |
212 |
213 | 214 | ); 215 | } 216 | 217 | type StationResultDisplayProps = { 218 | station: Favourite; 219 | favourites: Favourite[]; 220 | setFavourites: Dispatch>; 221 | onClick: (station: Favourite) => void; 222 | }; 223 | 224 | function StationResultDisplay(props: StationResultDisplayProps): JSX.Element { 225 | return ( 226 |
227 | 236 | 261 |
262 | ); 263 | } 264 | -------------------------------------------------------------------------------- /src/components/search/TrainSearchBar.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import { Transition } from "@headlessui/react"; 4 | import { useClickOutside, useDebouncedValue } from "@mantine/hooks"; 5 | import dayjs from "dayjs"; 6 | import { useRouter } from "next/navigation"; 7 | import { Fragment, useState } from "react"; 8 | import useSWR from "swr"; 9 | import { getApiBaseUrl } from "../../requests/get_base_url"; 10 | import { RisJourneySearchElement } from "../../requests/ris/journeySearch"; 11 | 12 | export type TrainSearchBarProps = { 13 | date: Date; 14 | }; 15 | 16 | export default function TrainSearchBar(props: TrainSearchBarProps): JSX.Element { 17 | const [category, setCategory] = useState(""); 18 | const [number, setNumber] = useState(""); 19 | const [debouncedCategory] = useDebouncedValue(category, 300); 20 | const [debouncedNumber] = useDebouncedValue(number, 300); 21 | 22 | const [open, setOpen] = useState(false); 23 | const ref = useClickOutside(() => setOpen(false)); 24 | 25 | const router = useRouter(); 26 | 27 | const date = dayjs(props.date).format("YYYY-MM-DD"); 28 | 29 | const { data } = useSWR( 30 | `${getApiBaseUrl()}/ris/v1/journey_search/${debouncedCategory}/${encodeURIComponent(debouncedNumber)}?date=${date}`, 31 | (key) => fetch(key).then((res) => res.json() as Promise) 32 | ); 33 | 34 | return ( 35 |
36 |
37 | setOpen(true)} 40 | onChange={(e) => { 41 | setCategory(e.currentTarget.value); 42 | }} 43 | onClick={() => { 44 | setOpen(true); 45 | }} 46 | value={category} 47 | placeholder={"Kategorie"} 48 | /> 49 | 50 | setOpen(true)} 53 | onChange={(e) => { 54 | setNumber(e.currentTarget.value); 55 | }} 56 | onClick={() => { 57 | setOpen(true); 58 | }} 59 | value={number} 60 | placeholder={"Zugnummer"} 61 | /> 62 |
63 | 73 |
74 | <> 75 | {!data ? ( 76 |
77 |

Lädt...

78 |
79 | ) : ( 80 |
81 | {data.length === 0 ? ( 82 | <>Kein Ergebnis gefunden 83 | ) : ( 84 |
85 | {data.map((trip) => ( 86 | { 90 | await router.push(`/journey/${trip.journeyID}`); 91 | }} 92 | /> 93 | ))} 94 |
95 | )} 96 |
97 | )} 98 | 99 |
100 |
101 |
102 | ); 103 | } 104 | 105 | type TrainResultDisplayProps = { 106 | trip: RisJourneySearchElement; 107 | onClick: () => void; 108 | }; 109 | 110 | function TrainResultDisplay(props: TrainResultDisplayProps) { 111 | return ( 112 | <> 113 |
114 | 140 |
141 | 142 | ); 143 | } 144 | -------------------------------------------------------------------------------- /src/components/station_board/StationBoardDisplayContainer.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import { useElementSize, useLocalStorage } from "@mantine/hooks"; 4 | import { CSSProperties, useState } from "react"; 5 | import { FixedSizeList as List } from "react-window"; 6 | import StationBoardDisplayElement from "./StationBoardDisplayElement"; 7 | import { TransportType, transportTypes } from "./filter/TransportTypeFilter"; 8 | import DetailsPopup from "./details/DetailsPopup"; 9 | import { StationBoard } from "../../requests/custom/stationBoard"; 10 | 11 | export type StationBoardDisplayContainerProps = { 12 | data: StationBoard; 13 | }; 14 | 15 | export default function StationBoardDisplayContainer(props: StationBoardDisplayContainerProps): JSX.Element { 16 | const { ref, width, height } = useElementSize(); 17 | 18 | const [currentTransportTypes] = useLocalStorage({ 19 | key: "transport-types", 20 | defaultValue: transportTypes, 21 | }); 22 | 23 | const filteredData = props.data.items.filter((train) => { 24 | let isIncluded = false; 25 | currentTransportTypes.forEach((value) => { 26 | const productTypes = filterFormat(value, train.trainType); 27 | if (productTypes.includes(train.trainType ?? "")) { 28 | isIncluded = true; 29 | } 30 | }); 31 | return isIncluded; 32 | }); 33 | 34 | const Row = ({ index, style }: { index: number; style: CSSProperties }) => { 35 | /* eslint-disable-next-line @typescript-eslint/no-non-null-assertion */ 36 | const trainData = filteredData[index]!; 37 | 38 | const [open, setOpen] = useState(false); 39 | 40 | return ( 41 |
42 | 52 |
53 | ); 54 | }; 55 | 56 | return ( 57 |
58 | 59 | {Row} 60 | 61 |
62 | ); 63 | } 64 | 65 | function filterFormat(transportType: TransportType, category: string): string[] { 66 | let productTypes: string[] = []; 67 | 68 | switch (transportType) { 69 | case TransportType.HighspeedTrains: 70 | productTypes = ["HIGH_SPEED_TRAIN", "ICE", "ECE", "FLX", "TGV", "RJ"]; 71 | break; 72 | case TransportType.ICAndECTrains: 73 | productTypes = ["INTERCITY_TRAIN", "IC", "EC", "NJ", "EN"]; 74 | break; 75 | case TransportType.InterregionalAndFastTrains: 76 | productTypes = ["IR", "INTER_REGIONAL_TRAIN"]; 77 | break; 78 | case TransportType.SuburbanTrains: 79 | productTypes = ["CITY_TRAIN", "S"]; 80 | break; 81 | case TransportType.Tram: 82 | productTypes = ["TRAM", "STR", "STB"]; 83 | break; 84 | case TransportType.Subway: 85 | productTypes = ["SUBWAY", "U"]; 86 | break; 87 | case TransportType.Busses: 88 | productTypes = ["BUS", "Bus"]; 89 | break; 90 | case TransportType.Boats: 91 | productTypes = ["FERRY"]; 92 | break; 93 | case TransportType.CallRequiringTransportTypes: 94 | productTypes = ["SHUTTLE"]; 95 | break; 96 | case TransportType.RegionalAndOtherTrains: 97 | if ( 98 | transportTypes 99 | .filter((value) => value !== TransportType.RegionalAndOtherTrains) 100 | .find((value) => filterFormat(value, category).includes(category)) == null 101 | ) { 102 | productTypes = ["REGIONAL_TRAIN", "RE", "RB", "HLB", "VIA", category]; 103 | } 104 | break; 105 | } 106 | 107 | return productTypes; 108 | } 109 | -------------------------------------------------------------------------------- /src/components/station_board/StationBoardDisplayElement.tsx: -------------------------------------------------------------------------------- 1 | import NameAndPlatformDisplay from "./elements/NameAndPlatformDisplay"; 2 | import StationsDisplay from "./elements/StationsDisplay"; 3 | import TimeDisplay from "./elements/TimeDisplay"; 4 | import NoticesDisplay from "./elements/NoticesDisplay"; 5 | import { StationBoardItem } from "../../requests/custom/stationBoard"; 6 | 7 | export type StationBoardDisplayElementProps = { 8 | train: StationBoardItem; 9 | }; 10 | 11 | export default function StationBoardDisplayElement(props: StationBoardDisplayElementProps): JSX.Element { 12 | const messages = props.train.additionalInfo?.messages ?? []; 13 | 14 | return ( 15 | <> 16 |
17 | {props.train.arrival != null || props.train.departure != null ? ( 18 |
19 | 25 |
26 | ) : null} 27 | 28 |
29 |
30 | 31 |
32 | {messages.length > 0 && ( 33 |
34 | 35 |
36 | )} 37 |
38 | 39 |
40 |
41 |
42 | 43 | ); 44 | } 45 | -------------------------------------------------------------------------------- /src/components/station_board/details/DetailsPopup.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import { Dispatch, SetStateAction, useEffect, useState } from "react"; 4 | import { HiExternalLink } from "react-icons/hi"; 5 | import clsx from "clsx"; 6 | import { formatTime } from "../../../utils/time"; 7 | import Popup from "../../ui/Popup"; 8 | import { TailSpin } from "react-loader-spinner"; 9 | import { StationBoardItem } from "../../../requests/custom/stationBoard"; 10 | import Link from "next/link"; 11 | import dayjs from "dayjs"; 12 | import timezone from "dayjs/plugin/timezone"; 13 | import PlatformDisplay from "../elements/PlatformDisplay"; 14 | import journeySearch from "../../../requests/ris/journeySearch"; 15 | 16 | export default function DetailsPopup(props: { 17 | open: boolean; 18 | setOpen: Dispatch>; 19 | train: StationBoardItem; 20 | }) { 21 | const scheduledPlatform = props.train.platformScheduled; 22 | const platform = props.train.platformRealtime; 23 | 24 | const [detailsLoading, setDetailsLoading] = useState(false); 25 | 26 | const messages = props.train.additionalInfo?.messages ?? []; 27 | 28 | const uniqueMessages = messages.filter((element, index) => { 29 | return ( 30 | (element.messageStatus === "CauseOfDelay" || element.messageStatus === "QualityChange") && 31 | messages.findIndex((e) => e.id === element.id || e.matchedText === element.matchedText) === index 32 | ); 33 | }); 34 | 35 | const [journeyId, setJourneyId] = useState(props.train.risId); 36 | 37 | useEffect(() => { 38 | if (journeyId != null) return; 39 | if (!props.open) return; 40 | journeySearch( 41 | props.train.category, 42 | props.train.trainNumber.toString(), 43 | dayjs(props.train.departure?.timeScheduled ?? props.train.arrival?.timeScheduled) 44 | ).then((journeys) => { 45 | let first = journeys[0]; 46 | if (first == null) { 47 | const time = dayjs(props.train.departure?.timeScheduled ?? props.train.arrival?.timeScheduled); 48 | journeySearch(props.train.category, props.train.trainNumber.toString(), time.set("date", time.date() - 1)).then( 49 | (journeys) => { 50 | first = journeys[0]; 51 | if (first == null) { 52 | return; 53 | } 54 | setJourneyId(first?.journeyID); 55 | } 56 | ); 57 | } else { 58 | setJourneyId(first?.journeyID); 59 | } 60 | }); 61 | }, [ 62 | journeyId, 63 | props.open, 64 | props.train.arrival?.timeScheduled, 65 | props.train.category, 66 | props.train.departure?.timeScheduled, 67 | props.train.trainNumber, 68 | ]); 69 | 70 | dayjs.extend(timezone); 71 | 72 | return ( 73 | {}} 78 | title={ 79 |

80 | {props.train.category + " " + props.train.lineIndicator} 81 |

82 | } 83 | className={"flex flex-col gap-3"} 84 | > 85 |
86 |
87 | 88 | 89 | 90 | 91 | 97 | 98 | 99 | 100 | 103 | 104 | 105 |
Von: 92 | {props.train.originEva != null && ( 93 | {props.train.originName} 94 | )} 95 | {props.train.originEva == null && <>{props.train.originName}} 96 |
Nach: 101 | {props.train.destinationName} 102 |
106 |
107 | 108 |
109 |
110 |
111 | {props.train.arrival != null && ( 112 |
113 |
Ankunft
114 | 115 |
116 | )} 117 | {props.train.departure && ( 118 |
119 |
Abfahrt
120 | 124 |
125 | )} 126 |
127 |
128 | {uniqueMessages.length > 0 && ( 129 |
130 |

Meldungen

131 |
132 |
    133 | {uniqueMessages.map((message) => ( 134 |
  • 135 | <> 136 | {dayjs(message.timestamp, ["DD-MM-YYYYTHH:mm:ss"]).format("HH:mm")} 137 | {": "} 138 | {message.matchedText ?? message.category ?? message.code ?? message.id} 139 | 140 |
  • 141 | ))} 142 |
143 |
144 |
145 | )} 146 | {props.train.additionalInfo != null && ( 147 |
148 |

Route

149 |
150 |
    151 | {props.train.additionalInfo.route.map((route) => ( 152 |
  • 160 | {route.name} 161 |
  • 162 | ))} 163 |
164 |
165 |
166 | )} 167 | {/*{(props.train.product === "ICE" ||*/} 168 | {/* props.train.product === "IC_EC" ||*/} 169 | {/* props.train.product === "RB") && (*/} 170 | {/* <>*/} 171 | {/*

Wagenreihung (Coming soon)

*/} 172 | {/* {number != null && (*/} 173 | {/* */} 179 | {/* )}*/} 180 | {/* */} 181 | {/*)}*/} 182 |
183 | {journeyId != null ? ( 184 | { 187 | setDetailsLoading(true); 188 | }} 189 | > 190 |
195 | {detailsLoading ? ( 196 | 206 | ) : ( 207 | 208 | )} 209 |

Details

210 |
211 | 212 | ) : ( 213 |
218 | 219 |

Details

220 |
221 | )} 222 |
223 |
224 | ); 225 | } 226 | 227 | function TimeDisplay(props: { scheduledTime: string; time?: string }): JSX.Element { 228 | const isTooLate = props.time ? new Date(props.scheduledTime).getTime() < new Date(props.time).getTime() : undefined; 229 | const isTooEarly = props.time ? new Date(props.scheduledTime).getTime() > new Date(props.time).getTime() : undefined; 230 | 231 | const scheduledTime = new Date(props.scheduledTime.toString()); 232 | const time = props.time != null ? new Date(props.time.toString()) : undefined; 233 | 234 | const diffSeconds = ((time?.getTime() ?? 0) - scheduledTime.getTime()) / 1000; 235 | const diffMins = Math.floor(diffSeconds / 60); 236 | 237 | return ( 238 |
239 |
240 |

0 || diffMins < 0) 246 | ? "text-md text-white line-through" 247 | : "text-white" 248 | )} 249 | > 250 | {formatTime(scheduledTime)} 251 |

252 | {isTooLate && diffMins > 0 &&

(+{diffMins})

} 253 | {isTooEarly && diffMins < 0 &&

({diffMins})

} 254 |
255 | {time && ( 256 | <> 257 |
0 ? "text-red-500" : "text-green-500")}> 258 | {formatTime(time)} 259 |
260 | 261 | )} 262 |
263 | ); 264 | } 265 | -------------------------------------------------------------------------------- /src/components/station_board/details/StopDetailsPopup.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import { Dispatch, SetStateAction } from "react"; 4 | import clsx from "clsx"; 5 | import { formatTime } from "../../../utils/time"; 6 | import Popup from "../../ui/Popup"; 7 | import Link from "next/link"; 8 | import dayjs from "dayjs"; 9 | import timezone from "dayjs/plugin/timezone"; 10 | import PlatformDisplay from "../elements/PlatformDisplay"; 11 | import { RisJourneyStop } from "../../../requests/ris/journeyDetails"; 12 | 13 | export default function StopDetailsPopup(props: { 14 | open: boolean; 15 | setOpen: Dispatch>; 16 | stop: RisJourneyStop; 17 | }) { 18 | const scheduledPlatform = props.stop.scheduledPlatform; 19 | const platform = props.stop.realPlatform; 20 | 21 | dayjs.extend(timezone); 22 | 23 | let adminName = 24 | props.stop.administration.name + 25 | (props.stop.administration.name !== props.stop.administration.risName 26 | ? `(${props.stop.administration.risName})` 27 | : ``); 28 | 29 | if (adminName.includes("Nahverkehrszug") || adminName.includes("Nahreisezug")) { 30 | adminName = props.stop.administration.id + ` (${adminName})`; 31 | } 32 | return ( 33 | props.setOpen(false)} 35 | open={props.open} 36 | setOpen={props.setOpen} 37 | title={{props.stop.stopName}} 38 | className={"flex flex-col gap-3"} 39 | > 40 |
41 |
42 |

43 | {props.stop.transport.category + " " + (props.stop.transport.line ?? props.stop.transport.number)}{" "} 44 | {props.stop.transport.line != null && 45 | props.stop.transport.line !== props.stop.transport.number.toString() && 46 | " (" + props.stop.transport.number + ")"} 47 |

48 |
{adminName}
49 |
50 | 51 |
52 | 53 |
54 |
55 | {props.stop.arrival != null && ( 56 |
57 |
Ankunft
58 | 59 |
60 | )} 61 | {props.stop.departure && ( 62 |
63 |
Abfahrt
64 | 65 |
66 | )} 67 |
68 |
69 | {(props.stop.messages.length > 0 || props.stop.disruptions.length > 0) && ( 70 |
71 |

Meldungen

72 |
    73 | {props.stop.disruptions.map((disruption) => ( 74 |
  • 75 | <>{disruption.text} 76 |
  • 77 | ))} 78 | {props.stop.messages 79 | .sort((a, b) => (a.displayPriority ?? 0) - (b.displayPriority ?? b.type === "CUSTOMER_TEXT" ? 1 : 0)) 80 | .map((message) => ( 81 |
  • 88 | <> 89 | {message.text} 90 | 91 |
  • 92 | ))} 93 |
94 |
95 | )} 96 | {/*{(props.train.product === "ICE" ||*/} 97 | {/* props.train.product === "IC_EC" ||*/} 98 | {/* props.train.product === "RB") && (*/} 99 | {/* <>*/} 100 | {/*

Wagenreihung (Coming soon)

*/} 101 | {/* {number != null && (*/} 102 | {/* */} 108 | {/* )}*/} 109 | {/* */} 110 | {/*)}*/} 111 |
112 | ); 113 | } 114 | 115 | function TimeDisplay(props: { scheduledTime: string; time?: string }): JSX.Element { 116 | const isTooLate = props.time ? new Date(props.scheduledTime).getTime() < new Date(props.time).getTime() : undefined; 117 | const isTooEarly = props.time ? new Date(props.scheduledTime).getTime() > new Date(props.time).getTime() : undefined; 118 | 119 | const scheduledTime = new Date(props.scheduledTime.toString()); 120 | const time = props.time != null ? new Date(props.time.toString()) : undefined; 121 | 122 | const diffSeconds = ((time?.getTime() ?? 0) - scheduledTime.getTime()) / 1000; 123 | const diffMins = Math.floor(diffSeconds / 60); 124 | 125 | return ( 126 |
127 |
128 |

0 || diffMins < 0) 134 | ? "text-md text-white line-through" 135 | : "text-white" 136 | )} 137 | > 138 | {formatTime(scheduledTime)} 139 |

140 | {isTooLate && diffMins > 0 &&

(+{diffMins})

} 141 | {isTooEarly && diffMins < 0 &&

({diffMins})

} 142 |
143 | {time && ( 144 | <> 145 |
146 | {formatTime(time)} 147 |
148 | 149 | )} 150 |
151 | ); 152 | } 153 | -------------------------------------------------------------------------------- /src/components/station_board/elements/NameAndPlatformDisplay.tsx: -------------------------------------------------------------------------------- 1 | import clsx from "clsx"; 2 | import { StationBoardItem } from "../../../requests/custom/stationBoard"; 3 | import PlatformDisplay from "./PlatformDisplay"; 4 | 5 | export type NameDisplayProps = { 6 | trainData: StationBoardItem; 7 | }; 8 | 9 | export default function NameAndPlatformDisplay(props: NameDisplayProps): JSX.Element { 10 | const scheduledPlatform = props.trainData.platformScheduled; 11 | const platform = props.trainData.platformRealtime; 12 | 13 | return ( 14 |
15 |
16 | {props.trainData.category + " " + props.trainData.lineIndicator} 17 |
18 |
19 | 20 |
21 |
22 | ); 23 | } 24 | -------------------------------------------------------------------------------- /src/components/station_board/elements/NoticesDisplay.tsx: -------------------------------------------------------------------------------- 1 | import { BiErrorAlt } from "react-icons/bi"; 2 | import { StationBoardMessage } from "../../../requests/custom/stationBoard"; 3 | 4 | export type NoticesDisplayProps = { 5 | messages: StationBoardMessage[]; 6 | }; 7 | 8 | export default function NoticesDisplay(props: NoticesDisplayProps): JSX.Element { 9 | const uniqueMessages = props.messages.filter((element, index) => { 10 | return ( 11 | (element.messageStatus === "CauseOfDelay" || element.messageStatus === "QualityChange") && 12 | props.messages.findIndex((e) => e.id === element.id || e.matchedText === element.matchedText) === index 13 | ); 14 | }); 15 | 16 | return ( 17 | <> 18 | {uniqueMessages.length > 0 && ( 19 |
20 | Es sind Meldungen verfügbar 21 |
22 | )} 23 | 24 | ); 25 | } 26 | -------------------------------------------------------------------------------- /src/components/station_board/elements/PlatformDisplay.tsx: -------------------------------------------------------------------------------- 1 | import clsx from "clsx"; 2 | 3 | export default function PlatformDisplay(props: { scheduledPlatform?: string; platform?: string }) { 4 | const scheduledPlatform = props.scheduledPlatform; 5 | const platform = props.platform; 6 | 7 | const isDifferentPlatform = 8 | scheduledPlatform != null ? (platform != null ? scheduledPlatform !== platform : undefined) : undefined; 9 | 10 | return ( 11 | <> 12 | {scheduledPlatform != null && ( 13 |
14 |
15 |
16 |

Gl.

17 |
18 | {scheduledPlatform} 19 |
20 | {isDifferentPlatform === true && ( 21 | <> 22 |
{platform}
23 | 24 | )} 25 |
26 |
27 |
28 | )} 29 | 30 | ); 31 | } 32 | -------------------------------------------------------------------------------- /src/components/station_board/elements/StationsDisplay.tsx: -------------------------------------------------------------------------------- 1 | export type StationsDisplayProps = { 2 | originName: string; 3 | destinationName: string; 4 | }; 5 | 6 | export default function StationsDisplay(props: StationsDisplayProps): JSX.Element { 7 | return ( 8 |
9 |
10 | Von:

{props.originName}

11 |
12 |
13 | Nach: 14 |

{props.destinationName}

15 |
16 |
17 | ); 18 | } 19 | -------------------------------------------------------------------------------- /src/components/station_board/elements/TimeDisplay.tsx: -------------------------------------------------------------------------------- 1 | import clsx from "clsx"; 2 | import { formatTime } from "../../../utils/time"; 3 | 4 | export type TimeDisplayProps = { 5 | arrivalSchedule?: string; 6 | arrivalRealtime?: string; 7 | departureSchedule?: string; 8 | departureRealtime?: string; 9 | }; 10 | 11 | export default function TimeDisplay(props: TimeDisplayProps): JSX.Element { 12 | const scheduledArrival = props.arrivalSchedule; 13 | const actualArrival = props.arrivalRealtime; 14 | 15 | const scheduledDepart = props.departureSchedule; 16 | const actualDepart = props.departureRealtime; 17 | 18 | return ( 19 |
20 |
21 | {scheduledArrival && } 22 |
23 |
24 | {scheduledDepart && } 25 |
26 |
27 | ); 28 | } 29 | 30 | export function InternalTimeDisplay(props: { 31 | scheduledTime: string; 32 | time?: string; 33 | cancelled?: boolean; 34 | additional?: boolean; 35 | timeType?: string; 36 | }): JSX.Element { 37 | const isTooLate = props.time ? new Date(props.scheduledTime).getTime() < new Date(props.time).getTime() : undefined; 38 | const isTooEarly = props.time ? new Date(props.scheduledTime).getTime() > new Date(props.time).getTime() : undefined; 39 | 40 | const scheduledTime = new Date(props.scheduledTime.toString()); 41 | const time = props.time != null ? new Date(props.time.toString()) : undefined; 42 | 43 | const diffSeconds = ((time?.getTime() ?? 0) - scheduledTime.getTime()) / 1000; 44 | const diffMins = Math.floor(diffSeconds / 60); 45 | 46 | return ( 47 |
48 |
49 |

0 || diffMins < 0) && "text-sm line-through", 52 | props.cancelled && "text-red-300 line-through", 53 | props.additional && "text-green-300" 54 | )} 55 | > 56 | {formatTime(scheduledTime)} 57 |

58 | {isTooLate && diffMins > 0 &&

(+{diffMins})

} 59 | {isTooEarly && diffMins < 0 &&

({diffMins})

} 60 |
61 | {time && ( 62 | <> 63 |
0 67 | ? "text-red-500" 68 | : !props.cancelled 69 | ? "text-green-500" 70 | : "text-red-300 line-through", 71 | props.timeType === "REAL" && "font-bold", 72 | props.timeType === "SCHEDULE" && "italic" 73 | )} 74 | > 75 | {formatTime(time)} 76 |
77 | 78 | )} 79 |
80 | ); 81 | } 82 | -------------------------------------------------------------------------------- /src/components/station_board/filter/TransportTypeFilter.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import { Dispatch, Fragment, SetStateAction, useState } from "react"; 4 | import { Switch } from "@headlessui/react"; 5 | import Button from "../../ui/button/Button"; 6 | import { FaFilter } from "react-icons/fa"; 7 | import clsx from "clsx"; 8 | import { BiSelectMultiple } from "react-icons/bi"; 9 | import { FiXSquare } from "react-icons/fi"; 10 | import Popup from "../../ui/Popup"; 11 | 12 | export enum TransportType { 13 | HighspeedTrains = "HOCHGESCHWINDIGKEITSZUEGE", 14 | ICAndECTrains = "INTERCITYUNDEUROCITYZUEGE", 15 | InterregionalAndFastTrains = "INTERREGIOUNDSCHNELLZUEGE", 16 | RegionalAndOtherTrains = "NAHVERKEHRSONSTIGEZUEGE", 17 | SuburbanTrains = "SBAHNEN", 18 | Busses = "BUSSE", 19 | Boats = "SCHIFFE", 20 | Subway = "UBAHN", 21 | Tram = "STRASSENBAHN", 22 | CallRequiringTransportTypes = "ANRUFPFLICHTIGEVERKEHRE", 23 | } 24 | 25 | export const transportTypes = [ 26 | TransportType.HighspeedTrains, 27 | TransportType.ICAndECTrains, 28 | TransportType.InterregionalAndFastTrains, 29 | TransportType.RegionalAndOtherTrains, 30 | TransportType.SuburbanTrains, 31 | TransportType.Subway, 32 | TransportType.Tram, 33 | TransportType.Busses, 34 | TransportType.Boats, 35 | TransportType.CallRequiringTransportTypes, 36 | ]; 37 | 38 | export type TransportTypeFilterProps = { 39 | transportTypes: TransportType[]; 40 | setTransportTypes: Dispatch>; 41 | children?: React.ReactNode; 42 | }; 43 | 44 | export default function TransportTypeFilterButtonPopup(props: TransportTypeFilterProps) { 45 | const [isOpen, setIsOpen] = useState(false); 46 | 47 | return ( 48 | <> 49 | 52 | setIsOpen(false)} 54 | open={isOpen} 55 | setOpen={setIsOpen} 56 | title={"Verkehrsmittel"} 57 | className={"flex flex-col gap-4"} 58 | > 59 | 60 | 61 | 62 | ); 63 | } 64 | 65 | export function TransportTypeFilters(props: { 66 | transportTypes: TransportType[]; 67 | setTransportTypes: Dispatch>; 68 | }) { 69 | return ( 70 | <> 71 | {transportTypes.map((type) => { 72 | return ( 73 | 74 | 79 | 80 | ); 81 | })} 82 |
83 | 89 | 95 |
96 | 97 | ); 98 | } 99 | 100 | function TransportTypeToggle(props: TransportTypeFilterProps & { transportType: TransportType }) { 101 | const enabled = props.transportTypes.includes(props.transportType); 102 | 103 | return ( 104 |
105 | { 108 | if (value) { 109 | props.setTransportTypes((prevState) => prevState.concat(props.transportType)); 110 | } else { 111 | props.setTransportTypes((prevState) => prevState.filter((filter) => filter !== props.transportType)); 112 | } 113 | }} 114 | className={clsx( 115 | enabled ? "bg-violet-500" : "bg-zinc-900", 116 | "relative inline-flex h-6 w-11 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors", 117 | "duration 200 ease-in-out focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75" 118 | )} 119 | > 120 | {getReadableName(props.transportType)} 121 | 127 |

{getReadableName(props.transportType)}

128 |
129 | ); 130 | } 131 | 132 | export function getReadableName(transportType: TransportType): string { 133 | let readableName: string; 134 | switch (transportType) { 135 | case TransportType.HighspeedTrains: 136 | readableName = "Hochgeschwindigkeitszüge"; 137 | break; 138 | case TransportType.ICAndECTrains: 139 | readableName = "IC- & EC-Züge"; 140 | break; 141 | case TransportType.InterregionalAndFastTrains: 142 | readableName = "Interregionalzüge"; 143 | break; 144 | case TransportType.RegionalAndOtherTrains: 145 | readableName = "Nahverkehr & Sonstige Züge"; 146 | break; 147 | case TransportType.SuburbanTrains: 148 | readableName = "S-Bahn"; 149 | break; 150 | case TransportType.Tram: 151 | readableName = "Straßenbahn"; 152 | break; 153 | case TransportType.Subway: 154 | readableName = "U-Bahn"; 155 | break; 156 | case TransportType.Busses: 157 | readableName = "Busse"; 158 | break; 159 | case TransportType.Boats: 160 | readableName = "Schiffe"; 161 | break; 162 | case TransportType.CallRequiringTransportTypes: 163 | readableName = "Anrufpflichtige Verkehrsmittel"; 164 | break; 165 | } 166 | return readableName; 167 | } 168 | -------------------------------------------------------------------------------- /src/components/ui/PageTitle.tsx: -------------------------------------------------------------------------------- 1 | export function PageTitle(props: { title: string }) { 2 | return

{props.title}

; 3 | } 4 | -------------------------------------------------------------------------------- /src/components/ui/Popup.tsx: -------------------------------------------------------------------------------- 1 | import { Dialog, Transition } from "@headlessui/react"; 2 | import React, { Dispatch, Fragment, SetStateAction } from "react"; 3 | import { IoCloseOutline } from "react-icons/io5"; 4 | import clsx from "clsx"; 5 | 6 | export type PopupProps = { 7 | children: React.ReactNode; 8 | onClose?: () => void | undefined; 9 | open: boolean; 10 | setOpen: Dispatch>; 11 | title: React.ReactNode; 12 | className?: string; 13 | }; 14 | 15 | export default function Popup(props: PopupProps) { 16 | return ( 17 | 18 | props.setOpen(false))} 23 | > 24 | 33 |
34 | 35 |
36 |
37 | 46 | 49 | 50 | {props.title} 51 | 57 | 58 | 59 | {props.children} 60 | 61 | 62 | 63 |
64 |
65 |
66 |
67 | ); 68 | } 69 | -------------------------------------------------------------------------------- /src/components/ui/TabSelection.tsx: -------------------------------------------------------------------------------- 1 | import { Tab } from "@headlessui/react"; 2 | import clsx from "clsx"; 3 | 4 | export function TabSelection(props: { 5 | selection: string; 6 | icon: JSX.Element; 7 | disabled?: boolean; 8 | }) { 9 | return ( 10 | 12 | clsx( 13 | "w-full rounded-t-lg py-2.5 text-sm font-medium leading-5 transition-all", 14 | "ring-white focus:outline-none", 15 | selected && "bg-violet-700" 16 | ) 17 | } 18 | disabled={props.disabled ?? false} 19 | > 20 |
21 |
22 |
{props.icon}
23 | {props.selection} 24 |
25 |
26 |
27 | ); 28 | } 29 | -------------------------------------------------------------------------------- /src/components/ui/button/Button.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import { ButtonHTMLAttributes, DetailedHTMLProps } from "react"; 4 | import clsx from "clsx"; 5 | 6 | export default function Button(props: DetailedHTMLProps, HTMLButtonElement>) { 7 | return ( 8 | 18 | ); 19 | } 20 | -------------------------------------------------------------------------------- /src/components/ui/button/GoBackButton.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import { ImArrowLeft2 } from "react-icons/im"; 4 | import React from "react"; 5 | import Button from "../../../components/ui/button/Button"; 6 | import { useRouter } from "next/navigation"; 7 | 8 | export default function GoBackButton(props: { className?: string }) { 9 | const router = useRouter(); 10 | 11 | return ( 12 | 25 | ); 26 | } 27 | -------------------------------------------------------------------------------- /src/components/ui/button/ShareButton.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import { ImShare2 } from "react-icons/im"; 4 | import React, { ButtonHTMLAttributes, DetailedHTMLProps, useEffect, useState } from "react"; 5 | import Button from "../../../components/ui/button/Button"; 6 | 7 | export default function ShareButton( 8 | props: DetailedHTMLProps, HTMLButtonElement> & { size?: number } 9 | ) { 10 | const [hidden, setHidden] = useState(true); 11 | 12 | useEffect(() => { 13 | setHidden(typeof navigator !== "undefined" && navigator.share == null); 14 | }, []); 15 | 16 | return ( 17 | 21 | ); 22 | } 23 | -------------------------------------------------------------------------------- /src/middleware.ts: -------------------------------------------------------------------------------- 1 | import { NextRequest, NextResponse } from "next/server"; 2 | import { Share } from "./pages/api/share"; 3 | import { getBaseUrl } from "./server/base-url"; 4 | import { redis } from "./server/redis"; 5 | 6 | export async function middleware(request: NextRequest) { 7 | const id = request.nextUrl.pathname.substring(3); 8 | const share = await redis.get(id); 9 | const result = Share.safeParse(share); 10 | if (result.success) { 11 | let url; 12 | switch (result.data.type) { 13 | case "station": 14 | const timestamp = result.data.timestamp; 15 | url = `/station/${result.data.eva}/${timestamp || Date.now()}`; 16 | break; 17 | case "journey": 18 | url = `/journey/${encodeURIComponent(result.data.journeyId)}`; 19 | break; 20 | } 21 | const baseUrl = getBaseUrl(true, request.nextUrl.host); 22 | return NextResponse.redirect(`${baseUrl}${url}`); 23 | } 24 | } 25 | 26 | export const config = { 27 | matcher: ["/s/:id/"], 28 | }; 29 | -------------------------------------------------------------------------------- /src/pages/api/share.ts: -------------------------------------------------------------------------------- 1 | import { customAlphabet } from "nanoid"; 2 | import { alphanumeric } from "nanoid-dictionary"; 3 | import { NextApiRequest, NextApiResponse } from "next"; 4 | import { z } from "zod"; 5 | import { getBaseUrl } from "../../server/base-url"; 6 | import { redis } from "../../server/redis"; 7 | 8 | export const Share = z.discriminatedUnion("type", [ 9 | z.object({ 10 | type: z.literal("station"), 11 | eva: z.string(), 12 | timestamp: z.number().int().optional(), 13 | }), 14 | z.object({ 15 | type: z.literal("journey"), 16 | journeyId: z.string(), 17 | }), 18 | ]); 19 | 20 | export default async function handler( 21 | req: NextApiRequest, 22 | res: NextApiResponse 23 | ) { 24 | if (req.method !== "POST") { 25 | return res.end(405); 26 | } 27 | 28 | const result = Share.safeParse(req.body); 29 | if (!result.success) { 30 | const formatted = result.error.format(); 31 | return res.status(400).json(formatted); 32 | } 33 | 34 | const share = result.data; 35 | 36 | const id = generateShareId(); 37 | const shareData = { 38 | id, 39 | ...share, 40 | }; 41 | await redis.setex(id, 60 * 60 * 24 * 30 /* one month */, shareData); 42 | 43 | const baseUrl = getBaseUrl(true, req.headers.host); 44 | 45 | return res.status(200).json({ 46 | url: `${baseUrl}/s/${id}`, 47 | }); 48 | } 49 | 50 | const nanoid = customAlphabet(alphanumeric); 51 | 52 | function generateShareId() { 53 | return nanoid(10); 54 | } 55 | -------------------------------------------------------------------------------- /src/requests/coach_sequence/coach_sequence.ts: -------------------------------------------------------------------------------- 1 | export type CoachSequence = { 2 | data: { 3 | istformation: CoachSequenceData; 4 | }; 5 | }; 6 | 7 | export type CoachSequenceData = { 8 | fahrtrichtung: string; 9 | allFahrzeuggruppe: CoachSequenceVehicle[]; 10 | halt: CoachSequenceStop; 11 | liniebezeichnung: string; 12 | zuggattung: string; 13 | zugnummer: string; 14 | serviceid: string; 15 | planstarttag: string; 16 | fahrtid: string; 17 | istplaninformation: boolean; 18 | }; 19 | 20 | export type CoachSequenceVehicle = { 21 | allFahrzeug: CoachSequenceVehicleCoach[]; 22 | fahrzeuggruppebezeichnung: string; 23 | zielbetriebsstellename: string; 24 | startbetriebsstellename: string; 25 | verkehrlichezugnummer: string; 26 | }; 27 | 28 | export type CoachSequenceVehicleCoach = { 29 | allFahrzeugausstattung: CoachSequenceCoachFeature[]; 30 | kategorie: string; 31 | fahrzeugnummer: string; 32 | orientierung: string; 33 | positioningruppe: string; 34 | fahrzeugsektor: string; 35 | fahrzeugtyp: string; 36 | wagenordnungsnummer: string; 37 | positionamhalt: CoachSequencePlatformPosition; 38 | status: string; 39 | }; 40 | 41 | export type CoachSequenceCoachFeature = { 42 | anzahl: string; 43 | ausstattungsart: string; 44 | bezeichnung: string; 45 | status: string; 46 | }; 47 | 48 | export type CoachSequenceStop = { 49 | abfahrtszeit: string; 50 | ankunftszeit: string; 51 | bahnhofsname: string; 52 | evanummer: string; 53 | gleisbezeichnung: string; 54 | haltid: string; 55 | rl100: string; 56 | allSektor: CoachSequenceSector[]; 57 | }; 58 | 59 | export type CoachSequenceSector = { 60 | positionamgleis: CoachSequencePlatformPosition; 61 | sektorbezeichnung: string; 62 | }; 63 | 64 | export type CoachSequencePlatformPosition = { 65 | startmeter: string; 66 | startprozent: string; 67 | endemeter: string; 68 | endeprozent: string; 69 | }; 70 | 71 | export default async function coachSequence( 72 | lineNumber: string, 73 | time: string 74 | ): Promise { 75 | const reponse = await fetch( 76 | `https://www.apps-bahn.de/wr/wagenreihung/1.0/${lineNumber}/${time}`, 77 | { 78 | method: "GET", 79 | next: { 80 | revalidate: 90, 81 | }, 82 | } 83 | ); 84 | 85 | return reponse.json(); 86 | } 87 | -------------------------------------------------------------------------------- /src/requests/custom/stationBoard.ts: -------------------------------------------------------------------------------- 1 | import dayjs from "dayjs"; 2 | import { getApiBaseUrl } from "../get_base_url"; 3 | 4 | export type StationBoard = { 5 | eva: string; 6 | name: string; 7 | timeStart: string; 8 | timeEnd: string; 9 | items: StationBoardItem[]; 10 | }; 11 | 12 | export type StationBoardItem = { 13 | risId?: string; 14 | irisId?: string; 15 | 16 | stationEva: string; 17 | stationName: string; 18 | 19 | category: string; 20 | trainType: string; 21 | trainNumber: number; 22 | lineIndicator: string; 23 | 24 | cancelled: boolean; 25 | 26 | arrival?: DepartureArrival; 27 | departure?: DepartureArrival; 28 | 29 | platformScheduled?: string; 30 | platformRealtime?: string; 31 | 32 | originEva?: string; 33 | originName: string; 34 | destinationEva?: string; 35 | destinationName: string; 36 | 37 | administation?: StationBoardItemAdministration; 38 | 39 | additionalInfo?: IrisInformation; 40 | }; 41 | 42 | export type IrisInformation = { 43 | irisId: string; 44 | replaces?: string; 45 | route: RouteStop[]; 46 | messages: StationBoardMessage[]; 47 | }; 48 | 49 | export type StationBoardItemAdministration = { 50 | id: string; 51 | operatorCode: string; 52 | operatorName: string; 53 | risOperatorName: string; 54 | }; 55 | 56 | export type DepartureArrival = { 57 | timeScheduled: string; 58 | timeRealtime: string; 59 | timeType: string; 60 | 61 | wings: string[]; 62 | }; 63 | 64 | export type StationBoardMessage = { 65 | id: string; 66 | timestamp: string; 67 | /// The message code (e.G. `59` for `Schnee und Eis`) 68 | code?: number; 69 | /// The matched text from the message code (e.G. `Schnee und Eis` when code is `95`) 70 | matchedText?: string; 71 | category?: string; 72 | validFrom?: string; 73 | validTo?: string; 74 | messageStatus: 75 | | "HafasInformationManager" 76 | | "QualityChange" 77 | | "Free" 78 | | "CauseOfDelay" 79 | | "Ibis" 80 | | "UnassignedIbis" 81 | | "Disruption" 82 | | "Connection"; 83 | priority?: "high" | "medium" | "low" | "done"; 84 | }; 85 | 86 | export type RouteStop = { 87 | name: string; 88 | cancelled: boolean; 89 | added: boolean; 90 | }; 91 | 92 | export async function stationBoard( 93 | eva: string, 94 | date: dayjs.Dayjs, 95 | lookbehind?: number, 96 | lookahead?: number 97 | ): Promise { 98 | let start = date.subtract(lookbehind ?? 5, "minutes").second(0); 99 | let end = date.add(lookahead ?? 180, "minutes").second(0); 100 | 101 | if (start.minute() % 5 !== 0) { 102 | start = start.minute(start.minute() - (start.minute() % 5)); 103 | } 104 | 105 | if (end.minute() % 5 !== 0) { 106 | end = end.minute(end.minute() - (end.minute() % 5)); 107 | } 108 | 109 | const timeStart = encodeURIComponent(start.toISOString()); 110 | 111 | const timeEnd = encodeURIComponent(end.toISOString()); 112 | 113 | const url = `${getApiBaseUrl()}/v1/station_board/${eva}?timeStart=${timeStart}&timeEnd=${timeEnd}`; 114 | 115 | const response = await fetch(url, { 116 | method: "GET", 117 | next: { 118 | revalidate: 30, 119 | }, 120 | }); 121 | 122 | if (!response.ok) { 123 | throw new Error(`Failed to fetch station board (${url}) : ${await response.text()}`); 124 | } 125 | 126 | return response.json(); 127 | } 128 | -------------------------------------------------------------------------------- /src/requests/get_base_url.ts: -------------------------------------------------------------------------------- 1 | export function getApiBaseUrl() { 2 | const env = process.env.API_BASE_URL; 3 | if (env) { 4 | return env; 5 | } 6 | 7 | return "https://api.rail.boecker.dev"; 8 | } 9 | -------------------------------------------------------------------------------- /src/requests/ris/journeyDetails.ts: -------------------------------------------------------------------------------- 1 | import { getApiBaseUrl } from "../get_base_url"; 2 | 3 | export default async function journeyDetails(id: string): Promise { 4 | const rawResponse = await fetch(`${getApiBaseUrl()}/ris/v1/journey_details/${id}`, { 5 | method: "GET", 6 | next: { 7 | revalidate: 60, 8 | }, 9 | }); 10 | 11 | return rawResponse.json(); 12 | } 13 | 14 | export type RisJourneyDetails = { 15 | id: string; 16 | journeyType: string; 17 | originName: string; 18 | originId: string; 19 | destinationName: string; 20 | destinationId: string; 21 | cancelled: boolean; 22 | stops: RisJourneyStop[]; 23 | }; 24 | 25 | export type RisJourneyStop = { 26 | stopId: string; 27 | stopName: string; 28 | 29 | arrival?: JourneyStopEvent; 30 | 31 | departure?: JourneyStopEvent; 32 | messages: JourneyDetailsMessage[]; 33 | disruptions: JourneyStopDisruption[]; 34 | 35 | transport: Transport; 36 | 37 | scheduledPlatform?: string; 38 | 39 | realPlatform?: string; 40 | administration: JourneyStopAdministration; 41 | }; 42 | 43 | export type JourneyStopEvent = { 44 | cancelled: boolean; 45 | additional: boolean; 46 | onDemand: boolean; 47 | scheduled: string; 48 | realtime?: string; 49 | timeType: string; 50 | }; 51 | 52 | export type JourneyStopAdministration = { 53 | id: string; 54 | name: string; 55 | operatorCode: string; 56 | risName: string; 57 | }; 58 | 59 | export type JourneyDetailsMessage = { 60 | code?: string; 61 | type: string; 62 | displayPriority?: number; 63 | category?: string; 64 | text: string; 65 | textShort?: string; 66 | }; 67 | 68 | export type JourneyStopDisruption = { 69 | id: string; 70 | communicationId?: string; 71 | priority: number; 72 | text: string; 73 | textShort?: string; 74 | }; 75 | 76 | export type Transport = { 77 | type: string; 78 | category: string; 79 | number: number; 80 | line?: string; 81 | label?: string; 82 | replacementTransport?: string; 83 | }; 84 | -------------------------------------------------------------------------------- /src/requests/ris/journeySearch.ts: -------------------------------------------------------------------------------- 1 | import dayjs from "dayjs"; 2 | import { getApiBaseUrl } from "../get_base_url"; 3 | 4 | export type RisJourneySearchElement = { 5 | journeyID: string; 6 | date: string; 7 | administrationID: string; 8 | originSchedule: RisJourneySearchSchedule; 9 | destinationSchedule: RisJourneySearchSchedule; 10 | transport: RisJourneySearchTransport; 11 | }; 12 | 13 | export type RisJourneySearchSchedule = { 14 | evaNumber: string; 15 | name: string; 16 | }; 17 | 18 | export type RisJourneySearchTransport = { 19 | type: string; 20 | category: string; 21 | number: number; 22 | line?: string; 23 | label?: string; 24 | replacementTransport?: string; 25 | }; 26 | 27 | export default function journeySearch( 28 | category: string, 29 | number: string, 30 | date: dayjs.Dayjs 31 | ): Promise { 32 | 33 | 34 | const response = fetch( 35 | `${getApiBaseUrl()}/ris/v1/journey_search/${category}/${encodeURIComponent(number)}?date=${date.format("YYYY-MM-DD")}` 36 | ).then((response) => response.json()); 37 | 38 | console.log(response); 39 | 40 | return response; 41 | } 42 | -------------------------------------------------------------------------------- /src/requests/ris/stationInformation.ts: -------------------------------------------------------------------------------- 1 | import { getApiBaseUrl } from "../get_base_url"; 2 | 3 | export type StationInformation = { 4 | eva: string; 5 | stationId?: string; 6 | names: StationNameContent; 7 | metropolis?: string; 8 | availableTransports: string[]; 9 | transportAssociations: string[]; 10 | countryCode: string; 11 | state: string; 12 | municipalityKey: string; 13 | timeZone: string; 14 | position: Position; 15 | }; 16 | 17 | export type StationNameContent = { 18 | nameLong: string; 19 | speechLong?: string; 20 | speechShort?: string; 21 | }; 22 | 23 | export type Position = { 24 | longitude: number; 25 | latitude: number; 26 | }; 27 | 28 | export async function stationInformation(eva: string): Promise { 29 | const response = await fetch(`${getApiBaseUrl()}/ris/v1/station/${eva}`, { 30 | method: "GET", 31 | }); 32 | 33 | return response.json(); 34 | } 35 | -------------------------------------------------------------------------------- /src/requests/ris/stationSearch.ts: -------------------------------------------------------------------------------- 1 | import { getApiBaseUrl } from "../get_base_url"; 2 | 3 | export type StationSearchResponse = { 4 | availableTransports: string[]; 5 | evaNumber: string; 6 | groupMembers: string[]; 7 | names: { 8 | DE: { 9 | nameLong: string; 10 | speechLong: string; 11 | speechShort: string; 12 | symbol: string; 13 | }; 14 | }; 15 | position: { 16 | latitude: 0; 17 | longitude: 0; 18 | }; 19 | stationID: "string"; 20 | }[]; 21 | 22 | // const getBaseUrl = () => { 23 | // if (typeof window !== "undefined") return ""; // browser should use relative url 24 | // if (process.env.VERCEL_URL) return `https://${process.env.VERCEL_URL}`; // SSR should use vercel url 25 | // return `http://localhost:${process.env.PORT ?? 3000}`; // dev SSR should use localhost 26 | // }; 27 | 28 | export default async function searchStation(query: string, limit: number = 10): Promise { 29 | const response = await fetch(`${getApiBaseUrl()}/ris/v1/station_search/${encodeURIComponent(query)}?limit=${limit}`, { 30 | method: "GET", 31 | }); 32 | 33 | return response.json(); 34 | } 35 | -------------------------------------------------------------------------------- /src/server/base-url.ts: -------------------------------------------------------------------------------- 1 | export function getBaseUrl( 2 | includeProtocol = true, 3 | host: string | undefined = undefined 4 | ): string { 5 | if (process.env.NODE_ENV === "production") { 6 | return `${includeProtocol ? "https://" : ""}${ 7 | host ?? process.env.VERCEL_URL 8 | }`; 9 | } else { 10 | return `${includeProtocol ? "http://" : ""}localhost:${ 11 | process.env.PORT || 3000 12 | }`; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/server/redis.ts: -------------------------------------------------------------------------------- 1 | import { Redis } from "@upstash/redis"; 2 | 3 | function createRedis() { 4 | const url = process.env.UPSTASH_REDIS_REST_URL; 5 | if (!url) { 6 | throw "UPSTASH_REDIS_REST_URL is not set!"; 7 | } 8 | const token = process.env.UPSTASH_REDIS_REST_TOKEN; 9 | if (!token) { 10 | throw "UPSTASH_REDIS_REST_TOKEN is not set!"; 11 | } 12 | return new Redis({ 13 | url, 14 | token, 15 | }); 16 | } 17 | 18 | export const redis = createRedis(); 19 | -------------------------------------------------------------------------------- /src/utils/async_component_fix.ts: -------------------------------------------------------------------------------- 1 | export function asyncComponent( 2 | fn: (arg: T) => Promise 3 | ): (arg: T) => R { 4 | return fn as (arg: T) => R; 5 | } 6 | -------------------------------------------------------------------------------- /src/utils/favourites.ts: -------------------------------------------------------------------------------- 1 | export default interface Favourite { 2 | name: string; 3 | evaNr: string; 4 | } 5 | -------------------------------------------------------------------------------- /src/utils/share.ts: -------------------------------------------------------------------------------- 1 | import { z } from "zod"; 2 | import { Share } from "../pages/api/share"; 3 | 4 | type ShareData = z.infer; 5 | 6 | export async function createShare(share: ShareData): Promise { 7 | const response = await fetch("/api/share", { 8 | method: "POST", 9 | body: JSON.stringify(share), 10 | headers: { 11 | "Content-Type": "application/json", 12 | }, 13 | }); 14 | if (!response.ok) { 15 | throw "Failed to create a share link."; 16 | } 17 | const json = await response.json(); 18 | return json.url; 19 | } 20 | -------------------------------------------------------------------------------- /src/utils/time.ts: -------------------------------------------------------------------------------- 1 | export function formatTime(date: Date) { 2 | const hours = date.getHours().toString().padStart(2, "0"); 3 | const minutes = date.getMinutes().toString().padStart(2, "0"); 4 | return `${hours}:${minutes}`; 5 | } 6 | -------------------------------------------------------------------------------- /tailwind.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('tailwindcss').Config} */ 2 | module.exports = { 3 | content: ["./src/**/*.{js,ts,jsx,tsx}"], 4 | theme: { 5 | extend: { 6 | screens: { 7 | xsm: "325px", 8 | }, 9 | }, 10 | fontFamily: { 11 | sans: ["Ubuntu", "Roboto", "Open Sans", "ui-sans-serif", "system-ui", "sans-serif"], 12 | }, 13 | }, 14 | plugins: [require("@tailwindcss/typography")], 15 | }; 16 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "esnext", 4 | "lib": ["dom", "dom.iterable", "esnext"], 5 | "allowJs": true, 6 | "skipLibCheck": true, 7 | "strict": true, 8 | "forceConsistentCasingInFileNames": true, 9 | "noEmit": true, 10 | "esModuleInterop": true, 11 | "module": "esnext", 12 | "moduleResolution": "node", 13 | "resolveJsonModule": true, 14 | "isolatedModules": true, 15 | "jsx": "preserve", 16 | "incremental": true, 17 | "noUncheckedIndexedAccess": true, 18 | "plugins": [ 19 | { 20 | "name": "next" 21 | } 22 | ] 23 | }, 24 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "**/*.cjs", "**/*.js", "**/*.mjs", ".next/types/**/*.ts"], 25 | "exclude": ["node_modules"] 26 | } 27 | -------------------------------------------------------------------------------- /vercel.json: -------------------------------------------------------------------------------- 1 | { 2 | "github": { 3 | "silent": true 4 | } 5 | } 6 | --------------------------------------------------------------------------------