fix(sidebar): use grouped form layout in favorite edit dialogs#1809
Merged
Conversation
b729c6a to
4214695
Compare
Signed-off-by: Ngô Quốc Đạt <datlechin@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The New Favorite / Edit Favorite sheet rendered with a large empty region on the left, labels pushed to mid-dialog, and fields crushed against the right edge.
Root cause
The form used
.formStyle(.columns), which lays out one shared trailing-aligned label column for the whole form. The dialog put the ~90-character ";;" hint sentence (and the keyword error text) into the label slot of an emptyLabeledContent. That single row inflated the shared label column, which right-aligned every short label toward the center and squeezed the value column into a narrow strip. The same anti-pattern was copy-pasted intoLinkedFavoriteMetadataDialog.Changes
Divider,Formwith.formStyle(.grouped),Divider, bottom-right Cancel/primary row). This matches the 24 existing.groupedform sites, Apple's grouped-form guidance (WWDC22 10052, Food Truck sample), and HIG rules for sheets, text fields, and toggles.TextEditorin its own section (minHeight 180, monospaced), with the ";;" hint as a real section footer.SQLFavoriteEditValidation.swift(SQLFavoriteKeywordValidatorpure classifier plusSQLFavoriteKeywordFieldwith an injectable availability check). This also fixes a latent race: an in-flight availability check could overwrite the result of a newer synchronous validation. Everyvalidatecall now invalidates stale checks.isValidtrimmed the full query string (up to 500KB) on every body evaluation. It now uses a short-circuiting blank check. The 500KB save cap is unchanged.CreateDatabaseSheetkeeps.formStyle(.columns)on purpose: all its labels are short and it is not affected.Tests
SQLFavoriteEditValidationTests: classifier table (empty, space, unavailable, reserved-keyword shadow), warning-allows-save vs error-blocks-save semantics, keyword trimming, and a deterministic stale-response race test using gatedAsyncStreams.TableProUITestshas no harness for driving a.sheet(item:)dialog and no storage-injection seam, so the keyword-validation flow cannot run deterministically against the live SQLite-backed store. The extracted logic carries the coverage instead.swiftlint lint --strictclean on all changed files.Follow-up
The screenshots in
docs/features/favorites.mdx(sql-favorite-create.png,sql-favorite-create-dark.png) show the old layout and need recapturing. The page text stays accurate.