Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Debug client dynamic arguments #6370

Draft
wants to merge 21 commits into
base: dev-2.x
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
0440bac
Restructuring of the layout of the UI. Moved generated arguments to l…
a-limyr Dec 16, 2024
3e74e7e
Forgotten fil
a-limyr Dec 16, 2024
79cac16
Nested arguments, list arguments, layout changes, reset button, exclu…
a-limyr Jan 8, 2025
821ec06
Merge branch 'dev-2.x' into debug-client-dynamic-arguments
a-limyr Jan 9, 2025
a994a51
Nested arguments, list arguments, layout changes, reset button, exclu…
a-limyr Jan 9, 2025
c25fab8
Fixed some styling
a-limyr Jan 9, 2025
df84af5
Fixed some styling
a-limyr Jan 15, 2025
3e1abad
Fixed any type issues + some other things.
a-limyr Jan 15, 2025
c280d67
Merge branch 'dev-2.x' into debug-client-dynamic-arguments
a-limyr Jan 15, 2025
46a094f
Keeping code up to date.
a-limyr Jan 15, 2025
fe18de1
Refactoring to remove use of "any" types.
a-limyr Jan 21, 2025
71f4b71
Merge branch 'dev-2.x' into debug-client-dynamic-arguments
a-limyr Jan 21, 2025
288d85e
Removed some debug statements and removed use of one any usage.
a-limyr Jan 21, 2025
293339e
Changed logic to avoid generics with any.
a-limyr Jan 21, 2025
bbf8655
Fix React Hook useEffect warning and Fast refresh warning
a-limyr Jan 21, 2025
4dc1a14
Refactor to avoid warning and a bit of clean-up.
a-limyr Jan 22, 2025
bc9edc2
Refactor to avoid warning and a bit of clean-up.
a-limyr Jan 22, 2025
64e6e41
Refactor to make eslint happy
a-limyr Jan 22, 2025
d448c8b
Merge branch 'dev-2.x' into debug-client-dynamic-arguments
a-limyr Jan 22, 2025
0b4f5d5
Some changes to formatting and a bit other minor changes.
a-limyr Jan 22, 2025
1cf9024
Updates to ignore prettier formatting of generated file.
a-limyr Jan 22, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions 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: 'https://otp2debug.dev.entur.org/otp/transmodel/v3/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
38 changes: 38 additions & 0 deletions client/src/components/MapView/DebugLayerButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import debugLayerIcon from '../../static/img/debug-layer.svg';

import { useState } from 'react';

type DebugLayerButtonProps = {
onToggle: (isExpanded: boolean) => void;
};

export default function DebugLayerButton({ onToggle }: DebugLayerButtonProps) {
const [isExpanded, setIsExpanded] = useState(false);

const handleClick = () => {
const nextState = !isExpanded;
setIsExpanded(nextState);
onToggle(nextState); // Notify parent of the state change
};

return (
<button
style={{
cursor: 'pointer',
border: 'none',
background: 'none',
textAlign: 'left',
width: '100%',
padding: '0',
margin: '0',
}}
onClick={handleClick}
>
{isExpanded ? (
<span style={{ fontWeight: 'bold' }}>Debug Layers</span>
) : (
<img src={debugLayerIcon} alt="Debug layer" title="Debug layer" style={{ width: '25px', height: '25px' }} />
)}
</button>
);
}
Loading
Loading