Skip to content

feat: support series argument for unlockCg#954

Open
ChangeSuger wants to merge 1 commit into
OpenWebGAL:devfrom
ChangeSuger:feat/extra-series
Open

feat: support series argument for unlockCg#954
ChangeSuger wants to merge 1 commit into
OpenWebGAL:devfrom
ChangeSuger:feat/extra-series

Conversation

@ChangeSuger
Copy link
Copy Markdown
Contributor

changeCg 指令的 series 参数目前似乎完全没使用,补充了一下基于 series 将 cg 进行分组的逻辑,并增加 order 参数,用于控制统一分组下 CG 的展示顺序。

在预览时,如果有多张图片,点击图片会切换到下一张图片,如果没有下一张,则退出预览状态。

此外,基于 series 进行分组逻辑只针对图片,视频仍单独展示。

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request implements grouping and ordering for CG assets in the gallery by adding an 'order' property to the asset interface and updating the 'changeBg' and 'unlockCg' scripts. The gallery UI was refactored to group assets by series and sort them, while the preview component now supports cycling through grouped images. Feedback was provided to remove a redundant 'isImage' memoization in 'ExtraCgElement.tsx' to simplify the code.

Comment on lines 32 to +35
const isImage = useMemo(() => {
const extension = props.resourceUrl.split('.').pop()?.toLowerCase() || '';
const extension = previewResource.url.split('.').pop()?.toLowerCase() || '';
return ['jpg', 'jpeg', 'png', 'gif', 'webp', 'svg', 'bmp'].includes(extension);
}, [props.resourceUrl]);
}, [previewResource.url]);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

isImage 的 memo 检查是多余的,因为在 renderMedia 函数中,isImage 分支和 else 分支(回退逻辑)的代码逻辑完全相同。删除它可以简化组件逻辑并减少不必要的计算。

  // 移除冗余的 isImage 检查

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant