Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 14, 2025

Line width values were hardcoded as 5 throughout line style components, preventing centralized adjustments.

Changes

  • Exported LINE_WIDTH = 5 constant from src/constants/lines.ts
  • Updated 23 line style components to import and use the constant:
    • Direct references: strokeWidth="5"strokeWidth={LINE_WIDTH}
    • Derived values: strokeWidth="2.5"strokeWidth={LINE_WIDTH / 2}
    • Related attributes: strokeDasharray, marker dimensions
  • Removed duplicate local constant in jr-east-single-color-pattern.tsx

Example

// Before
<path d={path} stroke={color[2]} strokeWidth="5" />

// After
import { LINE_WIDTH } from '../../../../constants/lines';
<path d={path} stroke={color[2]} strokeWidth={LINE_WIDTH} />

All line width calculations now derive from a single source, enabling automatic recalculation across the application.

Original prompt

This section details on the original issue you should resolve

<issue_title>Export const LINE_WIDTH = 5</issue_title>
<issue_description>So everything related to line width could be auto-recalculated :)

Only files under `src\components\svgs\lines\styles\ should be updated.

Most of the values 5 that need to be updated are strokeWidth.

The const LINE_WIDTH should be in src\constants\lines.ts.
</issue_description>

<agent_instructions>Just replace the hard coded 5 with LINE_WIDTH constant</agent_instructions>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Export const LINE_WIDTH and update strokeWidth values Export LINE_WIDTH constant for centralized line width management Dec 14, 2025
Copilot AI requested a review from thekingofcity December 14, 2025 08:06
@thekingofcity thekingofcity marked this pull request as ready for review December 14, 2025 08:58
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR centralizes line width management by exporting a LINE_WIDTH = 5 constant from src/constants/lines.ts and updating 23 line style components to use it. This enables automatic recalculation of all line width-related values if the constant changes in the future, improving maintainability.

Key Changes:

  • Exported LINE_WIDTH constant for centralized line width management
  • Updated strokeWidth attributes from hardcoded "5" to {LINE_WIDTH}
  • Updated derived values (e.g., "2.5"{LINE_WIDTH / 2})
  • Removed duplicate local LINE_WIDTH constant from jr-east-single-color-pattern.tsx

Reviewed changes

Copilot reviewed 24 out of 24 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/constants/lines.ts Exports LINE_WIDTH = 5 constant for centralized line width management
src/components/svgs/lines/styles/single-color.tsx Replaced hardcoded strokeWidth="5" with LINE_WIDTH
src/components/svgs/lines/styles/shanghai-suburban-railway.tsx Replaced hardcoded strokeWidth="5" with LINE_WIDTH
src/components/svgs/lines/styles/mtr-race-day.tsx Replaced strokeWidth="5" with LINE_WIDTH and updated strokeDasharray to use LINE_WIDTH
src/components/svgs/lines/styles/mtr-light-rail.tsx Replaced strokeWidth="2.5" with LINE_WIDTH / 2
src/components/svgs/lines/styles/mrt-under-construction.tsx Replaced hardcoded strokeWidth="5" with LINE_WIDTH
src/components/svgs/lines/styles/mrt-tape-out.tsx Updated strokeWidth, marker dimensions, and polygon points to use LINE_WIDTH
src/components/svgs/lines/styles/mrt-sentosa-express.tsx Replaced strokeWidth="5" with LINE_WIDTH and updated strokeDasharray calculations
src/components/svgs/lines/styles/london-tube-terminal.tsx Replaced hardcoded strokeWidth="5" with LINE_WIDTH
src/components/svgs/lines/styles/london-tube-internal-int.tsx Replaced strokeWidth="2.5" with LINE_WIDTH / 2
src/components/svgs/lines/styles/london-tube-10-min-walk.tsx Replaced strokeWidth="5" with LINE_WIDTH and updated strokeDasharray
src/components/svgs/lines/styles/london-sandwich.tsx Replaced hardcoded strokeWidth="5" with LINE_WIDTH
src/components/svgs/lines/styles/london-rail.tsx Updated multiple strokeWidth values to use LINE_WIDTH with appropriate multipliers
src/components/svgs/lines/styles/london-ifs-could-cable-car.tsx Replaced all three strokeWidth values with LINE_WIDTH-based expressions
src/components/svgs/lines/styles/london-DART.tsx Replaced hardcoded strokeWidth="5" with LINE_WIDTH
src/components/svgs/lines/styles/jr-east-single-color.tsx Replaced strokeWidth values with LINE_WIDTH + 0.1 and LINE_WIDTH - 0.1
src/components/svgs/lines/styles/jr-east-single-color-pattern.tsx Removed duplicate local LINE_WIDTH constant, now uses imported constant
src/components/svgs/lines/styles/guangdong-intercity-railway.tsx Replaced strokeWidth="5" with LINE_WIDTH and strokeWidth="2.5" with LINE_WIDTH / 2
src/components/svgs/lines/styles/dual-color.tsx Replaced both strokeWidth="2.5" occurrences with LINE_WIDTH / 2
src/components/svgs/lines/styles/china-railway.tsx Replaced strokeWidth="5" with LINE_WIDTH and updated dependent calculation
src/components/svgs/lines/styles/chengdurt-outside-fare-gates.tsx Replaced strokeWidth="5" with LINE_WIDTH and updated strokeDasharray
src/components/svgs/lines/styles/bjsubway-tram.tsx Replaced hardcoded strokeWidth="5" with LINE_WIDTH
src/components/svgs/lines/styles/bjsubway-single-color.tsx Replaced hardcoded strokeWidth="5" with LINE_WIDTH
src/components/svgs/lines/styles/bjsubway-dotted.tsx Replaced hardcoded strokeWidth="5" with LINE_WIDTH
Comments suppressed due to low confidence (1)

src/components/svgs/lines/styles/london-DART.tsx:35

  • The hardcoded strokeWidth="3" should be expressed in terms of LINE_WIDTH for consistency. This is 0.6 times LINE_WIDTH, so it should be strokeWidth={LINE_WIDTH * 0.6} or strokeWidth={(LINE_WIDTH / 5) * 3}.
            <path
                d={path}
                fill="none"
                stroke={color[3]}
                strokeWidth="3"
                strokeLinecap="round"
                strokeDasharray="0.001 6"

Copy link
Member

@thekingofcity thekingofcity left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@thekingofcity thekingofcity changed the title Export LINE_WIDTH constant for centralized line width management #566 Export LINE_WIDTH constant Dec 14, 2025
@thekingofcity thekingofcity merged commit 1098e32 into main Dec 14, 2025
1 check passed
@thekingofcity thekingofcity deleted the copilot/update-line-width-constant branch December 14, 2025 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Export const LINE_WIDTH = 5

2 participants