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: some perf, and a11y. #188

Merged
merged 1 commit into from
Jan 21, 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 packages/ui/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
content="Maps providing real-time arrival and departure times of vehicles for bus stops along routes in San Francisco Muni CIS, Toronto Transit Commission, OmniTrans and other transit agencies across North and South America." />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
content="width=device-width, initial-scale=1.0, maximum-scale=2.0" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
Expand Down
11 changes: 10 additions & 1 deletion packages/ui/src/components/navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ const Navigation: FC<NavigationProps> = ({ status }) => {
<li title="Busmap">
<button
data-name="busmap"
aria-label="Busmap Logo"
onClick={onClickNavItem}
className={page === 'busmap' ? 'active' : undefined}>
<span dangerouslySetInnerHTML={{ __html: logoSvg }} />
Expand All @@ -300,6 +301,7 @@ const Navigation: FC<NavigationProps> = ({ status }) => {
<li title="Nearby">
<button
data-name="locate"
aria-label="Nearby"
onClick={onClickNavItem}
className={page === 'locate' ? 'active' : undefined}>
<MapPin />
Expand All @@ -309,6 +311,7 @@ const Navigation: FC<NavigationProps> = ({ status }) => {
<li title="Selector">
<button
data-name="select"
aria-label="Selector"
onClick={onClickNavItem}
className={page === 'select' ? 'active' : undefined}>
<Bus />
Expand All @@ -318,6 +321,7 @@ const Navigation: FC<NavigationProps> = ({ status }) => {
<li title="Favorites">
<button
data-name="favorites"
aria-label="Favorites"
onClick={onClickNavItem}
className={page === 'favorites' ? 'active' : undefined}>
<Star />
Expand All @@ -327,6 +331,7 @@ const Navigation: FC<NavigationProps> = ({ status }) => {
<li title="Settings">
<button
data-name="settings"
aria-label="Settings"
onClick={onClickNavItem}
className={page === 'settings' ? 'active' : undefined}>
<Cog />
Expand All @@ -336,14 +341,18 @@ const Navigation: FC<NavigationProps> = ({ status }) => {
<li title="Profile">
<button
data-name="profile"
aria-label="Profile"
onClick={onClickNavItem}
className={page === 'profile' ? 'active' : undefined}>
<UserIcon />
<span>Profile</span>
</button>
</li>
<li>
<button onClick={onClickToggle} className={!collapsed ? 'active' : undefined}>
<button
onClick={onClickToggle}
className={!collapsed ? 'active' : undefined}
aria-label="Toggle flyout menu">
<Exchange />
<span>{collapsed ? 'Open' : 'Close'}</span>
</button>
Expand Down
4 changes: 2 additions & 2 deletions packages/ui/src/home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ const Home: FC = () => {
const refCurrent = ref.current

if (refCurrent) {
refCurrent.addEventListener('touchstart', handleTouchStart)
refCurrent.addEventListener('touchend', handleTouchEnd)
refCurrent.addEventListener('touchstart', handleTouchStart, { passive: true })
refCurrent.addEventListener('touchend', handleTouchEnd, { passive: true })
}

return () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/web/templates/default.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ server {

location ~* \.(js|css)$ {
include /etc/nginx/conf.d/core/headers.conf;
add_header Cache-Control "max-age=604800 must-revalidate";
add_header Cache-Control "max-age=604800, must-revalidate";
}

# Do not cache index.html for SPA
location ~* ^.+.html$ {
include /etc/nginx/conf.d/core/headers.conf;
add_header Cache-Control "no-store max-age=0";
add_header Cache-Control "no-store, max-age=0";
}

access_log /var/log/nginx/core.log core;
Expand Down
4 changes: 2 additions & 2 deletions packages/web/templates/deploy.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ server {

location ~* \.(js|css)$ {
include /etc/nginx/conf.d/core/headers.conf;
add_header Cache-Control "max-age=604800 must-revalidate";
add_header Cache-Control "max-age=604800, must-revalidate";
}

# Do not cache index.html for SPA
location ~* ^.+.html$ {
include /etc/nginx/conf.d/core/headers.conf;
add_header Cache-Control "no-store max-age=0";
add_header Cache-Control "no-store, max-age=0";
}

access_log /var/log/nginx/core.log core;
Expand Down