mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-20 19:16:08 +00:00
fix(client): lint, theme and size ratchets of the quick-win round, and the tests that followed the features
New warnings fixed at their source (refs written in effects, typed tile options, no stray imports, smaller functions and components), the payer and split heads hold their switch instead of letting it overhang, the baselines lowered where the round removed warnings, and the tests updated to the solo trip, the shares view and the revisit status.
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import {
|
||||
MapPin, Building2, BedDouble, UtensilsCrossed, Landmark, ShoppingBag,
|
||||
Bus, Train, Car, Plane, Ship, Bike,
|
||||
BusFront, TrainFront, PlaneTakeoff, ParkingSquare, Fuel,
|
||||
Activity, Dumbbell, Mountain, Tent, Anchor,
|
||||
Coffee, Beer, Wine, Utensils,
|
||||
Camera, Music, Theater, Ticket,
|
||||
@@ -10,6 +9,7 @@ import {
|
||||
Church, Library, Store, Home, Cross,
|
||||
Heart, Star, CreditCard, Wifi,
|
||||
Luggage, Backpack, Zap, Croissant, ShoppingBasket,
|
||||
BusFront, TrainFront, PlaneTakeoff, ParkingSquare, Fuel,
|
||||
LucideIcon,
|
||||
} from 'lucide-react'
|
||||
|
||||
|
||||
@@ -24,14 +24,23 @@ interface PhotoPlace {
|
||||
* near those coordinates, the same street for every stop along it. Null while it
|
||||
* loads, when there is none and while photos are switched off.
|
||||
*/
|
||||
export function usePlacePhoto(place: PhotoPlace | null): string | null {
|
||||
const enabled = useAuthStore((s) => s.placesPhotosEnabled);
|
||||
/** How the picture is asked for: the place's own, or its provider's through the cache key. */
|
||||
function photoQuery(place: PhotoPlace | null) {
|
||||
const own = place?.image_url || null;
|
||||
const providerId = place?.google_place_id || place?.osm_id || null;
|
||||
const key = place && !own && providerId ? photoCacheKey(place) : '';
|
||||
const lat = place?.lat ?? undefined;
|
||||
const lng = place?.lng ?? undefined;
|
||||
const name = place?.name;
|
||||
return {
|
||||
own,
|
||||
providerId,
|
||||
key: place && !own && providerId ? photoCacheKey(place) : '',
|
||||
lat: place?.lat ?? undefined,
|
||||
lng: place?.lng ?? undefined,
|
||||
name: place?.name,
|
||||
};
|
||||
}
|
||||
|
||||
export function usePlacePhoto(place: PhotoPlace | null): string | null {
|
||||
const enabled = useAuthStore((s) => s.placesPhotosEnabled);
|
||||
const { own, providerId, key, lat, lng, name } = photoQuery(place);
|
||||
// Names the place it belongs to, so the previous place's picture never shows for the next.
|
||||
const [loaded, setLoaded] = useState<{ key: string; url: string | null } | null>(null);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user