Repository navigation
完善首页布局、侧栏和个人主页 - #13
PythonSmall-Q wants to merge 3 commits into
Conversation
Co-authored-by: PythonSmall-Q <106425289+PythonSmall-Q@users.noreply.github.com>
Co-authored-by: PythonSmall-Q <106425289+PythonSmall-Q@users.noreply.github.com>
|
Claude finished @PythonSmall-Q's task in 3m 20s —— View job PR 审查:完善首页布局、侧栏和个人主页
总体评价方向不错:首页改为双栏信息密度更合理,个人主页补上了判题统计/趋势,侧栏常驻状态能持久化, 不过有 1 个功能性 bug 和 1 个统计逻辑错误,建议修复后再合并。 主要问题1. [高] 已在讨论页时,点击 BBS 通知无反应,并残留过期 target 2. [中] 失败次数漏掉编译错误 3. [中低] Ctrl+B 会隐式把侧栏设为“常驻” 4. [低] 首页右栏为空时仍占位 5. [低] 饼图配色重复定义 其他建议
仓库规则检查
验证说明本环境未安装 |
|
@PythonSmall-Q 欸我刚说要开始改 PR 怎么就交过来了() |
| await loadPosts(); | ||
| const target = navigation.consumeDiscussionTarget(); | ||
| if (target) | ||
| await openThread(target.postId, target.page); |
There was a problem hiding this comment.
这里只在 onMounted 时消费一次 discussionTarget,但 App.vue 是用 v-else-if="view === 'discussion'" 渲染 Discussion 的:当用户已经停留在讨论页(比如正在看另一个帖子)时,点击 BBS 通知只会把 currentView 重新赋值为 'discussion',组件不会重新挂载,onMounted 不会再执行,因此点击“看起来没反应”。
更糟的是 target 会留在 store 里,等用户先切到别的页面再切回讨论页时被消费,意外打开之前那条通知对应的帖子。
建议把 pending target 以响应式 ref 暴露出来,在 Discussion 内 watch 并在消费后清空;或者让 openDiscussion 通过已注册的 handler 直接调用 openThread,而不是依赖挂载时机。
| const acceptedTotal = findCount(rows, /^(正确|通过|accepted)$/i); | ||
| const solved = solvedTotal ?? problems.length; | ||
| const failures = stats | ||
| .filter((entry) => entry.result >= 5 && entry.result <= 10) |
There was a problem hiding this comment.
electron/parsers.ts:392 里 11 对应的是 Compile Error。这里的 >= 5 && <= 10 会把编译错误排除在失败数之外,导致 calculateRating 里的成功率偏高(把 CE 当成了成功提交)。若意图是统计所有非 AC 的终态,区间应改为 <= 11,同时继续排除 0–3 的 pending 状态。
| function setOpen(value: boolean, persist = true) { | ||
| open.value = value; | ||
| if (persist) { | ||
| pinnedOpen.value = value; |
There was a problem hiding this comment.
setOpen 的默认 persist = true 会隐藏一个行为变化:toggleSidebar()(Ctrl+B 快捷键)调用的是 setOpen(!open.value),于是每按一次快捷键都会把 pinnedOpen 改成当前状态并写入 localStorage。结果是用快捷键“打开”侧栏会变成永久常驻,和悬停展开时显式传 false 的行为不一致(Sidebar.vue:43 等处)。
如果快捷键只应切换显隐,应传 false;如果确实想让 Ctrl+B 设置常驻,请确认这是预期产品行为,并考虑在代码或 UI 上说明。
| class="absolute top-2 right-2 size-4 text-foreground opacity-0 drop-shadow transition-opacity group-hover:opacity-100" | ||
| /> | ||
| </button> | ||
| <div class="space-y-6"> |
There was a problem hiding this comment.
右侧列会始终渲染,即使 countdown 和 notice 都为空。此时网格仍是 1.4fr / 1fr,左侧内容只占约 58% 宽度,右边留出一整块空白。建议给这一列加 v-if="countdown.length > 0 || notice",或在两者皆空时退化为单列布局。
| const total = stats.reduce((sum, item) => sum + item.count, 0); | ||
| if (total === 0) | ||
| return ''; | ||
| const colors = ['#f87171', '#818cf8', '#4ade80', '#f472b6', '#c084fc', '#a8a29e']; |
There was a problem hiding this comment.
这套颜色在 resultPie 里定义了一次,模板图例(UserProfile.vue:178)里又原样写了一遍,并各自 % 6。后续调整配色时很容易只改一处导致饼图与图例不一致。建议提取为一个模块级常量,或让 resultPie computed 一并返回 colors。
|
@zsTree0830 你自己修吧我要去学校上课了 |
|
算了等下我把我写的传上来 |
未经人工测试
这个 PR 的目的是什么?
改善首页信息布局和导航侧栏体验,让讨论通知直达帖子,并补充个人主页的评分与统计图表。
这个 PR 是如何实现的?
not-cached当作源代码显示,并提示代码暂不可查看。测试点详情展示尚未实现。你做了哪些验证?
npm run typechecknpm run test:native-views、npm run test:e2e-readinessnpm test、test:cache、test:async-resource、test:poller、test:markdownnpm run build:dir检查单
git rebase)