Skip to content

Commit

Permalink
fix: 🐛 图片颜色处理中,页面显示错误
Browse files Browse the repository at this point in the history
  • Loading branch information
meetqy committed Feb 1, 2023
1 parent 086d67d commit 430e17c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
9 changes: 7 additions & 2 deletions components/JustifyLayout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { useEffect, useMemo, useState } from "react";
import { handleImageAlt, handleImageUrl } from "@/hooks";
import { useRecoilState } from "recoil";
import { rightBasicState } from "@/store";
import _ from "lodash";

interface LayoutBox {
aspectRatio: number;
Expand Down Expand Up @@ -94,7 +95,9 @@ const JustifyLayout = ({ infiniteScroll, header }: Props) => {
{layoutPos.boxes.map((item, i: number) => {
const image = images[i];
if (!image) return null;
const palettes: EagleUse.ImagePalette = JSON.parse(image.palettes);
const palettes: EagleUse.ImagePalette = image.processingPalette
? null
: JSON.parse(image.palettes);

return (
<Card
Expand All @@ -103,7 +106,9 @@ const JustifyLayout = ({ infiniteScroll, header }: Props) => {
style={{
...item,
position: "absolute",
background: `rgb(${palettes[0].color}, .25)`,
background: !_.isEmpty(palettes)
? `rgb(${palettes[0].color}, .25)`
: token.colorBgBase,
overflow: "hidden",
outline:
activeImage?.id === image.id
Expand Down
4 changes: 2 additions & 2 deletions env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ namespace EagleUse {
modificationTime: number;
width: number;
height: number;
// json字符串
palettes: string;
lastModified: number;
isDeleted: boolean;
deletedTime: number;
// json字符串
processingPalette: string;
processingPalette: boolean;
noThumbnail: boolean;
star: number;
tags?: Tag[];
Expand Down

0 comments on commit 430e17c

Please sign in to comment.