Skip to content

Commit 62fad58

Browse files
improved photo card
1 parent 4d4e4d1 commit 62fad58

File tree

2 files changed

+28
-13
lines changed

2 files changed

+28
-13
lines changed

src/components/list/card.tsx

+27-12
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,7 @@ export function PhotoCard({
337337
}) {
338338
const [open, setOpen] = useState(false);
339339
const [api, setApi] = useState<CarouselApi>();
340+
const [currentIndex, setCurrentIndex] = useState(0);
340341

341342
return (
342343
<>
@@ -361,28 +362,42 @@ export function PhotoCard({
361362
</Button>
362363
))}
363364
</div>
364-
<Dialog open={open} onOpenChange={setOpen}>
365-
<DialogContent className="max-w-[90vw] max-h-[90vh] w-auto p-0 rounded-lg border-2 overflow-hidden">
366-
<DialogTitle className="p-6 hidden">{title}</DialogTitle>
367-
<Carousel setApi={setApi} className="w-full">
368-
<CarouselContent>
369-
{photos.map((photo) => (
365+
<Dialog open={open} onOpenChange={setOpen} modal={false}>
366+
<DialogContent
367+
className="p-0 bg-background/80 w-screen h-screen overflow-hidden max-w-none max-h-none border-0 rounded-none focus:outline-none"
368+
onClick={() => setOpen(false)}
369+
>
370+
<DialogTitle className="hidden">{title}</DialogTitle>
371+
<Carousel className="relative" setApi={(api) => setApi(api)}>
372+
<CarouselContent className="h-full absolute inset-0 ml-0">
373+
{photos.map((photo, index) => (
370374
<CarouselItem
371375
key={photo.unique_id}
372-
className="flex items-center justify-center"
376+
className="flex items-center justify-center pl-0"
373377
>
374378
<img
375379
src={photo.urls ? Object.values(photo.urls).at(-1) : ''}
376380
alt={photo.caption ?? ''}
377-
className="object-contain max-w-full max-h-[80vh] w-auto h-auto"
381+
className="max-w-[calc(100vw-4rem)] max-h-[calc(100vh-4rem)] object-contain rounded-lg border-2 border-background"
382+
onClick={(e) => e.stopPropagation()}
378383
/>
379384
</CarouselItem>
380385
))}
381386
</CarouselContent>
382-
<div className="absolute bottom-4 left-0 right-0 flex justify-center gap-2">
383-
<CarouselPrevious />
384-
<CarouselNext />
385-
</div>
387+
<CarouselPrevious
388+
className="absolute left-4"
389+
onClick={(e) => {
390+
e.stopPropagation();
391+
api?.scrollPrev();
392+
}}
393+
/>
394+
<CarouselNext
395+
className="absolute right-4"
396+
onClick={(e) => {
397+
e.stopPropagation();
398+
api?.scrollNext();
399+
}}
400+
/>
386401
</Carousel>
387402
</DialogContent>
388403
</Dialog>

src/server/strava/actions.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ async function fetchStravaActivities({
128128
console.log('Fetching summary activities');
129129
stravaActivities = await client.getActivities({
130130
before,
131-
per_page: 200,
131+
per_page: 50,
132132
});
133133
}
134134

0 commit comments

Comments
 (0)