Skip to content

refactor: admin settings componentization#21

Merged
vitormattos merged 25 commits intomainfrom
refactor/admin-settings-componentization
Mar 20, 2026
Merged

refactor: admin settings componentization#21
vitormattos merged 25 commits intomainfrom
refactor/admin-settings-componentization

Conversation

@vitormattos
Copy link
Member

No description provided.

- Add @vue/test-utils for component mounting and interaction
- Add jsdom for DOM environment in Vitest
- Add @vitejs/plugin-vue for Vue SFC compilation in tests

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Add jsdom as test environment for browser APIs (localStorage, window)
- Configure @vitejs/plugin-vue for Vue SFC compilation
- Set component test include pattern with src/tests/ suffix

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Extract LibreCode sponsorship banner into dedicated component
- Encapsulate visibility state with localStorage persistence
- Handle dismiss action and sponsor page navigation internally
- Props: storageKey, sponsorUrl (with sensible defaults)
- Fully autonomous - no parent event coordination needed

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Extract select field options editor into dedicated admin component
- Implement drag-and-drop reordering with vuedraggable
- Add bulk import dialog for multiple options
- Validation: detect duplicate options (case-insensitive)
- Keyboard support: Enter to add, Backspace/Delete to remove
- Prevent empty option duplicates with smart add logic
- Maintains full feature parity with extracted code

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Test sponsor page opens with correct URL and window features
- Test dismiss button hides banner and persists state to localStorage
- Test pre-dismissed state: starts hidden when localStorage key exists
- Setup: vi.mock @nextcloud/vue components; mount with jsdom
- Cleanup: afterEach clears localStorage to prevent test pollution

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Test add new option: button click emits update:modelValue with correct data
- Test skip add when empty exists: prevents duplicate empty option creation
- Setup: mock @nextcloud/vue + Draggable; mount with jsdom
- Validation: check emitted events and payload structure

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Remove ~200 lines of options editor markup and logic
- Extract to AdminSelectOptionsSection component
- Fix CSS button truncation: add flex: 0 0 auto + min-width: max-content
- Simplify AdminSettings template and reduce component complexity
- Use v-model binding for options sync with child component
- Maintain full functionality: drag, bulk import, validation, keyboard support

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
@vitormattos vitormattos self-assigned this Mar 20, 2026
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
@vitormattos vitormattos merged commit 40161ed into main Mar 20, 2026
23 checks passed
@vitormattos vitormattos deleted the refactor/admin-settings-componentization branch March 20, 2026 14:27
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