fix: screenshots count+pos, sidebar theme

This commit is contained in:
2024-10-22 01:35:34 +03:00
parent 02be1530f1
commit d2fefaca97
5 changed files with 9 additions and 13 deletions

View File

@@ -1 +1 @@
0d0c98b49fd99dd2c835289a5056e043
b3720f3ac2572fdca396795bb24a2756

View File

@@ -6,10 +6,8 @@ export function ScreenshotImg({
className,
screenshot,
...rest
}: HtmlProps<'div'> & { screenshot: screenshots.ScreenshotEntry }) {
}: Omit<HtmlProps<'img'>, 'src'> & { screenshot: screenshots.ScreenshotEntry }) {
return (
<div className={cn('', rest.onClick && 'cursor-pointer', className)} {...rest}>
<img className="rounded-md" src={screenshot.base64} alt={screenshot.name} />
</div>
<img className={cn('rounded-md', rest.onClick && 'cursor-pointer', className)} src={screenshot.base64} alt={screenshot.name} {...rest} />
)
}

View File

@@ -22,14 +22,12 @@ export function ScreenshotsCarouselModal({
}) {
return (
<div className={cn('', className)} {...rest}>
<DialogContent className="max-w-[calc(100%_-_128px)]">
<DialogContent className="max-w-[calc(100%_-_128px)] max-h-[calc(100%_-_64px)]">
<Carousel opts={{ startIndex: activeIndex ?? undefined }}>
<CarouselContent>
<CarouselContent className="max-w-full max-h-full">
{screenshots.map((scr) => (
<CarouselItem key={scr.path}>
<div className="h-full flex items-center">
<ScreenshotImg screenshot={scr} />
</div>
<CarouselItem key={scr.path} className="flex items-center justify-center">
<ScreenshotImg screenshot={scr} className="max-h-[calc(100vh_-_128px)] object-cover mx-auto" />
</CarouselItem>
))}
</CarouselContent>

View File

@@ -6,7 +6,7 @@ import { cva } from 'class-variance-authority'
export function Sidebar({ className, ...rest }: HtmlProps<'div'>) {
return (
<div className={cn('py-3 bg-bg-950 h-screen overflow-y-auto', className)} {...rest}>
<div className={cn('py-3 bg-black/30 h-screen overflow-y-auto', className)} {...rest}>
<ul>
<ListItem label="Games" to="/games" match={(p) => p === '/' || p.startsWith('/games')} />
<ListItem

View File

@@ -74,7 +74,7 @@ func NewScreenshotsDirFromPath(path string, limit int) ScreenshotCollection {
continue
}
s.TotalCount++
if limit > 0 && i >= limit {
if limit > 0 && i > limit {
continue
}
b64 += base64.StdEncoding.EncodeToString(bytes)