feat(extension): support list view and persisted page size in plugin market#6727
feat(extension): support list view and persisted page size in plugin market#6727RhoninSeiei wants to merge 1 commit intoAstrBotDevs:masterfrom
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the plugin market by adding a list view and allowing users to customize the number of plugins displayed per page. It also persists these preferences using localStorage. The changes improve the browsing and filtering experience for users as the number of plugins grows. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- Consider extracting the repeated
window.localStorageaccess logic (for list view mode and items-per-page) into a small utility/composable to centralize key names, default values, and environment checks instead of duplicating this pattern inuseExtensionPage. - The list view table currently formats updated time with
new Date(item.updated_at).toLocaleDateString()and labels stars asStar {{ item.stars }}directly in the template; it would be more consistent with the rest of the page to move this into i18n-aware helpers/computed properties (including localized date formatting and translatable labels). - Since
v-data-tableis already driven bypaginatedPlugins, passing:items-per-page="marketItemsPerPage"is redundant and may be confusing; either rely onitems-per-pagefor paging or keep all pagination in thepaginatedPluginscomputed, but avoid mixing both mechanisms.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider extracting the repeated `window.localStorage` access logic (for list view mode and items-per-page) into a small utility/composable to centralize key names, default values, and environment checks instead of duplicating this pattern in `useExtensionPage`.
- The list view table currently formats updated time with `new Date(item.updated_at).toLocaleDateString()` and labels stars as `Star {{ item.stars }}` directly in the template; it would be more consistent with the rest of the page to move this into i18n-aware helpers/computed properties (including localized date formatting and translatable labels).
- Since `v-data-table` is already driven by `paginatedPlugins`, passing `:items-per-page="marketItemsPerPage"` is redundant and may be confusing; either rely on `items-per-page` for paging or keep all pagination in the `paginatedPlugins` computed, but avoid mixing both mechanisms.
## Individual Comments
### Comment 1
<location path="dashboard/src/views/extension/useExtensionPage.js" line_range="253-247" />
<code_context>
+ }
+ return 9;
+ };
+ const marketItemsPerPageOptions = [9, 25, 50, 100];
+ const marketItemsPerPage = ref(getInitialMarketItemsPerPage());
const sortBy = ref("default"); // default, stars, author, updated
</code_context>
<issue_to_address>
**suggestion:** Use the `marketItemsPerPageOptions` constant instead of duplicating the literal array.
In `getInitialMarketItemsPerPage`, the valid values `[9, 25, 50, 100]` are duplicated instead of using `marketItemsPerPageOptions`. This can cause the validation list to drift from the actual options if only one is updated. Referencing `marketItemsPerPageOptions` (e.g. `marketItemsPerPageOptions.includes(rawValue)`) will keep them aligned.
Suggested implementation:
```javascript
const marketIsListView = ref(getInitialMarketListViewMode());
const marketItemsPerPageOptions = [9, 25, 50, 100];
const getInitialMarketItemsPerPage = () => {
```
```javascript
const rawValue = Number(localStorage.getItem("pluginMarketItemsPerPage"));
if (marketItemsPerPageOptions.includes(rawValue)) {
```
```javascript
};
const marketItemsPerPage = ref(getInitialMarketItemsPerPage());
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| const getInitialMarketItemsPerPage = () => { | ||
| if (typeof window !== "undefined" && window.localStorage) { | ||
| const rawValue = Number(localStorage.getItem("pluginMarketItemsPerPage")); | ||
| if ([9, 25, 50, 100].includes(rawValue)) { |
There was a problem hiding this comment.
suggestion: Use the marketItemsPerPageOptions constant instead of duplicating the literal array.
In getInitialMarketItemsPerPage, the valid values [9, 25, 50, 100] are duplicated instead of using marketItemsPerPageOptions. This can cause the validation list to drift from the actual options if only one is updated. Referencing marketItemsPerPageOptions (e.g. marketItemsPerPageOptions.includes(rawValue)) will keep them aligned.
Suggested implementation:
const marketIsListView = ref(getInitialMarketListViewMode());
const marketItemsPerPageOptions = [9, 25, 50, 100];
const getInitialMarketItemsPerPage = () => { const rawValue = Number(localStorage.getItem("pluginMarketItemsPerPage"));
if (marketItemsPerPageOptions.includes(rawValue)) { };
const marketItemsPerPage = ref(getInitialMarketItemsPerPage());
参考 #6664 和 #6650 中的需求
背景
当前插件市场仅支持卡片视图,且每页固定显示 9 个插件。随着插件数量增加,浏览与筛选成本会明显上升。Issue #6664 提出希望补充列表视图,#6650 支持记住每页显示数量。
Modifications / 改动点
9 / 25 / 50 / 100localStorage设计说明
影响范围
改动仅涉及 Dashboard 前端插件市场页面,不影响插件市场接口、插件安装逻辑以及各消息平台适配器行为。
Screenshots or Test Results / 运行截图或测试结果(过曝是因为HDR还请见谅)
列表视图25格

切换选项

持久化后调节器的每页格数刷新后也能保存下来

运行验证
Checklist / 检查清单
requirements.txt和pyproject.toml文件相应位置。/ I have ensured that no new dependencies are introduced, OR if new dependencies are introduced, they have been added to the appropriate locations inrequirements.txtandpyproject.toml.Summary by Sourcery
Add a list view and configurable, persisted page size to the plugin market, improving discoverability and usability without changing backend behavior.
New Features:
Bug Fixes:
Enhancements:
Documentation: