Skip to content

Commit

Permalink
Merge pull request #167 from besscroft/v2
Browse files Browse the repository at this point in the history
v2.0.4
  • Loading branch information
besscroft authored Nov 22, 2024
2 parents 9228742 + 5a61128 commit 1d1d74f
Show file tree
Hide file tree
Showing 21 changed files with 71 additions and 46 deletions.
2 changes: 1 addition & 1 deletion app/admin/about/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export default function About() {
/>
</svg>

<p className="whitespace-nowrap text-sm">v2.0.3</p>
<p className="whitespace-nowrap text-sm">v2.0.4</p>
</span>
<span>PicImpact 是一个摄影师专用的摄影作品展示网站,基于 Next.js + Hono.js 开发。</span>
<div className="flex flex-col w-full">
Expand Down
7 changes: 5 additions & 2 deletions components/LivePhoto.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

import * as React from 'react'
import { useEffect, useRef } from 'react'
import { cn } from '~/lib/utils'

export default function LivePhoto({ url, videoUrl }: { url: string; videoUrl: string }) {
export default function LivePhoto({ url, videoUrl, className }: { url: string; videoUrl: string; className?: string }) {
const livePhotoRef = useRef<HTMLDivElement>(null)

useEffect(() => {
Expand All @@ -23,6 +24,8 @@ export default function LivePhoto({ url, videoUrl }: { url: string; videoUrl: st
}, [livePhotoRef, url, videoUrl])

return (
<div ref={livePhotoRef} className="w-full md:max-h-[90vh]"/>
<div ref={livePhotoRef} className={
cn(className, "w-full object-contain h-[36vh]")
} />
)
}
1 change: 1 addition & 0 deletions components/MasonryItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ export default function MasonryItem() {
: <LivePhoto
url={MasonryViewData.preview_url || MasonryViewData.url}
videoUrl={MasonryViewData.video_url}
className="md:h-[90vh] md:max-h-[90vh]"
/>
}
</div>
Expand Down
2 changes: 1 addition & 1 deletion components/admin/album/AlbumAddSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export default function AlbumAddSheet(props : Readonly<HandleProps>) {
onOpenChange={() => setAlbumAdd(!albumAdd)}
modal={false}
>
<SheetContent side="left" className="overflow-y-auto scrollbar-hide" onInteractOutside={(event: any) => event.preventDefault()}>
<SheetContent side="left" className="w-full overflow-y-auto scrollbar-hide" onInteractOutside={(event: any) => event.preventDefault()}>
<SheetHeader>
<SheetTitle>新增相册</SheetTitle>
<SheetDescription className="space-y-2">
Expand Down
2 changes: 1 addition & 1 deletion components/admin/album/AlbumEditSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export default function AlbumEditSheet(props : Readonly<HandleProps>) {
}}
modal={false}
>
<SheetContent side="left" onInteractOutside={(event: any) => event.preventDefault()}>
<SheetContent side="left" className="w-full overflow-y-auto scrollbar-hide" onInteractOutside={(event: any) => event.preventDefault()}>
<SheetHeader>
<SheetTitle>编辑相册</SheetTitle>
</SheetHeader>
Expand Down
2 changes: 1 addition & 1 deletion components/admin/album/AlbumHelpSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default function AlbumHelpSheet() {
}}
modal={false}
>
<SheetContent side="left" className="overflow-y-auto scrollbar-hide">
<SheetContent side="left" className="w-full overflow-y-auto scrollbar-hide">
<SheetHeader>
<SheetTitle>帮助</SheetTitle>
<SheetDescription className="space-y-2">
Expand Down
2 changes: 1 addition & 1 deletion components/admin/copyright/CopyrightAddSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export default function CopyrightAddSheet(props : Readonly<HandleProps>) {
onOpenChange={() => setCopyrightAdd(!copyrightAdd)}
modal={false}
>
<SheetContent side="left" className="overflow-y-auto scrollbar-hide" onInteractOutside={(event: any) => event.preventDefault()}>
<SheetContent side="left" className="w-full overflow-y-auto scrollbar-hide" onInteractOutside={(event: any) => event.preventDefault()}>
<SheetHeader>
<SheetTitle>新增版权</SheetTitle>
</SheetHeader>
Expand Down
2 changes: 1 addition & 1 deletion components/admin/copyright/CopyrightEditSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export default function CopyrightEditSheet(props : Readonly<HandleProps>) {
}}
modal={false}
>
<SheetContent side="left" className="overflow-y-auto scrollbar-hide" onInteractOutside={(event: any) => event.preventDefault()}>
<SheetContent side="left" className="w-full overflow-y-auto scrollbar-hide" onInteractOutside={(event: any) => event.preventDefault()}>
<SheetHeader>
<SheetTitle>编辑版权</SheetTitle>
</SheetHeader>
Expand Down
2 changes: 1 addition & 1 deletion components/admin/list/ImageBatchDeleteSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export default function ImageBatchDeleteSheet(props : Readonly<ImageServerHandle
}}
modal={false}
>
<SheetContent side="left" className="overflow-y-auto scrollbar-hide" onInteractOutside={(event: any) => event.preventDefault()}>
<SheetContent side="left" className="w-full overflow-y-auto scrollbar-hide" onInteractOutside={(event: any) => event.preventDefault()}>
<SheetHeader>
<SheetTitle>批量删除</SheetTitle>
</SheetHeader>
Expand Down
17 changes: 16 additions & 1 deletion components/admin/list/ImageEditSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export default function ImageEditSheet(props : Readonly<ImageServerHandleProps &
}}
modal={false}
>
<SheetContent side="left" className="overflow-y-auto scrollbar-hide" onInteractOutside={(event: any) => event.preventDefault()}>
<SheetContent side="left" className="w-full overflow-y-auto scrollbar-hide" onInteractOutside={(event: any) => event.preventDefault()}>
<SheetHeader>
<SheetTitle>编辑图片</SheetTitle>
</SheetHeader>
Expand Down Expand Up @@ -120,6 +120,21 @@ export default function ImageEditSheet(props : Readonly<ImageServerHandleProps &
className="mt-1 w-full border-none p-0 focus:border-transparent focus:outline-none focus:ring-0 sm:text-sm"
/>
</label>
<label
htmlFor="video_url"
className="block overflow-hidden rounded-md border border-gray-200 px-3 py-2 shadow-sm focus-within:border-blue-600 focus-within:ring-1 focus-within:ring-blue-600"
>
<span className="text-xs font-medium text-gray-700"> 视频链接 </span>

<input
type="text"
id="video_url"
placeholder="输入视频链接"
value={image?.video_url}
onChange={(e) => setImageEditData({...image, video_url: e.target.value})}
className="mt-1 w-full border-none p-0 focus:border-transparent focus:outline-none focus:ring-0 sm:text-sm"
/>
</label>
<label
htmlFor="detail"
className="block overflow-hidden rounded-md border border-gray-200 px-3 py-2 shadow-sm focus-within:border-blue-600 focus-within:ring-1 focus-within:ring-blue-600"
Expand Down
2 changes: 1 addition & 1 deletion components/admin/list/ImageHelpSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default function ImageHelpSheet() {
}}
modal={false}
>
<SheetContent side="left" className="overflow-y-auto scrollbar-hide">
<SheetContent side="left" className="w-full overflow-y-auto scrollbar-hide">
<SheetHeader>
<SheetTitle>帮助</SheetTitle>
<SheetDescription className="space-y-2">
Expand Down
17 changes: 11 additions & 6 deletions components/admin/list/ImageView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ import { fetcher } from '~/lib/utils/fetcher'
import useSWR from 'swr'
import ExifView from '~/components/ExifView'
import { Switch } from '~/components/ui/switch'
import LivePhoto from '~/components/LivePhoto.tsx'

export default function ImageView() {
const { imageView, imageViewData, setImageView, setImageViewData } = useButtonStore(
(state) => state,
)
const { data, isLoading } = useSWR('/api/v1/copyrights/get', fetcher)
const { data } = useSWR('/api/v1/copyrights/get', fetcher)

const fieldNames = { label: 'name', value: 'id' }

Expand All @@ -33,15 +34,19 @@ export default function ImageView() {
}
}}
>
<SheetContent side="left" className="overflow-y-auto scrollbar-hide">
<SheetContent side="left" className="w-full overflow-y-auto scrollbar-hide">
<SheetHeader>
<SheetTitle>{imageViewData.title}</SheetTitle>
</SheetHeader>
<div className="mt-4 space-y-2">
<img
src={imageViewData.preview_url || imageViewData.url}
alt={imageViewData.detail}
/>
{imageViewData?.type === 1 ?
<img
src={imageViewData.preview_url || imageViewData.url}
alt={imageViewData.detail}
/>
:
<LivePhoto url={imageViewData.preview_url || imageViewData.url} videoUrl={imageViewData.video_url} />
}
{imageViewData?.labels &&
<div className="space-x-1">
{imageViewData?.labels.map((tag: string) => (
Expand Down
2 changes: 1 addition & 1 deletion components/admin/settings/storages/AListEditSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default function AListEditSheet() {
}}
modal={false}
>
<SheetContent side="left" className="overflow-y-auto scrollbar-hide" onInteractOutside={(event: any) => event.preventDefault()}>
<SheetContent side="left" className="w-full overflow-y-auto scrollbar-hide" onInteractOutside={(event: any) => event.preventDefault()}>
<SheetHeader>
<SheetTitle>编辑 AList</SheetTitle>
</SheetHeader>
Expand Down
2 changes: 1 addition & 1 deletion components/admin/settings/storages/R2EditSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default function S3EditSheet() {
}}
modal={false}
>
<SheetContent side="left" className="overflow-y-auto scrollbar-hide" onInteractOutside={(event: any) => event.preventDefault()}>
<SheetContent side="left" className="w-full overflow-y-auto scrollbar-hide" onInteractOutside={(event: any) => event.preventDefault()}>
<SheetHeader>
<SheetTitle>编辑 Cloudflare R2</SheetTitle>
</SheetHeader>
Expand Down
2 changes: 1 addition & 1 deletion components/admin/settings/storages/S3EditSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default function S3EditSheet() {
}}
modal={false}
>
<SheetContent side="left" className="overflow-y-auto scrollbar-hide" onInteractOutside={(event: any) => event.preventDefault()}>
<SheetContent side="left" className="w-full overflow-y-auto scrollbar-hide" onInteractOutside={(event: any) => event.preventDefault()}>
<SheetHeader>
<SheetTitle>编辑 S3</SheetTitle>
</SheetHeader>
Expand Down
2 changes: 1 addition & 1 deletion components/admin/upload/FileUpload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,7 @@ export default function FileUpload() {
}}
modal={false}
>
<SheetContent side="left" className="overflow-y-auto scrollbar-hide space-y-2"
<SheetContent side="left" className="w-full overflow-y-auto scrollbar-hide space-y-2"
onInteractOutside={(event: any) => event.preventDefault()}>
<SheetHeader>
<SheetTitle>手动上传</SheetTitle>
Expand Down
2 changes: 1 addition & 1 deletion components/admin/upload/FileUploadHelpSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default function FileUploadHelpSheet() {
}}
modal={false}
>
<SheetContent side="left" className="overflow-y-auto scrollbar-hide">
<SheetContent side="left" className="w-full overflow-y-auto scrollbar-hide">
<SheetHeader>
<SheetTitle>帮助</SheetTitle>
<SheetDescription className="space-y-2">
Expand Down
2 changes: 1 addition & 1 deletion components/ui/sheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ const SheetHeader = ({
}: React.HTMLAttributes<HTMLDivElement>) => (
<div
className={cn(
"flex flex-col space-y-2 text-center sm:text-left",
"flex flex-col space-y-2 text-center text-left",
className
)}
{...props}
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "picimpact",
"version": "2.0.3",
"version": "2.0.4",
"private": true,
"author": "Bess Croft <besscroft@foxmail.com>",
"packageManager": "pnpm@9.7.1",
Expand Down Expand Up @@ -49,10 +49,10 @@
"crypto-js": "^4.2.0",
"cuid": "^3.0.0",
"dayjs": "^1.11.13",
"exifreader": "^4.24.0",
"framer-motion": "^11.11.10",
"exifreader": "^4.25.0",
"framer-motion": "^11.11.17",
"heic2any": "^0.0.4",
"hono": "^4.6.7",
"hono": "^4.6.11",
"input-otp": "^1.2.4",
"livephotoskit": "^1.5.6",
"lucide-react": "^0.454.0",
Expand Down
36 changes: 18 additions & 18 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion server/db/operate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,14 +214,15 @@ export async function updateImage(image: ImageType) {
image.sort = 0
}
await db.$transaction(async (tx) => {
const resultRow = await tx.images.update({
await tx.images.update({
where: {
id: image.id
},
data: {
url: image.url,
title: image.title,
preview_url: image.preview_url,
video_url: image.video_url,
exif: image.exif,
labels: image.labels,
detail: image.detail,
Expand Down

0 comments on commit 1d1d74f

Please sign in to comment.