Skip to content

Commit

Permalink
refactor: sign in, sign out. (#199)
Browse files Browse the repository at this point in the history
  • Loading branch information
morganney committed Feb 6, 2024
1 parent bb9bb29 commit c206c96
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 15 deletions.
5 changes: 2 additions & 3 deletions packages/ui/src/components/busmap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,8 @@ const BusmapPage: FC = () => {
<PageTabButton page="select">Selector</PageTabButton> tab to find a transit
agency, route, direction, and stop that fits your itinerary. Alternatively, you
can use the <PageTabButton page="locate">Nearby</PageTabButton> tab where you
will be prompted to permit your device to share its geolocation with Busmap, and
a list of the nearest stops for currently running transit agencies will be
displayed.
will be prompted to share your device&apos;s geolocation with Busmap, and a list
of the nearest stops will be displayed.
</p>
<p>
From either option, you can favorite the stop by clicking the star ⭐ icon, and
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/components/home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ const Home: FC = () => {
const touchEndX = touches[0].pageX

// Allow a small fudge factor
if (Math.abs(touchEndX - state.touchStartX) > 15) {
if (Math.abs(touchEndX - state.touchStartX) > 100) {
// Close
if (touchEndX < state.touchStartX) {
globalDispatch({ type: 'collapsed', value: true })
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/components/navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ const Nav = styled.nav<{ mode: Mode; isSignedIn: boolean }>`
display: ${({ isSignedIn }) => (isSignedIn ? 'none' : 'list-item')};
button {
padding: 3px 5px;
padding: 5px;
white-space: nowrap;
flex-direction: row;
justify-content: center;
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/components/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const Section = styled.section`
p {
margin: 0;
line-height: 1.5;
line-height: 1.35;
}
`
const Page: FC<PageProps> = ({ title, children, className, loading = false }) => {
Expand Down
4 changes: 3 additions & 1 deletion packages/ui/src/components/profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,11 @@ const Profile: FC = () => {
dispatch({ type: 'user', value: undefined })
dispatch({ type: 'agency', value: undefined })
dispatchStorage({ type: 'favoriteReset' })
toast({ type: 'info', message: `Goodbye ${result.user.givenName ?? ''}.` })
document.body.classList.remove('busmap-loaded')
navigate('/')
setTimeout(() => {
toast({ type: 'info', message: `Goodbye ${result.user.givenName ?? ''}.` })
}, 350)
} catch {
toast({ type: 'error', message: 'Error signing out!' })
} finally {
Expand Down
8 changes: 0 additions & 8 deletions packages/ui/src/components/signIn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,6 @@ const SignIn: FC = () => {
callback: async response => {
setLoading(true)

if (ref.current) {
ref.current.style.setProperty('display', 'none')
}

try {
const user = await login(response.credential)
const riderFavs = await getFavorites()
Expand All @@ -66,10 +62,6 @@ const SignIn: FC = () => {
toast({ type: 'error', message: 'Error signing in.' })
} finally {
setLoading(false)

if (ref.current) {
ref.current.style.setProperty('display', 'block')
}
}
}
})
Expand Down
4 changes: 4 additions & 0 deletions packages/ui/src/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -263,3 +263,7 @@ body.busmap-dark .busmap-vehicle::before {
align-items: center;
justify-content: center;
}
/* without, scrollbars appear after sign in. */
#g_a11y_announcement {
display: none;
}

0 comments on commit c206c96

Please sign in to comment.