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

fix: dark mode hides map legend #760

Merged
merged 2 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion src/locale/he.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"and_smaller_donors": "ותרומות קטנות נוספות של ידידי ואוהדי הסדנא.",

"github_link": "למעבר אל GitHub",
"dark_mode_tooltip": "עבור למצב חשוך",
"dark_mode_tooltip": "עבור למצב כהה",
"light_mode_tooltip": "עבור למצב בהיר",
"Change Language": "English",
"bug_title": "כותרת/סיכום",
Expand Down
4 changes: 4 additions & 0 deletions src/pages/Map.scss
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ main > div,
}
}
}

.map-index.dark {
background-color: #303230;
}
}

pre {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import { ExpandAltOutlined } from '@ant-design/icons'
import { BusStop } from 'src/model/busStop'
import { t } from 'i18next'
import '../../Map.scss'
import { useTheme } from 'src/layout/ThemeContext'
import cn from 'classnames'

const position: Point = {
loc: [32.3057988, 34.85478613], // arbitrary default value... Netanya - best city to live & die in
Expand All @@ -30,6 +32,7 @@ interface MapProps {
}

export function MapWithLocationsAndPath({ positions, plannedRouteStops }: MapProps) {
const { isDarkTheme } = useTheme()
const agencyList = useAgencyList()
const [isExpanded, setIsExpanded] = useState<boolean>(false)
const toggleExpanded = useCallback(() => setIsExpanded((expanded) => !expanded), [])
Expand Down Expand Up @@ -62,7 +65,7 @@ export function MapWithLocationsAndPath({ positions, plannedRouteStops }: MapPro
attribution='&copy <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
url="https://tile-a.openstreetmap.fr/hot/{z}/{x}/{y}.png"
/>
<div className="map-index">
<div className={cn('map-index', { dark: isDarkTheme })}>
<MapIndex
lineColor={actualRouteLineColor}
imgSrc={actualRouteStopMarkerPath}
Expand Down
4 changes: 2 additions & 2 deletions tests/dashboard.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ test.describe('dashboard tests', () => {
test('page is working', async () => {})

test('dark mode use localstorage', async ({ page }) => {
await page.getByLabel('עבור למצב חשוך').click()
await page.getByLabel('עבור למצב כהה').click()
await page.reload()
await page.getByLabel('עבור למצב בהיר').click()
await page.reload()
await page.getByLabel('עבור למצב חשוך').click()
await page.getByLabel('עבור למצב כהה').click()
await page.getByLabel('עבור למצב בהיר').click()
})
})
Loading