Skip to content

style: 优化令人抓狂的样式#473

Merged
ikenxuan merged 12 commits intomainfrom
fix-ui
Jun 12, 2025
Merged

style: 优化令人抓狂的样式#473
ikenxuan merged 12 commits intomainfrom
fix-ui

Conversation

@ikenxuan
Copy link
Collaborator

No description provided.

ikenxuan added 5 commits June 11, 2025 19:57
修复侧边栏退出登录时重复跳转的问题,移除finally中的冗余跳转
为switch组件添加禁用状态支持,包括样式和交互处理
优化插件配置页面的作者信息展示,添加头像回退和边框效果
修复插件详情模态打开时配置详情模态仍显示的问题,通过添加条件判断只在插件详情模态关闭时显示配置详情模态。同时优化移动端布局,包括按钮样式调整和响应式布局改进。
统一使用Button组件替代手动实现的按钮样式,提高代码一致性和可维护性
- 将按钮变体从ghost改为flat
- 为按钮添加glass-effect类名
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Jun 11, 2025

好的,这是将 pull request review guide 翻译成简体中文的结果:

🧙 Sourcery 已经完成了对您的 pull request 的审查!


提示和命令

与 Sourcery 互动

  • 触发新的审查: 在 pull request 上评论 @sourcery-ai review
  • 继续讨论: 直接回复 Sourcery 的审查评论。
  • 从审查评论生成 GitHub issue: 回复审查评论,让 Sourcery 从该评论创建一个 issue。您也可以回复审查评论并加上 @sourcery-ai issue 来从中创建一个 issue。
  • 生成 pull request 标题: 在 pull request 标题中任何位置写入 @sourcery-ai 以随时生成标题。您也可以在 pull request 上评论 @sourcery-ai title 以随时(重新)生成标题。
  • 生成 pull request 摘要: 在 pull request 正文中任何位置写入 @sourcery-ai summary 以随时在您想要的位置生成 PR 摘要。您也可以在 pull request 上评论 @sourcery-ai summary 以随时(重新)生成摘要。
  • 生成审查者指南: 在 pull request 上评论 @sourcery-ai guide 以随时(重新)生成审查者指南。
  • 解决所有 Sourcery 评论: 在 pull request 上评论 @sourcery-ai resolve 以解决所有 Sourcery 评论。如果您已经处理了所有评论并且不想再看到它们,这将非常有用。
  • 驳回所有 Sourcery 审查: 在 pull request 上评论 @sourcery-ai dismiss 以驳回所有现有的 Sourcery 审查。如果您想从一个新的审查开始,这将特别有用 - 别忘了评论 @sourcery-ai review 以触发新的审查!

自定义您的体验

访问您的 仪表盘 以:

  • 启用或禁用审查功能,例如 Sourcery 生成的 pull request 摘要、审查者指南等。
  • 更改审查语言。
  • 添加、删除或编辑自定义审查说明。
  • 调整其他审查设置。

获取帮助

Original review guide in English

🧙 Sourcery has finished reviewing your pull request!


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

@ikenxuan - 我已经查看了你的更改 - 这里有一些反馈:

  • 跨组件存在大量重复的 Button props 和 Tailwind classNames——考虑创建一个共享的 Button 包装器或默认 props 来 DRY 这些样式。
  • ConfigDetailModal 已经变得相当大,具有单独的移动/桌面页脚——将这些部分提取到更小的子组件中将提高可读性和可维护性。
  • 在 createSwitch 中,你正在生成动态的 Tailwind 类,如 text-${props.color}-300,PurgeCSS 可能会将其删除;考虑使用固定的类映射或白名单以避免在生产环境中丢失样式。
以下是我在审查期间查看的内容
  • 🟡 一般问题:发现 3 个问题
  • 🟢 安全性:一切看起来都很好
  • 🟢 测试:一切看起来都很好
  • 🟢 复杂性:一切看起来都很好
  • 🟢 文档:一切看起来都很好

Sourcery 对开源项目是免费的 - 如果你喜欢我们的评论,请考虑分享它们 ✨
帮助我变得更有用!请点击每个评论上的 👍 或 👎,我将使用这些反馈来改进你的评论。
Original comment in English

Hey @ikenxuan - I've reviewed your changes - here's some feedback:

  • There’s a lot of repeated Button props and Tailwind classNames across components—consider creating a shared Button wrapper or default props to DRY up these styles.
  • ConfigDetailModal has grown quite large with separate mobile/desktop footers—extracting those sections into smaller subcomponents would improve readability and maintainability.
  • In createSwitch you’re generating dynamic Tailwind classes like text-${props.color}-300, which PurgeCSS may strip out; consider using a fixed class map or whitelisting to avoid missing styles in production.
Here's what I looked at during the review
  • 🟡 General issues: 3 issues found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

hideCloseButton={false}
isDismissable
isKeyboardDismissDisabled={false}
portalContainer={document.body}
Copy link
Contributor

Choose a reason for hiding this comment

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

问题 (bug_risk): 直接使用 document.body 可能会破坏 SSR

portalContainer 的设置推迟到仅客户端生效,或使用 typeof window !== 'undefined' 进行保护,以避免 SSR 错误。

Original comment in English

issue (bug_risk): Using document.body directly may break SSR

Defer setting portalContainer to a client-only effect or guard with typeof window !== 'undefined' to avoid SSR errors.


const handleContainerClick = (e: React.MouseEvent) => {
// 如果组件被禁用,不触发开关切换
if (isDisabled) return
Copy link
Contributor

Choose a reason for hiding this comment

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

建议: 添加 aria-disabled 以增强可访问性

在根元素上添加 aria-disabled 将增强屏幕阅读器用户在开关禁用时的可访问性。

Original comment in English

suggestion: Add aria-disabled for accessibility

Adding aria-disabled to the root element will enhance accessibility for screen reader users when the switch is disabled.


return (
<div className='space-y-4'>
<Card className='p-4 lg:p-6 sticky top-0 md:top-[23px] lg:top-[23px] z-10 bg-opacity-5 justify-center gap-2 backdrop-blur-xl bg-gradient-to-br from-white/20 via-white/10 to-white/5 dark:from-white/15 dark:via-white/8 dark:to-white/3 border-t border-lborder-r border-b border-white/10 dark:border-white/5 shadow-2xl transition-all duration-500 overflow-hidden before:absolute before:inset-0 before:bg-gradient-to-br before:from-white/10 before:via-transparent before:to-transparent before:opacity-0 before:transition-opacity before:duration-300'>
Copy link
Contributor

Choose a reason for hiding this comment

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

问题 (typo): Tailwind 边框类中的错别字

border-lborder-r 之间缺少空格,因此该类未正确应用。请更新为 border-l border-r

Suggested change
<Card className='p-4 lg:p-6 sticky top-0 md:top-[23px] lg:top-[23px] z-10 bg-opacity-5 justify-center gap-2 backdrop-blur-xl bg-gradient-to-br from-white/20 via-white/10 to-white/5 dark:from-white/15 dark:via-white/8 dark:to-white/3 border-t border-lborder-r border-b border-white/10 dark:border-white/5 shadow-2xl transition-all duration-500 overflow-hidden before:absolute before:inset-0 before:bg-gradient-to-br before:from-white/10 before:via-transparent before:to-transparent before:opacity-0 before:transition-opacity before:duration-300'>
<Card className='p-4 lg:p-6 sticky top-0 md:top-[23px] lg:top-[23px] z-50 bg-opacity-5 justify-center gap-2 backdrop-blur-xl bg-gradient-to-br from-white/20 via-white/10 to-white/5 dark:from-white/15 dark:via-white/8 dark:to-white/3 border-t border-l border-r border-b border-white/10 dark:border-white/5 shadow-2xl transition-all duration-500 overflow-hidden before:absolute before:inset-0 before:bg-gradient-to-br before:from-white/10 before:via-transparent before:to-transparent before:opacity-0 before:transition-opacity before:duration-300'>
Original comment in English

issue (typo): Typo in Tailwind border classes

There's a missing space between border-l and border-r, so the class isn't applied correctly. Please update to border-l border-r.

Suggested change
<Card className='p-4 lg:p-6 sticky top-0 md:top-[23px] lg:top-[23px] z-10 bg-opacity-5 justify-center gap-2 backdrop-blur-xl bg-gradient-to-br from-white/20 via-white/10 to-white/5 dark:from-white/15 dark:via-white/8 dark:to-white/3 border-t border-lborder-r border-b border-white/10 dark:border-white/5 shadow-2xl transition-all duration-500 overflow-hidden before:absolute before:inset-0 before:bg-gradient-to-br before:from-white/10 before:via-transparent before:to-transparent before:opacity-0 before:transition-opacity before:duration-300'>
<Card className='p-4 lg:p-6 sticky top-0 md:top-[23px] lg:top-[23px] z-50 bg-opacity-5 justify-center gap-2 backdrop-blur-xl bg-gradient-to-br from-white/20 via-white/10 to-white/5 dark:from-white/15 dark:via-white/8 dark:to-white/3 border-t border-l border-r border-b border-white/10 dark:border-white/5 shadow-2xl transition-all duration-500 overflow-hidden before:absolute before:inset-0 before:bg-gradient-to-br before:from-white/10 before:via-transparent before:to-transparent before:opacity-0 before:transition-opacity before:duration-300'>

ikenxuan added 7 commits June 12, 2025 14:32
- 将火箭图标替换为向上箭头并添加进度环显示滚动百分比
- 实现滚动时显示百分比,停止滚动后显示箭头的动画效果
- 添加Tooltip提示并改进按钮的视觉效果和交互
- 优化边缘检测和拖拽逻辑,提升用户体验
...渲染压力好大
在描述文本的className中添加break-all以允许在任何字符处换行,避免长文本溢出
@github-actions
Copy link
Contributor

你可以通过以下命令安装该版本:

pnpm add https://pkg.pr.new/node-karin@6bf02d5 -w

@ikenxuan ikenxuan merged commit 618f064 into main Jun 12, 2025
3 checks passed
@ikenxuan ikenxuan deleted the fix-ui branch June 12, 2025 16:02
@github-actions github-actions bot mentioned this pull request Jun 12, 2025
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