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
1 change: 1 addition & 0 deletions apps/frontend/src/assets/harp-rating.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions apps/frontend/src/components/HarpIcon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import HARP_SRC from '#/assets/harp-rating.svg?url'

// Cropped version of harp.svg, so the icon fills the same space as a star.
export function HarpIcon({ className = '' }: { className?: string }) {
return (
<img
src={HARP_SRC}
alt=""
aria-hidden="true"
draggable={false}
className={`block h-[1em] w-auto max-w-none shrink-0 select-none ${className}`}
/>
)
}
28 changes: 12 additions & 16 deletions apps/frontend/src/components/NearbyVenues.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Link } from '@tanstack/react-router'

import { HarpIcon } from '#/components/HarpIcon'
import { formatOpeningHours } from '#/lib/format-opening-hours'
import { formatPrice } from '#/lib/format-price'
import { useUserTimeZone } from '#/lib/use-user-time-zone'
Expand Down Expand Up @@ -37,9 +38,7 @@ function VenueRow({
} ${(venue.reviewCount ?? 0) === 1 ? 'review' : 'reviews'}`}
className="inline-flex shrink-0 items-center gap-1 rounded-full px-2 py-0.5 text-xs font-bold text-(--sea-ink)"
>
<span aria-hidden="true" className="text-amber-500">
★
</span>
<HarpIcon />
<span>{venue.averageRating.toFixed(1)}</span>
<span className="font-normal text-(--sea-ink-soft)">
({venue.reviewCount ?? 0})
Expand Down Expand Up @@ -133,21 +132,18 @@ export default function NearbyVenues({
{hasLocation && venues.length > 0 && (
<>
{venues[0].cityId && venues[0].cityName && (
<div className="flex flex-row flex-wrap items-start justify-between gap-3">
<h2 className="mt-1 text-lg">
<Link
to="/$cityId/venues"
params={{ cityId: venues[0].cityId }}
className="inline-block rounded-full p-3 outline-2 outline-(--harp-gold) bg-(--chip-bg) transition duration-200 hover:-translate-y-0.5 hover:outline-(--cream-head) focus-visible:outline-(--lagoon-deep)"
style={{ textBox: 'trim-both ex alphabetic' }}
>
Show all venues in {venues[0].cityName}
</Link>
</h2>
<h3 className="mt-1 text-base">
<div className="flex flex-row flex-wrap items-center gap-3">
<Link
to="/$cityId/venues"
params={{ cityId: venues[0].cityId }}
className="mt-1 inline-flex items-center rounded-full bg-(--chip-bg) px-3 py-1.5 font-sans text-sm font-semibold text-(--sea-ink) transition hover:-translate-y-0.5 disabled:cursor-wait disabled:opacity-60 disabled:hover:translate-y-0"
>
Show all venues in {venues[0].cityName}
</Link>
<span className="mt-1 inline-flex items-center font-sans text-sm">
Not in {venues[0].cityName}? Search for your city in the search
bar above!
</h3>
</span>
</div>
)}

Expand Down
5 changes: 2 additions & 3 deletions apps/frontend/src/components/SearchBox.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { keepPreviousData, useQuery } from '@tanstack/react-query'
import { useNavigate } from '@tanstack/react-router'
import { useEffect, useId, useMemo, useState } from 'react'
import { HarpIcon } from '#/components/HarpIcon'
import type { FormEvent, KeyboardEvent } from 'react'

import { graphqlFetch } from '../graphql/client'
Expand Down Expand Up @@ -332,9 +333,7 @@ export function SearchBox({ coordinates = null, filters }: SearchBoxProps) {
}`}
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>
<HarpIcon />
<span>{result.averageRating.toFixed(1)}</span>
<span className="font-normal text-(--sea-ink-soft)">
({result.reviewCount ?? 0})
Expand Down
2 changes: 1 addition & 1 deletion apps/frontend/src/components/SearchFilters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ export default function SearchFilters({
<option value="">Any rating</option>
{RATING_OPTIONS.map((rating) => (
<option key={rating} value={rating}>
{rating}+ stars
{rating}+ harps
</option>
))}
</select>
Expand Down
5 changes: 2 additions & 3 deletions apps/frontend/src/components/ViewVenue.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { HarpIcon } from '#/components/HarpIcon'
import {
formatOpeningDays,
formatOpeningTime,
Expand All @@ -23,9 +24,7 @@ export function ViewVenue({ venue }: { venue: SearchResult }) {
className="mt-0.5 inline-flex shrink-0 items-center gap-1 rounded-full px-2.5 py-1 text-sm font-bold text-(--sea-ink)"
>
<span>Average rating:</span>
<span aria-hidden="true" className="text-amber-500">
★
</span>
<HarpIcon />
<span>{venue.averageRating.toFixed(1)}</span>
<span className="sr-only">
out of 5 from {venue.reviewCount ?? 0}{' '}
Expand Down
24 changes: 17 additions & 7 deletions apps/frontend/src/routes/$cityId/venues/$venueId.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { ReactNode } from 'react'
import { useQuery } from '@tanstack/react-query'
import { Link, createFileRoute } from '@tanstack/react-router'
import Breadcrumbs from '#/components/Breadcrumbs'
import { HarpIcon } from '#/components/HarpIcon'
import { ReportPriceDialog } from '#/components/prices/ReportPriceDialog'
import AddReviewDialog from '#/components/reviews/AddReviewDialog'
import { venueToSearchResult } from '#/components/VenueCard'
Expand Down Expand Up @@ -146,25 +147,34 @@ function BackLink() {
)
}

// The five harps keep the exact width and height of the old five-star row.
function Harps({ className = '' }: { className?: string }) {
return (
<span aria-hidden="true" className={className}>
{Array.from({ length: 5 }, (_, index) => (
<HarpIcon key={index} />
))}
</span>
)
}

function Rating({ rating }: { rating: number }) {
const percent = Math.max(0, Math.min(100, (rating / 5) * 100))

return (
<span className="mt-1 inline-flex items-center gap-2">
<span
role="img"
aria-label={`${rating} out of 5 stars`}
className="relative inline-block whitespace-nowrap text-base leading-none tracking-[0.08em]"
aria-label={`${rating} out of 5 harps`}
className="relative inline-flex h-[1em] w-[4.875em] items-center whitespace-nowrap text-base leading-none"
>
<span aria-hidden="true" className="text-(--line)">
★★★★★
</span>
<Harps className="flex h-full w-full items-center justify-between opacity-25 grayscale" />
<span
aria-hidden="true"
className="absolute inset-y-0 left-0 overflow-hidden whitespace-nowrap text-amber-500"
className="absolute inset-y-0 left-0 overflow-hidden"
style={{ width: `${percent}%` }}
>
★★★★★
<Harps className="flex h-full w-[4.875em] items-center justify-between" />
</span>
</span>
<span className="text-xs font-bold text-(--sea-ink-soft)">
Expand Down