Skip to content

Commit

Permalink
Merge pull request #6370 from entur/debug-client-dynamic-arguments
Browse files Browse the repository at this point in the history
Add all routing parameters to debug UI
  • Loading branch information
leonardehrenfried authored Jan 23, 2025
2 parents 28bdf41 + 131f301 commit 1a86905
Show file tree
Hide file tree
Showing 45 changed files with 2,537 additions and 398 deletions.
1 change: 1 addition & 0 deletions client/.prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules/
output/
src/gql/
src/static/query/tripQuery.tsx
16 changes: 16 additions & 0 deletions client/codegen-preprocess.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import type { CodegenConfig } from '@graphql-codegen/cli';

import * as path from 'node:path';

const config: CodegenConfig = {
overwrite: true,
schema: '../application/src/main/resources/org/opentripplanner/apis/transmodel/schema.graphql',
documents: 'src/**/*.{ts,tsx}',
generates: {
'src/static/query/tripQuery.tsx': {
plugins: [path.resolve(__dirname, './src/util/generate-queries.cjs')],
},
},
};

export default config;
294 changes: 250 additions & 44 deletions client/package-lock.json

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
"preview": "vite preview",
"prebuild": "npm run codegen && npm run lint && npm run check-format",
"predev": "npm run codegen",
"codegen-preprocess": "graphql-codegen --config codegen-preprocess.ts",
"precodegen": "npm run codegen-preprocess",
"codegen": "graphql-codegen --config codegen.ts"
},
"dependencies": {
Expand All @@ -26,7 +28,8 @@
"react": "19.0.0",
"react-bootstrap": "2.10.7",
"react-dom": "19.0.0",
"react-map-gl": "7.1.8"
"react-map-gl": "7.1.8",
"react-select": "5.9.0"
},
"devDependencies": {
"@eslint/compat": "1.2.5",
Expand Down
73 changes: 40 additions & 33 deletions client/src/components/ItineraryList/ItineraryListContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,39 +26,46 @@ export function ItineraryListContainer({
const timeZone = useContext(TimeZoneContext);

return (
<section className="itinerary-list-container below-content" ref={containerRef}>
<ItineraryPaginationControl
onPagination={pageResults}
previousPageCursor={tripQueryResult?.trip.previousPageCursor}
nextPageCursor={tripQueryResult?.trip.nextPageCursor}
loading={loading}
/>
<Accordion
activeKey={`${selectedTripPatternIndex}`}
onSelect={(eventKey) => setSelectedTripPatternIndex(parseInt(eventKey as string))}
>
{tripQueryResult &&
tripQueryResult.trip.tripPatterns.map((tripPattern, itineraryIndex) => (
<Accordion.Item
eventKey={`${itineraryIndex}`}
key={`${itineraryIndex}`}
bsPrefix={tripPattern.systemNotices.length === 0 ? '' : 'accordion-item-filtered'}
>
<Accordion.Header>
<ItineraryHeaderContent
containerWidth={containerWidth}
tripPattern={tripPattern}
itineraryIndex={itineraryIndex}
earliestStartTime={earliestStartTime}
latestEndTime={latestEndTime}
/>
</Accordion.Header>
<Accordion.Body>
<ItineraryDetails tripPattern={tripPattern} />
</Accordion.Body>
</Accordion.Item>
))}
</Accordion>
<section className="left-pane-container below-content" ref={containerRef}>
<>
<div className="panel-header">Itinerary results</div>
<div className="pagination-controls">
<ItineraryPaginationControl
onPagination={pageResults}
previousPageCursor={tripQueryResult?.trip.previousPageCursor}
nextPageCursor={tripQueryResult?.trip.nextPageCursor}
loading={loading}
/>
</div>
<Accordion
activeKey={`${selectedTripPatternIndex}`}
onSelect={(eventKey) => setSelectedTripPatternIndex(parseInt(eventKey as string))}
>
{tripQueryResult &&
tripQueryResult.trip.tripPatterns.map((tripPattern, itineraryIndex) => (
<Accordion.Item
eventKey={`${itineraryIndex}`}
key={`${itineraryIndex}`}
bsPrefix={tripPattern.systemNotices.length === 0 ? '' : 'accordion-item-filtered'}
>
<Accordion.Header>
<ItineraryHeaderContent
containerWidth={containerWidth}
tripPattern={tripPattern}
itineraryIndex={itineraryIndex}
earliestStartTime={earliestStartTime}
latestEndTime={latestEndTime}
/>
</Accordion.Header>
<Accordion.Body>
<ItineraryDetails tripPattern={tripPattern} />
</Accordion.Body>
</Accordion.Item>
))}
</Accordion>
</>

{/* Time Zone Info */}
<div className="time-zone-info">
All times in <code>{timeZone}</code>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export function ItineraryPaginationControl({
loading: boolean;
}) {
return (
<div style={{ display: 'flex', justifyContent: 'space-evenly', margin: '1rem 0 ' }}>
<div style={{ display: 'flex', justifyContent: 'space-evenly' }}>
<Button
variant="outline-primary"
size="sm"
Expand Down
Loading

0 comments on commit 1a86905

Please sign in to comment.