Skip to content

Conversation

@Chillln
Copy link
Contributor

@Chillln Chillln commented Oct 8, 2025

  • Make public notes optional to prevent default values causing frontend issues
  • Add dual editing modes: raw text editing and custom fields (avoid hardcoded schema)
  • Set raw text mode as default, populate input on edit, submit raw text content always
  • Add toggle switch: submit raw text when enabled, submit empty & hide controls when disabled
  • New records default to disabled public notes; auto-expand on edit based on content

Close #140

2025-10-08 110149 2025-10-08 110150

- Make public notes optional to prevent default values causing frontend issues
- Add dual editing modes: raw text editing and custom fields (avoid hardcoded schema)
- Set raw text mode as default, populate input on edit, submit raw text content always
- Add toggle switch: submit raw text when enabled, submit empty & hide controls when disabled
- New records default to disabled public notes; auto-expand on edit based on content
@github-actions
Copy link

github-actions bot commented Oct 8, 2025

Linting and formatting issues were automatically fixed. Please review the changes.

@Chillln
Copy link
Contributor Author

Chillln commented Oct 8, 2025

@uubulb 麻烦有空review下

@uubulb
Copy link
Contributor

uubulb commented Oct 8, 2025

公开备注解析的逻辑,不需要组件内部变量的可以放在组件外部

@uubulb
Copy link
Contributor

uubulb commented Oct 8, 2025

PublicNote, defaultPublicNote, parsePublicNote, isValidISOLike, validatePublicNote
normalizeISO, pruneEmpty
这几个都可以放外面,t 可以导入 @/lib/i18ni18n.t 代替

@uubulb
Copy link
Contributor

uubulb commented Oct 8, 2025

setPublicNoteObj

可以再套一层 wrapper,让组件更新可以只传入某个特定字段的值,然后在 wrapper 里再更新 publicNoteObj,可以减少一点重复代码

@uubulb
Copy link
Contributor

uubulb commented Oct 8, 2025

https://github.com/Chillln/admin-frontend/blob/6b524e35f8008b1309992f133eec7ec6993ec4eb/src/components/server.tsx#L204-L231

可否模仿一下 alert-rule 那里,把 PublicNote 写成 zod schema,把验证逻辑交给 zod 处理

Implemented Zod validation patterns, default values, parsing functions, and utility functions for public notes, and updated related internationalization text.
@github-actions
Copy link

github-actions bot commented Oct 8, 2025

Linting and formatting issues were automatically fixed. Please review the changes.

Replace direct use of i18n.t with react-i18next's useTranslation hook to improve internationalization support.
Removed the pruneEmpty function and simplified the date processing logic, making billingDataMod and planDataMod optional fields. Also optimized the validation logic to handle optional fields.
@github-actions
Copy link

github-actions bot commented Oct 8, 2025

Linting and formatting issues were automatically fixed. Please review the changes.

@uubulb
Copy link
Contributor

uubulb commented Oct 8, 2025

@Chillln 请问是否已经完成更改?完成的话我就 approve 了

@Chillln
Copy link
Contributor Author

Chillln commented Oct 8, 2025

@uubulb 已经完成更改

@naiba naiba requested a review from Copilot October 8, 2025 16:17
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances the public notes functionality by making it optional and introducing dual editing modes (raw text and custom fields). The changes aim to prevent frontend issues caused by default values and provide more flexible editing options.

Key changes:

  • Made public notes optional to avoid default value issues
  • Added dual editing modes: raw text editing and structured custom fields
  • Set raw text mode as default with proper validation
  • New records default to disabled public notes with auto-expansion based on content

Reviewed Changes

Copilot reviewed 34 out of 35 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/main.tsx Reorganized import statements for better alphabetical ordering
src/locales/en/translation.json Added new translation keys for public note features and removed unused entries
src/locales/zh-CN/translation.json Added corresponding Chinese translations for new public note functionality
src/lib/public-note.ts Created comprehensive library for public note handling with validation, parsing, and manipulation utilities
src/hooks/useMediaQuery.tsx Reordered imports alphabetically
src/components/ui/*.tsx Standardized import ordering and formatting across all UI components
src/components/server.tsx Major refactor of public note functionality with dual mode support and improved validation

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@naiba
Copy link
Member

naiba commented Oct 8, 2025

  1. 麻烦移除 bun.lock 加到 gitignore
  2. build 之后本地测试下是否会空白屏,不是 npm run dev

Upgrade multiple npm dependencies to their latest versions, including react, tailwindcss, and eslint. Ignore lock files.
@Chillln
Copy link
Contributor Author

Chillln commented Oct 9, 2025

@naiba 本地构建测试记录(这次是更新依赖包后再构建的 上次忘记重新install了)

λ bun run build-ignore-error
$ vite build
vite v7.1.9 building for production...
✓ 2841 modules transformed.
dist/index.html                      0.74 kB │ gzip:   0.39 kB
dist/assets/fm-DNeVr5Tr.js           0.89 kB
dist/assets/vendor-DhzMnp0v.css      4.11 kB │ gzip:   1.67 kB
dist/assets/index-DYQW9_us.css      56.98 kB │ gzip:  10.36 kB
dist/assets/index-DliOKmji.js      275.99 kB │ gzip:  70.90 kB
dist/assets/vendor-j8G70HIt.js   1,323.60 kB │ gzip: 395.87 kB
✓ built in 5.26s

登录页及此次变更页控制台均无报错

2025-10-09 085623 2025-10-09 085624

后端日志

[GIN] 2025/10/09 - 08:56:11 | 200 |            0s |       127.0.0.1 | GET      "/dashboard/login"
[GIN] 2025/10/09 - 08:56:11 | 404 |       249.4µs |       127.0.0.1 | GET      "/.well-known/appspecific/com.chrome.devtools.json"
[GIN] 2025/10/09 - 08:56:11 | 200 |       116.6µs |       127.0.0.1 | GET      "/dashboard/assets/index-DliOKmji.js"
[GIN] 2025/10/09 - 08:56:11 | 200 |            0s |       127.0.0.1 | GET      "/dashboard/assets/vendor-DhzMnp0v.css"
[GIN] 2025/10/09 - 08:56:11 | 200 |            0s |       127.0.0.1 | GET      "/dashboard/assets/index-DYQW9_us.css"
[GIN] 2025/10/09 - 08:56:11 | 200 |      2.0383ms |       127.0.0.1 | GET      "/dashboard/assets/vendor-j8G70HIt.js"
[GIN] 2025/10/09 - 08:56:11 | 200 |            0s |       127.0.0.1 | GET      "/dashboard/assets/fm-DNeVr5Tr.js"
[GIN] 2025/10/09 - 08:56:11 | 200 |            0s |       127.0.0.1 | GET      "/api/v1/setting"
[GIN] 2025/10/09 - 08:56:11 | 200 |            0s |       127.0.0.1 | GET      "/api/v1/profile"
[GIN] 2025/10/09 - 08:56:11 | 200 |            0s |       127.0.0.1 | GET      "/dashboard/logo.svg"
[GIN] 2025/10/09 - 08:56:11 | 200 |       219.7µs |       127.0.0.1 | GET      "/dashboard/logo.svg"
[GIN] 2025/10/09 - 08:56:11 | 200 |       219.7µs |       127.0.0.1 | GET      "/dashboard/animated-man.webp"
2025/10/09 08:56:18 NEZHA>> geoip.Lookup: error opening database: invalid MaxMind DB file
[GIN] 2025/10/09 - 08:56:28 | 200 |            0s |       127.0.0.1 | GET      "/api/v1/setting"
[GIN] 2025/10/09 - 08:56:35 | 200 |     49.0139ms |       127.0.0.1 | POST     "/api/v1/login"
[GIN] 2025/10/09 - 08:56:35 | 200 |            0s |       127.0.0.1 | GET      "/api/v1/refresh-token"
[GIN] 2025/10/09 - 08:56:35 | 200 |       677.9µs |       127.0.0.1 | GET      "/api/v1/profile"
[GIN] 2025/10/09 - 08:56:35 | 200 |       772.6µs |       127.0.0.1 | GET      "/api/v1/server"
[GIN] 2025/10/09 - 08:56:35 | 200 |            0s |       127.0.0.1 | GET      "/api/v1/setting"
[GIN] 2025/10/09 - 08:56:35 | 200 |       947.1µs |       127.0.0.1 | GET      "/api/v1/server-group"
[GIN] 2025/10/09 - 08:56:40 | 301 |            0s |       127.0.0.1 | GET      "/dashboard"
[GIN] 2025/10/09 - 08:56:40 | 200 |            0s |       127.0.0.1 | GET      "/dashboard/"
[GIN] 2025/10/09 - 08:56:40 | 404 |            0s |       127.0.0.1 | GET      "/.well-known/appspecific/com.chrome.devtools.json"
[GIN] 2025/10/09 - 08:56:40 | 200 |       558.5µs |       127.0.0.1 | GET      "/dashboard/assets/index-DliOKmji.js"
[GIN] 2025/10/09 - 08:56:40 | 200 |      2.4527ms |       127.0.0.1 | GET      "/dashboard/assets/vendor-j8G70HIt.js"
[GIN] 2025/10/09 - 08:56:40 | 200 |            0s |       127.0.0.1 | GET      "/dashboard/assets/index-DYQW9_us.css"
[GIN] 2025/10/09 - 08:56:40 | 200 |       624.2µs |       127.0.0.1 | GET      "/dashboard/assets/vendor-DhzMnp0v.css"
[GIN] 2025/10/09 - 08:56:40 | 200 |       653.9µs |       127.0.0.1 | GET      "/dashboard/assets/fm-DNeVr5Tr.js"
[GIN] 2025/10/09 - 08:56:40 | 200 |            0s |       127.0.0.1 | GET      "/api/v1/setting"
[GIN] 2025/10/09 - 08:56:40 | 200 |        93.9µs |       127.0.0.1 | GET      "/api/v1/profile"
[GIN] 2025/10/09 - 08:56:40 | 200 |            0s |       127.0.0.1 | GET      "/dashboard/logo.svg"
[GIN] 2025/10/09 - 08:56:40 | 200 |        67.1µs |       127.0.0.1 | GET      "/api/v1/refresh-token"
[GIN] 2025/10/09 - 08:56:40 | 200 |            0s |       127.0.0.1 | GET      "/api/v1/server"

Changed undefined values ​​for bill amount to the default value "0" to avoid potential null value errors.
@naiba naiba merged commit e783692 into nezhahq:main Oct 9, 2025
1 check passed
@Chillln
Copy link
Contributor Author

Chillln commented Oct 9, 2025

@naiba 编译出来的和本地不一样呢

@naiba
Copy link
Member

naiba commented Oct 9, 2025

你编译出来放自定义主题文件夹里测,能测出来的

@Chillln
Copy link
Contributor Author

Chillln commented Oct 9, 2025

@naiba 刚刚构建的版本我打开有报错

@naiba
Copy link
Member

naiba commented Oct 9, 2025

你本地环境多少有点问题,你研究研究吧

@Chillln
Copy link
Contributor Author

Chillln commented Oct 9, 2025

@naiba 好了 最新构建的没问题了

@Chillln Chillln deleted the feature/optimize-public-notes branch October 9, 2025 02:09
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.14.3添加日期无法取消,以及取消备注时UI无法复原

3 participants