Skip to content

Replace floating Clear link with a Reset button in profile editors#433

Merged
FuJacob merged 1 commit into
mainfrom
jafu/profile-reset-buttons
May 30, 2026
Merged

Replace floating Clear link with a Reset button in profile editors#433
FuJacob merged 1 commit into
mainfrom
jafu/profile-reset-buttons

Conversation

@FuJacob

@FuJacob FuJacob commented May 30, 2026

Copy link
Copy Markdown
Owner

Summary

In the writing-profile settings, the "Clear" control sat alone in the top-right corner of the Languages and Rules cards. Because the section title comes from the enclosing Section, nothing balanced it, so it read as a stray link in empty space. Replace it with a proper bordered Reset button (with an arrow.counterclockwise icon) at the bottom-right of each editor. Behavior is unchanged: it restores the default language set / clears all rules, and still only appears when there's something to reset.

Validation

swiftlint lint --strict --quiet
# exit 0

xcodebuild -project Cotabby.xcodeproj -scheme Cotabby -destination 'platform=macOS' build
# ** BUILD SUCCEEDED **

Visual change; confirm in Settings → Writing: the Reset button appears at the bottom-right of the Languages and Rules cards once they differ from defaults, and disappears after resetting. The inline-title (onboarding) layout still renders its title and the same bottom Reset.

Linked issues

Risk / rollout notes

  • UI-only, no model/settings changes; reuses the existing clearLanguages() / clearRules() actions.

Greptile Summary

Moves the "Clear" affordance in both CustomRulesEditor and LanguageTagsEditor from a plain link in the card header to a small bordered "Reset" button (Label + arrow.counterclockwise) anchored at the bottom-right of each editor. The visibility gating (canClear) and the underlying actions (clearRules() / clearLanguages()) are unchanged.

  • CustomRulesEditor: Old HStack header that combined the title and the Clear link is split into a standalone title block and a new bottom-of-VStack Reset button guarded by canClear.
  • LanguageTagsEditor: Identical restructuring; Reset button is placed after the model-support disclaimer text rather than before the content, which is a slight ordering change worth confirming looks right visually.

Confidence Score: 5/5

UI-only restructuring with no model or persistence changes; safe to merge.

Both files touch only view layout code. The canClear gating logic and the underlying clearRules()/clearLanguages() calls are untouched, so functional behavior is identical to before. The only loose ends are a stale private variable name (canClear) and doc comments in non-diff files that still say "Clear".

The stale doc comments in SuggestionSettingsModel.swift and CustomRulesCatalog.swift (both outside the diff) are worth a follow-up pass to update "Clear" to "Reset" in the prose.

Important Files Changed

Filename Overview
Cotabby/UI/CustomRulesEditor.swift Replaces header-level plain "Clear" button with a bottom-aligned "Reset" button using a Label+icon; logic is unchanged but canClear naming is now slightly stale.
Cotabby/UI/LanguageTagsEditor.swift Same "Clear→Reset" relocation as CustomRulesEditor; Reset button now sits below the model-support disclaimer text; logic and canClear gating are correct.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Editor renders] --> B{showsTitleHeader?}
    B -- Yes --> C[Show inline title text]
    B -- No --> D[Title omitted - Section heading provides it]
    C --> E[Render chip flow layout if list non-empty]
    D --> E
    E --> F[TextField for new entry]
    F --> G{Suggestions available and under cap?}
    G -- Yes --> H[Suggestions row]
    G -- No --> I{canClear? current != defaults}
    H --> I
    I -- Yes --> J[Bottom-right Reset button - Label + arrow.counterclockwise]
    I -- No --> K[Button hidden]
    J --> L[User clicks Reset]
    L --> M[clearRules / clearLanguages sets defaults]
    M --> N[canClear becomes false - Button disappears]
Loading

Comments Outside Diff (3)

  1. Cotabby/UI/CustomRulesEditor.swift, line 29-31 (link)

    P2 The private variable is named canClear but the button it gates is now labelled "Reset". This creates a small cognitive mismatch for future readers who may expect canClear to guard a "Clear" action. Renaming it to canReset keeps the code consistent with the visible UI affordance.

    Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

    Fix in Codex Fix in Claude Code

  2. Cotabby/UI/LanguageTagsEditor.swift, line 28-30 (link)

    P2 Same naming drift as in CustomRulesEditor: canClear guards a "Reset" button. Renaming it to canReset (and updating the two usage sites below) keeps the variable name aligned with the visible UI label.

    Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

    Fix in Codex Fix in Claude Code

  3. Cotabby/UI/CustomRulesEditor.swift, line 29-31 (link)

    P2 Stale "Clear" references in companion files

    SuggestionSettingsModel.clearRules() still carries the doc comment Named for the UI affordance ("Clear"), and CustomRulesCatalog.swift lines 8 and 18 both say "Clear" action / "Clear" in the editor. Now that the button is labelled "Reset", these comments are misleading to future readers. They're not part of the current diff but are directly coupled to the rename done here.

    Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

    Fix in Codex Fix in Claude Code

Fix All in Codex Fix All in Claude Code

Reviews (1): Last reviewed commit: "Replace floating Clear link with a Reset..." | Re-trigger Greptile

… editors

The Clear control sat alone in the top-right corner of the Languages and
Rules cards (the section title comes from the enclosing Section, so nothing
balanced it), which read as stray. Move it to a proper bordered Reset button
at the bottom-right of each editor, with an arrow.counterclockwise icon.

Same behavior (restores the default set / clears rules); only the placement
and affordance change.
@FuJacob FuJacob merged commit a77f7f1 into main May 30, 2026
4 checks passed
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