From 4d6206203b32c3056211bb78a4cdecf21cfbb41f Mon Sep 17 00:00:00 2001 From: meetqy Date: Tue, 7 Mar 2023 14:38:32 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20=E6=94=AF=E6=8C=81gif?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E3=80=81mp4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ✅ Closes: #74 --- components/JustifyLayout/SearchModule/Ext.tsx | 11 ++++---- components/JustifyLayout/index.tsx | 25 +++++++++++++---- package.json | 6 ++-- pnpm-lock.yaml | 28 +++++++++---------- 4 files changed, 42 insertions(+), 28 deletions(-) diff --git a/components/JustifyLayout/SearchModule/Ext.tsx b/components/JustifyLayout/SearchModule/Ext.tsx index 30e77e77..0ba56078 100644 --- a/components/JustifyLayout/SearchModule/Ext.tsx +++ b/components/JustifyLayout/SearchModule/Ext.tsx @@ -7,11 +7,12 @@ interface Props { } const options: DefaultOptionType[] = [ - { value: "jpg", label: "jpg" }, - { value: "jpeg", label: "jpeg" }, - { value: "gif", label: "gif" }, - { value: "webp", label: "webp" }, - { value: "png", label: "png" }, + { value: "jpg", label: "JPG" }, + { value: "jpeg", label: "JPEG" }, + { value: "gif", label: "GIF" }, + { value: "webp", label: "WEBP" }, + { value: "png", label: "PNG" }, + { value: "mp4", label: "MP4" }, ]; const Ext = (props: Props) => { diff --git a/components/JustifyLayout/index.tsx b/components/JustifyLayout/index.tsx index f572bbf7..59909586 100644 --- a/components/JustifyLayout/index.tsx +++ b/components/JustifyLayout/index.tsx @@ -1,6 +1,6 @@ import Image from "next/image"; import justifyLayout from "justified-layout"; -import { Button, Card, Layout, Row, Col, theme, Empty } from "antd"; +import { Button, Card, Layout, Row, Col, theme, Empty, Badge } from "antd"; import { useEffect, useMemo, useState } from "react"; import { handleImageAlt, handleImageUrl } from "@/hooks"; import { useRecoilState } from "recoil"; @@ -56,7 +56,7 @@ const JustifyLayout = ({ infiniteScroll, header }: Props) => { const { token } = theme.useToken(); const activeImage = useMemo(() => rightBasic.image, [rightBasic]); const { data, loadMore, loadingMore, noMore } = infiniteScroll; - const images = useMemo(() => data.list, [data]); + const images = useMemo(() => data.list as EagleUse.Image[], [data]); const size = useSize(() => document.body); const [open, setOpen] = useState(false); @@ -104,17 +104,15 @@ const JustifyLayout = ({ infiniteScroll, header }: Props) => { {layoutPos.boxes.map((item, i: number) => { const image = images[i]; if (!image) return null; + const palettes: EagleUse.ImagePalette = image.processingPalette ? null : JSON.parse(image.palettes); - return ( + const card = ( { /> ); + + return ( +
+ {["gif", "mp4"].includes(image.ext.toLocaleLowerCase()) ? ( + + {card} + + ) : ( + card + )} +
+ ); })} diff --git a/package.json b/package.json index a8cf9b9f..ec338970 100644 --- a/package.json +++ b/package.json @@ -40,9 +40,9 @@ "@ant-design/icons": "^4.8.0", "@commitlint/cli": "^17.4.1", "@commitlint/config-conventional": "^17.4.0", - "@eagleuse/plugin-api": "^1.1.7", + "@eagleuse/plugin-api": "^1.2.0", "@eagleuse/plugin-nsfw": "^1.1.0", - "@eagleuse/transform-eagle": "^1.1.17", + "@eagleuse/transform-eagle": "^1.2.1", "@fastify/nextjs": "^9.2.0", "@prisma/client": "^4.10.1", "@types/justified-layout": "^4.1.0", @@ -67,7 +67,7 @@ "standard-version": "^9.5.0" }, "devDependencies": { - "@eagleuse/prisma-client": "^1.0.2", + "@eagleuse/prisma-client": "^1.1.0", "@tensorflow/tfjs-node": "^4.2.0", "@types/fs-extra": "^9.0.13", "@types/lodash": "^4.14.191", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 83699594..ccede449 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4,10 +4,10 @@ specifiers: "@ant-design/icons": ^4.8.0 "@commitlint/cli": ^17.4.1 "@commitlint/config-conventional": ^17.4.0 - "@eagleuse/plugin-api": ^1.1.7 + "@eagleuse/plugin-api": ^1.2.0 "@eagleuse/plugin-nsfw": ^1.1.0 - "@eagleuse/prisma-client": ^1.0.2 - "@eagleuse/transform-eagle": ^1.1.17 + "@eagleuse/prisma-client": ^1.1.0 + "@eagleuse/transform-eagle": ^1.2.1 "@fastify/nextjs": ^9.2.0 "@prisma/client": ^4.10.1 "@tensorflow/tfjs-node": ^4.2.0 @@ -55,9 +55,9 @@ dependencies: "@ant-design/icons": 4.8.0_biqbaboplfbrettd7655fr4n2y "@commitlint/cli": 17.4.1 "@commitlint/config-conventional": 17.4.0 - "@eagleuse/plugin-api": 1.1.7 + "@eagleuse/plugin-api": 1.2.0 "@eagleuse/plugin-nsfw": 1.1.0_encoding@0.1.13 - "@eagleuse/transform-eagle": 1.1.17 + "@eagleuse/transform-eagle": 1.2.1 "@fastify/nextjs": 9.2.0_next@13.1.1 "@prisma/client": 4.10.1_prisma@4.10.1 "@types/justified-layout": 4.1.0 @@ -82,7 +82,7 @@ dependencies: standard-version: 9.5.0 devDependencies: - "@eagleuse/prisma-client": 1.0.2 + "@eagleuse/prisma-client": 1.1.0 "@tensorflow/tfjs-node": 4.2.0_encoding@0.1.13 "@types/fs-extra": 9.0.13 "@types/lodash": 4.14.191 @@ -490,13 +490,13 @@ packages: engines: { node: ">=10" } dev: false - /@eagleuse/plugin-api/1.1.7: + /@eagleuse/plugin-api/1.2.0: resolution: { - integrity: sha512-yjidraUq7YBtwudoyFRLp2qT2tkUTE00cRcpFOR2yFeUF0kd201JOvznF3WXoVwQ7n0AYrPF3RRJpj8pc4wh6A==, + integrity: sha512-2AJTaz/Ig/QuGh99czWxDgfjFQ9sdE31O4sd6lsJCJDQtjNLztK2qz2vlb3FHeSiCGlYUQBimbOoJHPHmXI1uw==, } dependencies: - "@eagleuse/prisma-client": 1.0.2 + "@eagleuse/prisma-client": 1.1.0 "@eagleuse/utils": 1.0.5 "@fastify/cors": 8.2.0 "@fastify/static": 6.9.0 @@ -523,22 +523,22 @@ packages: - supports-color dev: false - /@eagleuse/prisma-client/1.0.2: + /@eagleuse/prisma-client/1.1.0: resolution: { - integrity: sha512-MLANzz2UwIhb297WWPK7D4vAbB+FxBohUQduZcBUDAvgaPvHKhESnYNs1LCgwEkXfB8RoX2MIFz+2ISn4bn/tw==, + integrity: sha512-lzYEcc9ZfjEu+wsb17qyE2ytllkR5BEBSAUXFEgoJwPLmHkYTF7P7fE7E8Wey+CGS4qLkLhmPVvfh/DikZdt0A==, } dependencies: "@prisma/client": 4.10.1_prisma@4.10.1 prisma: 4.10.1 - /@eagleuse/transform-eagle/1.1.17: + /@eagleuse/transform-eagle/1.2.1: resolution: { - integrity: sha512-NhM3k+ZEtLUCA7dpfBdgvL7uTlmv+VKtONP5B86yiNLeR3VDwdLbcshSq3hXTqhhmJuQY5a7jCkMBCF2gAIYrA==, + integrity: sha512-CkWFbZZJOFkC7KgSXljCl5pBNo3c9+psBLHnt5ueO7ufGqiuSMIwCUM8fiXcuFfRChue2wobFdgyH26lGEs3BA==, } dependencies: - "@eagleuse/prisma-client": 1.0.2 + "@eagleuse/prisma-client": 1.1.0 "@eagleuse/utils": 1.0.5 chokidar: 3.5.3 dotenv: 16.0.3