Skip to content

Commit

Permalink
disclaimers & styling
Browse files Browse the repository at this point in the history
  • Loading branch information
thomassth committed Sep 13, 2024
1 parent 6fd4e61 commit 32141c5
Show file tree
Hide file tree
Showing 11 changed files with 49 additions and 28 deletions.
4 changes: 3 additions & 1 deletion src/components/accordions/StopAccordions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ export function ETAButton(props: {
return (
<Link
to={link}
title={props.name ? props.name : t("buttons.busIcon") ?? "View stop ETA"}
title={
props.name ? props.name : (t("buttons.busIcon") ?? "View stop ETA")
}
>
<Button
icon={props.name ? undefined : <VehicleBus16Filled />}
Expand Down
4 changes: 2 additions & 2 deletions src/components/bookmarks/BookmarkButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ export function BookmarkButton(props: StopBookmark) {
<Button
title={
isBookmarked()
? t("buttons.bookmarkDelete") ?? "Remove bookmark"
: t("buttons.bookmarkAdd") ?? "Add to bookmark"
? (t("buttons.bookmarkDelete") ?? "Remove bookmark")
: (t("buttons.bookmarkAdd") ?? "Add to bookmark")
}
icon={isBookmarked() ? <BookmarkOff24Filled /> : <BookmarkAdd24Regular />}
onClick={checkBookmarkStatus}
Expand Down
4 changes: 2 additions & 2 deletions src/components/bookmarks/BookmarkCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ export function BookmarkCard(props: { id: number }) {

const name =
item.type === "ttc-subway" && id
? subwayDbSelectors.selectById(store.getState().subwayDb, id)?.stop
?.name ?? item.name
? (subwayDbSelectors.selectById(store.getState().subwayDb, id)?.stop
?.name ?? item.name)
: item.name;
return (
<EtaCard
Expand Down
4 changes: 2 additions & 2 deletions src/components/eta/BookmarkCardEta.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ export function BookmarkCardEta(props: { item: LineStopEta }) {

const name =
item.type === "ttc-subway" && props.item.stopTag
? subwayDbSelectors.selectById(
? (subwayDbSelectors.selectById(
store.getState().subwayDb,
props.item.stopTag
)?.stop?.name ?? props.item.routeName
)?.stop?.name ?? props.item.routeName)
: Array.isArray(props.item.line)
? props.item.stopName
: `${props.item.routeName}
Expand Down
4 changes: 2 additions & 2 deletions src/components/eta/FavouriteEta.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ export default function FavouriteEta() {

const name =
item.type === "ttc-subway" && id
? subwayDbSelectors.selectById(store.getState().subwayDb, id)?.stop
?.name ?? item.name
? (subwayDbSelectors.selectById(store.getState().subwayDb, id)?.stop
?.name ?? item.name)
: item.name;

EtaCards.push(
Expand Down
21 changes: 20 additions & 1 deletion src/components/nearby/Nearby.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Button, Spinner, Switch } from "@fluentui/react-components";
import { Button, Spinner, Switch, Tooltip } from "@fluentui/react-components";
import { Info16Regular } from "@fluentui/react-icons";
import { useCallback, useEffect, useState } from "react";

import { store, useAppDispatch } from "../../store/index.js";
Expand Down Expand Up @@ -118,6 +119,24 @@ export default function Nearby() {
onChange={locationModeChange}
label="Provide my locations on load"
/>
<Tooltip
content={{
children: (
<p>
Even though we do not send your location to the internet, you
still have a choice to only use your location when you want.
<br />
For convenience, you can provide your location automatically
when you load TOBus.ca.
</p>
),
}}
relationship={"label"}
mountNode={document.querySelector("#root .fui-FluentProvider")}
withArrow
>
<Info16Regular />
</Tooltip>
</div>
<NearbyList coordinate={coordinate} />
</div>
Expand Down
6 changes: 6 additions & 0 deletions src/index.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
@import url("https://fonts.googleapis.com/css2?family=PT+Mono&display=swap");

#root {
> div {
height: 100%;
}
}

body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
Expand Down
6 changes: 6 additions & 0 deletions src/routes/Home.module.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
.hidden {
display: none;
}

.button-with-badge span {
display: flex;
flex-direction: row;
gap: 0.5em;
}
5 changes: 4 additions & 1 deletion src/routes/Home.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {
Badge,
Button,
SelectTabData,
SelectTabEvent,
Expand Down Expand Up @@ -52,7 +53,9 @@ export default function Home() {
className="directon-buttons"
onTabSelect={handleTabClick}
>
<Tab value={"nearby"}>Nearby</Tab>
<Tab value={"nearby"} className={style["button-with-badge"]}>
Nearby<Badge>Beta</Badge>
</Tab>
<Tab value={"favourites"}>Favourites</Tab>
</TabList>
<div className={enabledTab === "nearby" ? "" : style.hidden}>
Expand Down
8 changes: 1 addition & 7 deletions src/styles/FluentTheme.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,10 @@ import {
} from "@fluentui/react-components";
import { useState } from "react";

import { fluentStyles } from "./fluent";

const prefersDark = window.matchMedia("(prefers-color-scheme: dark)").matches;

export function FluentTheme({ children }: { children: JSX.Element }) {
const [isDark, setIsDark] = useState(prefersDark);
const fluentStyle = fluentStyles();

const toggleTheme = () => {
setIsDark(!isDark);
Expand All @@ -23,10 +20,7 @@ export function FluentTheme({ children }: { children: JSX.Element }) {
});

return (
<FluentProvider
className={fluentStyle.fluentProvider}
theme={isDark ? webDarkTheme : webLightTheme}
>
<FluentProvider theme={isDark ? webDarkTheme : webLightTheme}>
{children}
</FluentProvider>
);
Expand Down
11 changes: 1 addition & 10 deletions src/styles/fluent.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { makeStyles, shorthands, tokens } from "@fluentui/react-components";
import { makeStyles, shorthands } from "@fluentui/react-components";

export const fluentStyles = makeStyles({
fluentProvider: {
height: "100%",
},
accordionHeader: {
...shorthands.margin("0px", "0px"),

Expand All @@ -12,9 +9,6 @@ export const fluentStyles = makeStyles({
paddingLeft: "0px",
},
},
bottomNav: {
backgroundColor: tokens.colorNeutralBackground1,
},
bottomNavButton: {
flexDirection: "column",
marginLeft: "auto",
Expand All @@ -40,9 +34,6 @@ export const fluentStyles = makeStyles({
boxShadow: "0px 0px 0px 0px transparent !important",
},
},
flexGrowContent: {
flexGrow: 1,
},
smallRoundNavButton: {
width: "48px",
height: "48px",
Expand Down

0 comments on commit 32141c5

Please sign in to comment.