mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-10-15 10:04:44 +00:00
Reformat with Prettier's updated line-wrapping for ternaries and JSX.
This commit is contained in:
@@ -2,7 +2,10 @@ import { useEffect } from 'react';
|
|||||||
import { showErrorToast } from '../../../components/ui/toast/toast';
|
import { showErrorToast } from '../../../components/ui/toast/toast';
|
||||||
import type { ActionResult } from '../types';
|
import type { ActionResult } from '../types';
|
||||||
|
|
||||||
export const useSectionError = (result: ActionResult | undefined, intent: ActionResult['intent']) => {
|
export const useSectionError = (
|
||||||
|
result: ActionResult | undefined,
|
||||||
|
intent: ActionResult['intent'],
|
||||||
|
) => {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!result || result.intent !== intent) return;
|
if (!result || result.intent !== intent) return;
|
||||||
showErrorToast(result.error);
|
showErrorToast(result.error);
|
||||||
|
|||||||
@@ -61,7 +61,13 @@ const CurrentLocationMarker = ({ position }: { position: LatLngTuple }) => (
|
|||||||
|
|
||||||
const CURRENT_LOCATION_ZOOM = 6;
|
const CURRENT_LOCATION_ZOOM = 6;
|
||||||
|
|
||||||
const RecenterMap = ({ bounds, currentLocation }: { bounds: LatLngTuple[]; currentLocation: LatLngTuple | null }) => {
|
const RecenterMap = ({
|
||||||
|
bounds,
|
||||||
|
currentLocation,
|
||||||
|
}: {
|
||||||
|
bounds: LatLngTuple[];
|
||||||
|
currentLocation: LatLngTuple | null;
|
||||||
|
}) => {
|
||||||
const map = useMap();
|
const map = useMap();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -77,10 +83,7 @@ const RecenterMap = ({ bounds, currentLocation }: { bounds: LatLngTuple[]; curre
|
|||||||
|
|
||||||
const BreweryMap = ({ breweries }: BreweryMapProps) => {
|
const BreweryMap = ({ breweries }: BreweryMapProps) => {
|
||||||
const currentLocation = useCurrentLocation();
|
const currentLocation = useCurrentLocation();
|
||||||
const bounds: LatLngTuple[] = breweries.map((brewery) => [
|
const bounds: LatLngTuple[] = breweries.map((brewery) => [brewery.latitude, brewery.longitude]);
|
||||||
brewery.latitude,
|
|
||||||
brewery.longitude,
|
|
||||||
]);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<MapContainer
|
<MapContainer
|
||||||
|
|||||||
@@ -7,8 +7,7 @@ interface FeaturedBreweryCardProps {
|
|||||||
onShowOnMap: () => void;
|
onShowOnMap: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Founded year, beers-listed count, and house style aren't tracked anywhere yet -
|
// see BREWERY_INDEX_HANDOFF.md
|
||||||
// see BREWERY_INDEX_HANDOFF.md. Filler until those fields/queries exist.
|
|
||||||
const FILLER_STATS = [
|
const FILLER_STATS = [
|
||||||
{ label: 'Founded', value: '2014' },
|
{ label: 'Founded', value: '2014' },
|
||||||
{ label: 'Beers listed', value: '18' },
|
{ label: 'Beers listed', value: '18' },
|
||||||
|
|||||||
@@ -98,7 +98,9 @@ const NearbyBreweryMap = ({
|
|||||||
>
|
>
|
||||||
<Popup>
|
<Popup>
|
||||||
<p className="font-semibold font-serif">{pin.name}</p>
|
<p className="font-semibold font-serif">{pin.name}</p>
|
||||||
{pin.cityLabel && <p className="text-sm text-base-content/70">{pin.cityLabel}</p>}
|
{pin.cityLabel && (
|
||||||
|
<p className="text-sm text-base-content/70">{pin.cityLabel}</p>
|
||||||
|
)}
|
||||||
<a href={`/breweries/${pin.id}`} className="link link-primary text-sm">
|
<a href={`/breweries/${pin.id}`} className="link link-primary text-sm">
|
||||||
View brewery →
|
View brewery →
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@@ -24,9 +24,8 @@ const Breweries = ({ loaderData }: Route.ComponentProps) => {
|
|||||||
const { featured, recent } = loaderData;
|
const { featured, recent } = loaderData;
|
||||||
const [selectedId, setSelectedId] = useState<string | null>(null);
|
const [selectedId, setSelectedId] = useState<string | null>(null);
|
||||||
|
|
||||||
const featuredPin =
|
const featuredPin = featured?.location?.coordinates
|
||||||
featured?.location?.coordinates ?
|
? {
|
||||||
{
|
|
||||||
id: featured.breweryPostId,
|
id: featured.breweryPostId,
|
||||||
name: featured.breweryName,
|
name: featured.breweryName,
|
||||||
latitude: featured.location.coordinates.latitude,
|
latitude: featured.location.coordinates.latitude,
|
||||||
@@ -34,9 +33,8 @@ const Breweries = ({ loaderData }: Route.ComponentProps) => {
|
|||||||
}
|
}
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
const fallbackCenter =
|
const fallbackCenter = featured?.location?.coordinates
|
||||||
featured?.location?.coordinates ?
|
? {
|
||||||
{
|
|
||||||
latitude: featured.location.coordinates.latitude,
|
latitude: featured.location.coordinates.latitude,
|
||||||
longitude: featured.location.coordinates.longitude,
|
longitude: featured.location.coordinates.longitude,
|
||||||
label: featured.location.cityName,
|
label: featured.location.cityName,
|
||||||
@@ -85,7 +83,9 @@ const Breweries = ({ loaderData }: Route.ComponentProps) => {
|
|||||||
<section className="max-w-7xl mx-auto px-5 pt-11">
|
<section className="max-w-7xl mx-auto px-5 pt-11">
|
||||||
<div className="bg-[var(--color-highlight)] text-[var(--color-highlight-content)] rounded-box p-7 flex items-center justify-between gap-6 flex-wrap">
|
<div className="bg-[var(--color-highlight)] text-[var(--color-highlight-content)] rounded-box p-7 flex items-center justify-between gap-6 flex-wrap">
|
||||||
<div>
|
<div>
|
||||||
<h2 className="font-serif text-2xl mb-1">Looking for something specific?</h2>
|
<h2 className="font-serif text-2xl mb-1">
|
||||||
|
Looking for something specific?
|
||||||
|
</h2>
|
||||||
<p className="m-0">
|
<p className="m-0">
|
||||||
All {FILLER_TOTAL_BREWERY_COUNT} partner breweries, filterable by
|
All {FILLER_TOTAL_BREWERY_COUNT} partner breweries, filterable by
|
||||||
country, region, and beer style.
|
country, region, and beer style.
|
||||||
|
|||||||
@@ -103,10 +103,7 @@ const Breweries = ({ loaderData }: Route.ComponentProps) => {
|
|||||||
))}
|
))}
|
||||||
{fetcher.state !== 'idle' &&
|
{fetcher.state !== 'idle' &&
|
||||||
Array.from({ length: PAGE_SIZE }).map((_, index) => (
|
Array.from({ length: PAGE_SIZE }).map((_, index) => (
|
||||||
<div
|
<div key={index} className="skeleton h-32 w-full rounded-box" />
|
||||||
key={index}
|
|
||||||
className="skeleton h-32 w-full rounded-box"
|
|
||||||
/>
|
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -14,7 +14,11 @@ const PasswordSectionRoute = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="w-full max-w-md">
|
<div className="w-full max-w-md">
|
||||||
<PasswordSection open={open} onToggle={() => setOpen((value) => !value)} result={result} />
|
<PasswordSection
|
||||||
|
open={open}
|
||||||
|
onToggle={() => setOpen((value) => !value)}
|
||||||
|
result={result}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user