[Hacktoberfest][Web2.0] Implement observer guides CRUD in new UI - #1013
Open
cristian-ist wants to merge 2 commits into
Open
[Hacktoberfest][Web2.0] Implement observer guides CRUD in new UI#1013cristian-ist wants to merge 2 commits into
cristian-ist wants to merge 2 commits into
Conversation
|
@cristian-ist is attempting to deploy a commit to the Code for Romania Team on Vercel. A member of the Team first needs to authorize it. |
cristian-ist
force-pushed
the
votemonitor-1005
branch
from
August 12, 2026 04:21
b902f6c to
e0e5400
Compare
cristian-ist
marked this pull request as ready for review
August 12, 2026 05:16
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.
Summary
Implements full CRUD for observer guides in the new admin UI (
web2.0), followingthe flow of the existing admin app but built on the web2.0 structure and
components.
Closes #1005
What's included
Create — an "Upload observer guide" dropdown offers the three guide types
(Document / Url / Text). The type is picked before the dialog opens because it
cannot be changed afterwards and it decides which fields the form shows. The
dialog renders only the relevant field: a file input, a url input, or a textarea.
The request goes out as multipart and only sends the field matching the selected
type, since the backend feeds
WebsiteUrlstraight intonew Uri(...).Read — the table shows a type icon (paperclip / link / document), title,
formatted upload date and author, with search, a guide type filter, sorting and
pagination.
Update — a dialog with the title plus the url or the text, depending on the
type. Document guides only expose their title: the API keeps the uploaded file
as it is and offers no way to replace it.
Delete — a destructive confirmation dialog naming the guide.
Row actions are disabled for guides received through a coalition
(
isGuideOwner: false), which the API resolves only for their owner. The uploadbutton is disabled on archived election rounds.
Client side validation mirrors the API validators: title required and capped at
256 characters, url capped at 2048 and required to be absolute, text required,
attachment capped at 50 MB.
Fixes to the earlier commit on this branch
The previous commit only added a listing, and it no longer built against the
current state of the branch:
useListMonitoringObserversinstead of the guides query, witha
@ts-ignorehiding the mismatchvalidateSearchusedzodValidatorfrom@tanstack/zod-adapter, a package nolonger present in
package.json; every other route passes the zod schemadirectly
@/components/data-table-toolbarand@/components/data-table-column-header, which have since moved under@/components/data-table/displayName, a column that does not exist on theguide model
PageResponse<T>while the endpoint answers with{ guides: [...] }, sodata.itemswas alwaysundefinedconsole.logplaceholderurlValidityInSecondswas typed asstringalthough the API returns anint,and
guideAccesswas missing from the modelImplementation notes
The list endpoint takes nothing but the election round id — no filtering, no
sorting, no pagination, as noted in the issue. Filtering, sorting and paging are
therefore computed client side over the full list and the resulting slice is
handed to the table, which keeps the same
DataTable, toolbar and pagination asthe rest of the app. The query key holds only the election round id, so typing in
the search box no longer refetches an identical payload.
No shared or unrelated file was touched: the changes are limited to the guides
types, api layer, query, mutations, page and route.
Out of scope
Guide access (coalition sharing), document download through
presignedUrl, and aread only view for text guides are left out — the issue asks for CRUD. As a
consequence a text guide can currently only be read by opening its update dialog,
and documents cannot be downloaded from the UI. The generated
guides/$guideId.tsxroute is left untouched as well, since removing it wouldrequire regenerating the route tree.
Verification
tscreports no errors in the guides codeeslintreports no errors beyond the repo widereact/react-in-jsx-scoperule,which fires across the whole project
prettier --checkpassesknipreports nothing unused