Skip to content
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
4 changes: 2 additions & 2 deletions apps/frontend/src/components/AddReviewDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export default function AddReviewDialog({
<button
type="button"
onClick={openDialog}
className="inline-flex items-center gap-1.5 rounded-xl bg-(--chip-bg) px-3.5 py-2 text-sm font-bold text-(--sea-ink) shadow-[0_8px_22px_rgba(0,0,0,0.28)] hover:-translate-y-0.5 hover:bg-(--link-bg-hover) focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--lagoon-deep)"
className="inline-flex items-center gap-1.5 rounded-xl bg-(--chip-bg) px-3.5 py-2 text-sm font-bold text-(--sea-ink) hover:-translate-y-0.5 hover:bg-(--link-bg-hover) focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--lagoon-deep)"
>
<span aria-hidden="true" className="text-base leading-none">
+
Expand All @@ -129,7 +129,7 @@ export default function AddReviewDialog({
closeDialog()
}
}}
className="m-auto max-h-[calc(100dvh_-_2rem)] w-[min(30rem,calc(100vw_-_2rem))] overflow-y-auto rounded-2xl bg-(--surface-strong) p-0 text-(--sea-ink) shadow-2xl backdrop:bg-black/50 backdrop:backdrop-blur-sm"
className="m-auto max-h-[calc(100dvh-2rem)] w-[min(30rem,calc(100vw-2rem))] overflow-y-auto rounded-2xl bg-(--surface-strong) p-0 text-(--sea-ink) shadow-2xl backdrop:bg-black/50 backdrop:backdrop-blur-sm"
>
<div className="relative p-5">
<h2 id={titleId} className="text-xl font-extrabold">
Expand Down
2 changes: 1 addition & 1 deletion apps/frontend/src/components/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export default function Footer() {
const year = new Date().getFullYear()

return (
<footer className="mt-20 px-4 pb-14 pt-10 text-[var(--cream-dark)]">
<footer className="mt-20 px-4 pb-14 pt-10 text-(--cream-dark)">
<div className="page-wrap flex flex-col items-center justify-between gap-4 text-center sm:flex-row sm:text-left">
<p className="m-0 text-sm">&copy; {year} RSM. All rights reserved.</p>
</div>
Expand Down
4 changes: 2 additions & 2 deletions apps/frontend/src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import ThemeToggle from './ThemeToggle'

export default function Header() {
return (
<header className="sticky top-0 z-50 border-b border-(--harp-gold) bg-(--cream-head) px-4 backdrop-blur-lg">
<header className="sticky top-0 z-1000 border-b border-(--harp-gold) bg-(--cream-head) px-4 backdrop-blur-lg">
<nav className="page-wrap flex flex-wrap items-center justify-between gap-x-3 gap-y-2 py-3 sm:py-4">
<h2 className="m-0 w-full flex-1 text-base font-semibold">
<div className="flex w-full items-center justify-between gap-3">
<a
href={import.meta.env.BASE_URL}
className="m-0 p-0 text-left tracking-[0.08em] text-(--) font-extrabold"
className="m-0 p-0 text-left tracking-[0.08em] text-(--cream-dark) font-extrabold"
>
G-SPOTTER
</a>
Expand Down
4 changes: 2 additions & 2 deletions apps/frontend/src/components/MockLocationNotice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ export default function MockLocationNotice() {
<h2 className="mt-1 text-base font-extrabold">
We are showing a mock position instead of your real one
</h2>
<p className="mt-1 text-sm text-[var(--sea-ink-soft)]">
<p className="mt-1 text-sm text-(--sea-ink-soft)">
Browsers only share your location over HTTPS or on localhost, and this
site is served over plain HTTP. Pubs are therefore sorted by distance
from {MOCK_LOCATION_NAME} rather than from where you actually are.
</p>
<p className="mt-2 text-sm text-[var(--sea-ink-soft)]">
<p className="mt-2 text-sm text-(--sea-ink-soft)">
For the full experience, check out{' '}
<a href={REPOSITORY_URL} target="_blank" rel="noreferrer">
the repository
Expand Down
26 changes: 12 additions & 14 deletions apps/frontend/src/components/NearbyVenues.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ interface NearbyVenuesProps {
}

const rowClassName =
'block w-full px-1 py-3 text-left text-sm text-[var(--sea-ink)] transition-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--lagoon-deep)'
'block w-full px-1 py-3 text-left text-sm text-(--sea-ink) transition-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--lagoon-deep)'

function VenueRow({ venue }: { venue: SearchResult }) {
return (
Expand All @@ -28,30 +28,30 @@ function VenueRow({ venue }: { venue: SearchResult }) {
title={`Average rating ${venue.averageRating.toFixed(1)} out of 5 from ${
venue.reviewCount ?? 0
} ${(venue.reviewCount ?? 0) === 1 ? 'review' : 'reviews'}`}
className="inline-flex shrink-0 items-center gap-1 rounded-full bg-[var(--chip-bg)] px-2 py-0.5 text-xs font-bold text-[var(--sea-ink)]"
className="inline-flex shrink-0 items-center gap-1 rounded-full bg-(--chip-bg) px-2 py-0.5 text-xs font-bold text-(--sea-ink)"
>
<span aria-hidden="true" className="text-amber-500">
★
</span>
<span>{venue.averageRating.toFixed(1)}</span>
<span className="font-normal text-[var(--sea-ink-soft)]">
<span className="font-normal text-(--sea-ink-soft)">
({venue.reviewCount ?? 0})
</span>
</span>
)}
</span>
{venue.address && (
<span className="mt-0.5 block text-xs text-[var(--sea-ink-soft)]">
<span className="mt-0.5 block text-xs text-(--sea-ink-soft)">
{venue.address}
</span>
)}
{venue.openingHours && venue.openingHours.length > 0 && (
<span className="mt-0.5 block text-xs text-[var(--sea-ink-soft)]">
<span className="mt-0.5 block text-xs text-(--sea-ink-soft)">
{formatOpeningHours(venue.openingHours)}
</span>
)}
{venue.latestPriceSighting && (
<span className="mt-0.5 block text-xs text-[var(--sea-ink-soft)]">
<span className="mt-0.5 block text-xs text-(--sea-ink-soft)">
{formatPrice(venue.latestPriceSighting)}
</span>
)}
Expand Down Expand Up @@ -82,34 +82,32 @@ export default function NearbyVenues({
type="button"
onClick={onRefresh}
disabled={locating}
className="rounded-full bg-[var(--chip-bg)] px-3 py-1.5 text-sm font-semibold text-[var(--sea-ink)] transition hover:-translate-y-0.5 disabled:cursor-wait disabled:opacity-60 disabled:hover:translate-y-0"
className="rounded-full bg-(--chip-bg) px-3 py-1.5 text-sm font-semibold text-(--sea-ink) transition hover:-translate-y-0.5 disabled:cursor-wait disabled:opacity-60 disabled:hover:translate-y-0"
>
{locating ? 'Finding location…' : 'Refresh location'}
</button>
</div>

{locationError && (
<p className="mt-3 text-sm text-[var(--sea-ink-soft)]">
{locationError}
</p>
<p className="mt-3 text-sm text-(--sea-ink-soft)">{locationError}</p>
)}

{!locationError && !hasLocation && (
<p className="mt-3 text-sm text-[var(--sea-ink-soft)]">
<p className="mt-3 text-sm text-(--sea-ink-soft)">
{locating
? 'Finding your location…'
: 'Allow location access to see pubs near you.'}
</p>
)}

{hasLocation && isError && (
<p className="mt-3 text-sm text-[var(--sea-ink-soft)]">
<p className="mt-3 text-sm text-(--sea-ink-soft)">
Nearby pubs are unavailable right now.
</p>
)}

{hasLocation && !isError && isLoading && venues.length === 0 && (
<p className="mt-3 text-sm text-[var(--sea-ink-soft)]">
<p className="mt-3 text-sm text-(--sea-ink-soft)">
Loading nearby pubs…
</p>
)}
Expand All @@ -119,7 +117,7 @@ export default function NearbyVenues({
!isLoading &&
venues.length === 0 &&
!locationError && (
<p className="mt-3 text-sm text-[var(--sea-ink-soft)]">
<p className="mt-3 text-sm text-(--sea-ink-soft)">
No pubs within {maxDistanceKm} km of your location.
</p>
)}
Expand Down
36 changes: 18 additions & 18 deletions apps/frontend/src/components/SearchBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function SearchIcon() {
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
className="h-4 w-4 shrink-0 text-[var(--sea-ink-soft)]"
className="size-4 shrink-0 text-(--sea-ink-soft)"
>
<circle cx="11" cy="11" r="7" />
<path d="m20 20-3.5-3.5" />
Expand Down Expand Up @@ -211,17 +211,17 @@ export function SearchBox({ coordinates = null, filters }: SearchBoxProps) {
}

return (
<div className="relative z-[1000] w-full max-w-[22rem]">
<div className="relative z-1000 w-full max-w-88">
<form
role="search"
onSubmit={handleSubmit}
className="rounded-xl bg-[var(--surface-strong)] shadow-lg backdrop-blur"
className="rounded-xl bg-(--chip-bg) backdrop-blur"
>
<div className="flex items-center gap-2 px-3 py-2">
<button
type="submit"
aria-label="Search"
className="shrink-0 rounded-full p-0.5 hover:text-[var(--sea-ink)]"
className="shrink-0 rounded-full p-0.5 hover:text-(--sea-ink)"
>
<SearchIcon />
</button>
Expand All @@ -248,7 +248,7 @@ export function SearchBox({ coordinates = null, filters }: SearchBoxProps) {
aria-activedescendant={
activeOption >= 0 ? `${listId}-option-${activeOption}` : undefined
}
className="w-full bg-transparent text-sm text-[var(--sea-ink)] outline-none placeholder:text-[var(--sea-ink-soft)] [&::-webkit-search-cancel-button]:appearance-none"
className="w-full bg-transparent text-sm text-(--sea-ink) outline-none placeholder:text-(--sea-ink-soft) [&::-webkit-search-cancel-button]:appearance-none"
/>
{term.length > 0 && (
<button
Expand All @@ -261,7 +261,7 @@ export function SearchBox({ coordinates = null, filters }: SearchBoxProps) {
setShowAll(false)
setActiveIndex(-1)
}}
className="shrink-0 rounded-full px-1 text-sm leading-none text-[var(--sea-ink-soft)] hover:text-[var(--sea-ink)]"
className="shrink-0 rounded-full px-1 text-sm leading-none text-(--sea-ink-soft) hover:text-(--sea-ink)"
>
✕
</button>
Expand All @@ -270,15 +270,15 @@ export function SearchBox({ coordinates = null, filters }: SearchBoxProps) {
</form>

{showPanel && (
<div className="mt-2 overflow-hidden rounded-xl bg-[var(--surface-strong)] shadow-lg backdrop-blur">
<div className="absolute top-full right-0 left-0 mt-2 overflow-hidden rounded-xl bg-(--surface-strong) shadow-lg backdrop-blur">
{isError && (
<p className="px-3 py-2 text-sm text-[var(--sea-ink-soft)]">
<p className="px-3 py-2 text-sm text-(--sea-ink-soft)">
Search is unavailable right now.
</p>
)}

{!isError && (waitingForDebounce || isFetching) && (
<p className="px-3 py-2 text-sm text-[var(--sea-ink-soft)]">
<p className="px-3 py-2 text-sm text-(--sea-ink-soft)">
Searching…
</p>
)}
Expand All @@ -287,7 +287,7 @@ export function SearchBox({ coordinates = null, filters }: SearchBoxProps) {
!waitingForDebounce &&
!isFetching &&
results.length === 0 && (
<p className="px-3 py-2 text-sm text-[var(--sea-ink-soft)]">
<p className="px-3 py-2 text-sm text-(--sea-ink-soft)">
No matches for “{debouncedTerm}”.
</p>
)}
Expand All @@ -306,14 +306,14 @@ export function SearchBox({ coordinates = null, filters }: SearchBoxProps) {
onMouseDown={(event) => event.preventDefault()}
onClick={() => select(result)}
onMouseEnter={() => setActiveIndex(index)}
className={`w-full px-3 py-2 text-left text-sm text-[var(--sea-ink)] hover:bg-[var(--chip-bg)] ${
index === activeOption ? 'bg-[var(--chip-bg)]' : ''
className={`w-full px-3 py-2 text-left text-sm text-(--sea-ink) hover:bg-(--chip-bg) ${
index === activeOption ? 'bg-(--chip-bg)' : ''
}`}
>
<span className="flex items-baseline justify-between gap-2">
<span className="min-w-0">
<span className="font-semibold">{result.name}</span>
<span className="ml-2 rounded-full px-1.5 py-0.5 text-[0.65rem] font-bold tracking-wide uppercase text-[var(--sea-ink-soft)]">
<span className="ml-2 rounded-full px-1.5 py-0.5 text-[0.65rem] font-bold tracking-wide uppercase text-(--sea-ink-soft)">
{typeLabel(result)}
</span>
</span>
Expand All @@ -326,26 +326,26 @@ export function SearchBox({ coordinates = null, filters }: SearchBoxProps) {
? 'review'
: 'reviews'
}`}
className="inline-flex shrink-0 items-center gap-1 rounded-full bg-[var(--chip-bg)] px-1.5 py-0.5 text-xs font-bold"
className="inline-flex shrink-0 items-center gap-1 rounded-full bg-(--chip-bg) px-1.5 py-0.5 text-xs font-bold"
>
<span aria-hidden="true" className="text-amber-500">
★
</span>
<span>{result.averageRating.toFixed(1)}</span>
<span className="font-normal text-[var(--sea-ink-soft)]">
<span className="font-normal text-(--sea-ink-soft)">
({result.reviewCount ?? 0})
</span>
</span>
)}
</span>
{result.address && (
<span className="mt-0.5 block text-xs text-[var(--sea-ink-soft)]">
<span className="mt-0.5 block text-xs text-(--sea-ink-soft)">
{result.address}
</span>
)}
{(result.latestPriceSighting ||
result.distanceKm != null) && (
<span className="mt-0.5 flex flex-wrap justify-between gap-x-2 text-xs text-[var(--sea-ink-soft)]">
<span className="mt-0.5 flex flex-wrap justify-between gap-x-2 text-xs text-(--sea-ink-soft)">
{result.latestPriceSighting && (
<span>{formatPrice(result.latestPriceSighting)}</span>
)}
Expand All @@ -365,7 +365,7 @@ export function SearchBox({ coordinates = null, filters }: SearchBoxProps) {
type="button"
onMouseDown={(event) => event.preventDefault()}
onClick={() => setShowAll(true)}
className="w-full border-t border-[var(--line)] px-3 py-2 text-left text-xs font-semibold text-[var(--sea-ink-soft)] hover:bg-[var(--chip-bg)]"
className="w-full border-t border-(--line) px-3 py-2 text-left text-xs font-semibold text-(--sea-ink-soft) hover:bg-(--chip-bg)"
>
Show all {results.length} results (or press Enter)
</button>
Expand Down
16 changes: 8 additions & 8 deletions apps/frontend/src/components/SearchFilters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ const SIZE_OPTIONS: { value: GlassSize; label: string }[] = [
]

const fieldClassName =
'mt-1 w-full rounded-xl bg-[var(--chip-bg)] px-2.5 py-1.5 text-sm text-[var(--sea-ink)] outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--lagoon-deep)'
'mt-1 w-full rounded-xl bg-(--chip-bg) px-2.5 py-1.5 text-sm text-(--sea-ink) outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--lagoon-deep)'

const labelClassName = 'block text-xs font-semibold text-[var(--sea-ink-soft)]'
const labelClassName = 'block text-xs font-semibold text-(--sea-ink-soft)'

function blockNegativeKey(event: KeyboardEvent<HTMLInputElement>) {
if (event.key === '-') {
Expand Down Expand Up @@ -67,19 +67,19 @@ export default function SearchFilters({
}

return (
<section className="mt-4 rounded-2xl bg-[var(--surface-strong)] p-4 text-[var(--sea-ink)]">
<section className="mt-4 rounded-2xl bg-(--surface-strong) p-4 text-(--sea-ink)">
<div className="flex flex-wrap items-start justify-between gap-3">
<div>
<h2 className="mt-1 text-lg font-extrabold">Filter pubs</h2>
<p className="mt-0.5 text-xs text-[var(--sea-ink-soft)]">
<p className="mt-0.5 text-xs text-(--sea-ink-soft)">
Applies to the map, nearby pubs and search results.
</p>
</div>
<button
type="button"
onClick={() => onChange(EMPTY_SEARCH_FILTERS)}
disabled={activeCount === 0}
className="rounded-full bg-[var(--chip-bg)] px-3 py-1.5 text-xs font-semibold text-[var(--sea-ink)] transition hover:-translate-y-0.5 disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:translate-y-0"
className="rounded-full bg-(--chip-bg) px-3 py-1.5 text-xs font-semibold text-(--sea-ink) transition hover:-translate-y-0.5 disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:translate-y-0"
>
Clear filters
{activeCount > 0 && ` (${activeCount})`}
Expand Down Expand Up @@ -111,7 +111,7 @@ export default function SearchFilters({
))}
</select>
{!coordinates && (
<p className="mt-1 text-xs text-[var(--sea-ink-soft)]">
<p className="mt-1 text-xs text-(--sea-ink-soft)">
Allow location access to filter by distance.
</p>
)}
Expand Down Expand Up @@ -174,13 +174,13 @@ export default function SearchFilters({
{SIZE_OPTIONS.map((option) => (
<label
key={option.value}
className="flex items-center gap-1.5 text-sm font-medium text-[var(--sea-ink)]"
className="flex items-center gap-1.5 text-sm font-medium text-(--sea-ink)"
>
<input
type="checkbox"
checked={filters.sizes.includes(option.value)}
onChange={() => toggleSize(option.value)}
className="h-4 w-4 accent-[var(--lagoon-deep)]"
className="h-4 w-4 accent-(--lagoon-deep)"
/>
{option.label}
</label>
Expand Down
2 changes: 1 addition & 1 deletion apps/frontend/src/components/ThemeToggle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export default function ThemeToggle() {
onClick={toggleMode}
aria-label={label}
title={label}
className="rounded-full bg-(--cream-dark) px-3 py-1.5 text-sm font-semibold text-(--stout-black) shadow-[0_8px_22px_rgba(0,0,0,0.28)] transition hover:-translate-y-0.5"
className="rounded-full bg-(--cream-dark) px-3 py-1.5 text-sm font-semibold text-(--stout-black) transition hover:-translate-y-0.5"
>
{mode === 'dark' ? 'Dark' : 'Light'}
</button>
Expand Down
4 changes: 4 additions & 0 deletions apps/frontend/src/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,10 @@ a {
border-top-color: var(--sand);
}

.leaflet-container .leaflet-bottom {
z-index: 900;
}

.rise-in {
animation: rise-in 700ms cubic-bezier(0.16, 1, 0.3, 1) both;
}
Expand Down