From 5e6e79d82aabb7b03bf8751c0668e6c68413c0ed Mon Sep 17 00:00:00 2001
From: fishshi <2855691008@qq.com>
Date: Mon, 16 Dec 2024 16:23:28 +0800
Subject: [PATCH] fix CollectionPoster
---
.../Showcase/posters/CollectionPoster.tsx | 59 ++++++++++---------
.../contextMenu/CollectionCM/main.tsx | 18 +++++-
2 files changed, 47 insertions(+), 30 deletions(-)
diff --git a/src/renderer/src/components/Showcase/posters/CollectionPoster.tsx b/src/renderer/src/components/Showcase/posters/CollectionPoster.tsx
index e45ba7f..245bb6a 100644
--- a/src/renderer/src/components/Showcase/posters/CollectionPoster.tsx
+++ b/src/renderer/src/components/Showcase/posters/CollectionPoster.tsx
@@ -18,25 +18,26 @@ export function CollectionPoster({
const gameId = collections[collctionId].games[0]
const length = collections[collctionId].games.length
return (
-
navigate(`/library/collections/${collctionId}`)}
- >
- {/* background mask layer */}
+
+ onClick={() => navigate(`/library/collections/${collctionId}`)}
+ >
+ {/* background mask layer */}
+
+
+ {/* HoverBigCardAnimation layer */}
- {/* HoverBigCardAnimation layer */}
-
-
- {/* text content layer */}
-
-
-
{collectionName}
-
{`( ${length} )`}
+ {/* text content layer */}
+
+
+
+ {collectionName}
+
+
{`( ${length} )`}
+
-
+
)
}
diff --git a/src/renderer/src/components/contextMenu/CollectionCM/main.tsx b/src/renderer/src/components/contextMenu/CollectionCM/main.tsx
index 15f5036..600d57f 100644
--- a/src/renderer/src/components/contextMenu/CollectionCM/main.tsx
+++ b/src/renderer/src/components/contextMenu/CollectionCM/main.tsx
@@ -21,7 +21,7 @@ import {
} from '@ui/alert-dialog'
import { useCollections } from '~/hooks'
import { cn } from '~/utils'
-import { useState } from 'react'
+import { useEffect, useState } from 'react'
export function CollectionCM({
collectionId,
@@ -33,6 +33,13 @@ export function CollectionCM({
const { renameCollection, removeCollection, collections } = useCollections()
const [newName, setNewName] = useState
('')
const [isOpen, setIsOpen] = useState(false)
+
+ useEffect(() => {
+ if (collections[collectionId].name !== newName) {
+ setNewName(collections[collectionId].name)
+ }
+ }, [collections[collectionId].name])
+
return (
{children}
@@ -59,12 +66,19 @@ export function CollectionCM({
+