BLOG-140 Label management (list and create) #144

Merged
squid merged 6 commits from BLOG-140_label_management into main 2025-10-15 12:21:42 +08:00
Owner

Description

  • As the title.

Package Changes

No response

Screenshots

Scenario Screenshot
Label list 截圖 2025-10-15 中午12.00.39.png
Create dialog 截圖 2025-10-15 中午12.02.37.png
Input error 截圖 2025-10-15 中午12.01.30.png
Name conflict 截圖 2025-10-15 中午12.06.17.png

Reference

Reference #140.

Checklist

  • A milestone is set
  • The related issuse has been linked to this branch
### Description - As the title. ### Package Changes _No response_ ### Screenshots |Scenario|Screenshot| |-|-| |Label list|![截圖 2025-10-15 中午12.00.39.png](/attachments/e27ad38b-86ba-4791-9e33-3fbc1b77f3ad)| |Create dialog|![截圖 2025-10-15 中午12.02.37.png](/attachments/aa3edda3-b97a-42b7-89dd-67fc9d2fe51e)| |Input error|![截圖 2025-10-15 中午12.01.30.png](/attachments/daafb0f7-51e1-429d-883d-b1c867e009ad)| |Name conflict|![截圖 2025-10-15 中午12.06.17.png](/attachments/1b866144-e37a-41ed-9011-f24b89d89368)| ### Reference Reference #140. ### Checklist - [x] A milestone is set - [x] The related issuse has been linked to this branch
squid added this to the 0.4 milestone 2025-10-15 12:08:39 +08:00
squid added 4 commits 2025-10-15 12:08:40 +08:00
fix: remove unnecessary class from label color display in Label Management
Some checks failed
Frontend CI / build (push) Failing after 55s
f6eece7071
refactor: update submit handlers to return boolean for success indication in label and post dialogs
Some checks failed
Frontend CI / build (push) Failing after 55s
Auto Comment On PR / add_improve_comment (pull_request) Successful in 16s
PR Title Check / pr-title-check (pull_request) Successful in 17s
9b33ea6c7a
Collaborator

/improve

/improve
Collaborator

PR Code Suggestions

CategorySuggestion                                                                                                                                    Impact
Possible issue
Improve form error display

The form error handling in onSubmit currently only assigns validation errors for the
name field. It should also assign errors for the color field to ensure users are
properly informed about invalid color inputs.

frontend/src/lib/label/framework/ui/CreateLabelDialog.svelte [60-62]

 			const errorResult = z.treeifyError(parseResult.error).properties;
 			formErrors.name = errorResult?.name?.errors[0];
+			formErrors.color = errorResult?.color?.errors[0];
 			return;
Suggestion importance[1-10]: 8

__

Why: The suggestion correctly identifies that the color field's validation errors are not being assigned to formErrors, which is crucial for providing complete user feedback. Implementing this ensures proper error display for all form fields.

Medium
General
Remove redundant placeholder element

The

Label
at the end of the file appears to be a leftover placeholder. Since
LabelManagementPage is already rendered, this extra div is redundant and might cause
unexpected layout issues. Remove it for cleaner code and correct rendering.

frontend/src/routes/dashboard/label/+page.svelte [21-22]

 <LabelManagementPage />
-<div>Label</div>
Suggestion importance[1-10]: 6

__

Why: The <div>Label</div> element is a leftover placeholder that is redundant given the LabelManagementPage component is now rendered. Removing it improves code cleanliness and prevents potential minor layout issues.

Low
## PR Code Suggestions ✨ <!-- --> <table><thead><tr><td><strong>Category</strong></td><td align=left><strong>Suggestion&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </strong></td><td align=center><strong>Impact</strong></td></tr><tbody><tr><td rowspan=1>Possible issue</td> <td> <details><summary>Improve form error display</summary> ___ **The form error handling in <code>onSubmit</code> currently only assigns validation errors for the <br><code>name</code> field. It should also assign errors for the <code>color</code> field to ensure users are <br>properly informed about invalid color inputs.** [frontend/src/lib/label/framework/ui/CreateLabelDialog.svelte [60-62]](https://git.squidspirit.com/squid/blog/src/branch/BLOG-140_label_management/frontend/src/lib/label/framework/ui/CreateLabelDialog.svelte#L60-L62) ```diff const errorResult = z.treeifyError(parseResult.error).properties; formErrors.name = errorResult?.name?.errors[0]; + formErrors.color = errorResult?.color?.errors[0]; return; ``` <details><summary>Suggestion importance[1-10]: 8</summary> __ Why: The suggestion correctly identifies that the `color` field's validation errors are not being assigned to `formErrors`, which is crucial for providing complete user feedback. Implementing this ensures proper error display for all form fields. </details></details></td><td align=center>Medium </td></tr><tr><td rowspan=1>General</td> <td> <details><summary>Remove redundant placeholder element</summary> ___ **The <code><div>Label</div></code> at the end of the file appears to be a leftover placeholder. Since <br><code>LabelManagementPage</code> is already rendered, this extra div is redundant and might cause <br>unexpected layout issues. Remove it for cleaner code and correct rendering.** [frontend/src/routes/dashboard/label/+page.svelte [21-22]](https://git.squidspirit.com/squid/blog/src/branch/BLOG-140_label_management/frontend/src/routes/dashboard/label/+page.svelte#L21-L22) ```diff <LabelManagementPage /> -<div>Label</div> ``` <details><summary>Suggestion importance[1-10]: 6</summary> __ Why: The `<div>Label</div>` element is a leftover placeholder that is redundant given the `LabelManagementPage` component is now rendered. Removing it improves code cleanliness and prevents potential minor layout issues. </details></details></td><td align=center>Low </td></tr></tr></tbody></table>
squid added 1 commit 2025-10-15 12:09:37 +08:00
style: pnpm format
All checks were successful
Frontend CI / build (push) Successful in 1m37s
PR Title Check / pr-title-check (pull_request) Successful in 17s
88ad640ec0
squid added 1 commit 2025-10-15 12:14:57 +08:00
fix: add color error handling in CreateLabelDialog form validation
All checks were successful
Frontend CI / build (push) Successful in 1m37s
PR Title Check / pr-title-check (pull_request) Successful in 16s
4d39a91986
Author
Owner

The form error handling in onSubmit currently only assigns validation errors for the
name field. It should also assign errors for the color field to ensure users are
properly informed about invalid color inputs.

frontend/src/lib/label/framework/ui/CreateLabelDialog.svelte [60-62]

 			const errorResult = z.treeifyError(parseResult.error).properties;
 			formErrors.name = errorResult?.name?.errors[0];
+			formErrors.color = errorResult?.color?.errors[0];
 			return;

Addressed in 4d39a91986.

> **The form error handling in <code>onSubmit</code> currently only assigns validation errors for the <br><code>name</code> field. It should also assign errors for the <code>color</code> field to ensure users are <br>properly informed about invalid color inputs.** > > [frontend/src/lib/label/framework/ui/CreateLabelDialog.svelte [60-62]](https://git.squidspirit.com/squid/blog/src/branch/BLOG-140_label_management/frontend/src/lib/label/framework/ui/CreateLabelDialog.svelte#L60-L62) > > ```diff > const errorResult = z.treeifyError(parseResult.error).properties; > formErrors.name = errorResult?.name?.errors[0]; > + formErrors.color = errorResult?.color?.errors[0]; > return; > ``` Addressed in 4d39a919869f74012394aa6a667955d65e8897ff.
squid merged commit d22f8cc292 into main 2025-10-15 12:21:42 +08:00
squid deleted branch BLOG-140_label_management 2025-10-15 12:21:42 +08:00
Sign in to join this conversation.
No description provided.