1984 Verbesserung Workflow bei der Erfassung der Kandidaten-Stimmen der verschiedenen Wahlvorschläge#2395
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThis change adds automatic navigation functionality to the candidate votes recording workflow in a Vue component. After saving votes for a proposal, the component now automatically collapses the current card, identifies the next row requiring edits (marked as dirty), expands that card, and scrolls to it. UI anchors are introduced via Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In
`@wls-gui-wahllokalsystem/src/components/ergebnismeldung/MBW/stapelBC/TheWahlvorschlaegeKandidatenStimmenCard.vue`:
- Around line 86-87: The template renders
<base-card-wahlvorschlag-kandidaten-stimmen-erfassen> inside a v-for with a
static id "kandidatenStimmenErfassen", causing duplicate IDs; update the
template to generate a unique id per item (e.g.,
`kandidatenStimmenErfassen-${index}`) or add a Vue ref keyed by index, then
change the logic in _openNextCard to target that specific element/component
instead of document.querySelector("#kandidatenStimmenErfassen"); reference the
component tag base-card-wahlvorschlag-kandidaten-stimmen-erfassen, the static id
kandidatenStimmenErfassen, and the method _openNextCard when making the updates
so the selector or $refs use the index to pick the correct card.
🧹 Nitpick comments (3)
wls-gui-wahllokalsystem/src/components/ergebnismeldung/MBW/stapelBC/TheWahlvorschlaegeKandidatenStimmenCard.vue (3)
99-99: Consider a more specificidfor the footer scroll anchor.
id="footer"is very generic and could collide with other elements in the page (e.g. a layout footer). A scoped name likeid="wahlvorschlaege-table-footer"would be safer and more self-documenting.Also applies to: 243-248
251-260:_findNextIndexrelies on caller having already cleareddirtyRows[index].The loop starts at
i = 0, which checks the current index first. This works only becausedirtyRows.value[rowIndex]is set tofalsebefore calling_openNextCard. Starting ati = 1would make the "skip current" intent explicit and avoid a subtle coupling with the call site.Suggested tweak
function _findNextIndex(index: number) { const length = wahlvorschlaegeWithKandidatenErgebnissen.value.length; - for (let i = 0; i < length; i++) { - const currentIndex = (index + i) % length; + for (let i = 1; i <= length; i++) { + const currentIndex = (index + i) % length; if (dirtyRows.value[currentIndex]) { return currentIndex; } } return -1; }
237-248: UsescrollIntoView({ behavior: "smooth" })for a less jarring transition.Both
scrollIntoView()calls (Lines 240 and 246) default to an instant jump. Since this PR is specifically about improving the editing workflow UX, a smooth scroll would feel more polished and help users maintain context.Suggested tweak
- nextElement.scrollIntoView(); + nextElement.scrollIntoView({ behavior: "smooth" });- footer.scrollIntoView(); + footer.scrollIntoView({ behavior: "smooth" });
Beschreibung:
Öffnet die nächste Card, die noch zu bearbeiten ist und scrollt zu der Stelle, falls die Liste der Wahlvorschläge länger ist. Wenn alle Wahlvorschläge bearbeitet sind wird ans Ende gesprungen (Im Moment zum Footer, da es noch keine Buttons zur weiteren Navigation gibt)
Definition of Done (DoD):
Frontend
Referenzen1:
Closes #1984
Footnotes
Nicht zutreffende Referenzen vor dem Speichern entfernen ↩