Skip to content

Feat/tournaments all search#70

Draft
yatskovanatoly wants to merge 18 commits intomainfrom
feat/tournaments-all-search
Draft

Feat/tournaments all search#70
yatskovanatoly wants to merge 18 commits intomainfrom
feat/tournaments-all-search

Conversation

@yatskovanatoly
Copy link
Collaborator

@yatskovanatoly yatskovanatoly commented Mar 10, 2026

@vercel
Copy link

vercel bot commented Mar 10, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
mktour Ready Ready Preview, Comment Mar 11, 2026 10:33am

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 10, 2026

Greptile Summary

This PR introduces a full search and filter experience for the "all tournaments" page, adding free-text search (debounced), rated/unrated selector, multi-select comboboxes for formats/types/statuses, and a collapsible filter panel on mobile. It also introduces two new reusable UI primitives (Combobox built on @base-ui/react and InputGroup) and a shared SearchInput component that is also wired into the existing club-level tournament/player views.

Previous review feedback has been addressed: the touched check now correctly handles the unrated state (filters.rated !== null), the server query uses drizzle's typed like() instead of raw SQL, the TournamentsFilterInput type is placed at the end of its file, and the ResetButton no longer imports ButtonProps from @base-ui/react.

Key areas of note:

  • Bug in mobile filter panel toggle (tournaments-all-list.tsx lines 124–130): handleVisibleChange calls reset() when closing the panel, which also clears the always-visible SearchInput that sits outside the collapsible area. Mobile users who have typed a search query will silently lose it when tapping the filter toggle to close the panel.
  • The new Combobox component is a well-structured wrapper over @base-ui/react, correctly encapsulating chips, clear, trigger, and portal/positioner logic.
  • Server-side filtering logic in get-all-tournaments.ts correctly maps status enum values to isNull/isNotNull checks on startedAt/closedAt columns.

Confidence Score: 3/5

  • Mostly safe to merge, but contains a UX bug on mobile where the search input is cleared when closing the filter panel.
  • The core feature (server-side filtering, tRPC integration, pagination, i18n) is solid. All previously flagged issues have been resolved. One new logic bug was found: handleVisibleChange calls reset() on panel close, which clears the always-visible search input unexpectedly on mobile.
  • src/app/tournaments/all/tournaments-all-list.tsx — specifically the handleVisibleChange function at lines 124–130.

Important Files Changed

Filename Overview
src/app/tournaments/all/tournaments-all-list.tsx New tournaments search/filter UI component; contains a logic bug where closing the mobile filter panel calls reset() which clears the always-visible SearchInput unexpectedly.
src/components/hooks/use-tournaments-filters.ts New filter state hook; touched correctly uses filters.rated !== null and types are properly placed at the end of the file. reset() clears search which is exploited by the bug in the UI component above.
src/server/queries/get-all-tournaments.ts Server query for all tournaments with filtering; correctly uses drizzle's typed like(), inArray(), and eq() helpers — no raw sql template literals. Filter logic and cursor-based pagination look correct.
src/components/hooks/query-hooks/use-tournaments.ts TournamentsFilterInput type declaration moved to the end of the file per AGENTS.md convention. Infinite query hook wiring looks correct.
src/server/api/routers/tournament.ts New all tRPC procedure accepts and forwards search/filter params correctly; input validation with zod is thorough. Cache invalidation on create and delete looks correct.
src/components/ui/combobox.tsx New Combobox component built on @base-ui/react; clean implementation with proper shadcn integration and chip multi-select support.
src/server/zod/enums.ts New tournamentStatusEnum ('upcoming', 'ongoing', 'finished') correctly added; aligned with the status logic in the query layer.
src/components/ui/input-group.tsx New input-group UI primitive providing styled wrappers for inputs with addons and buttons. Clean and straightforward.
src/messages/en.json TournamentsAll.status.title is now correctly "status" in English (previously "статус"). New keys for rated, formats, types, and status filters are all English. No issues.
src/components/ui-custom/search-input.tsx Simple reusable search input component extracted into ui-custom. Clean and straightforward.

Sequence Diagram

sequenceDiagram
    participant U as User (Browser)
    participant C as TournamentsAllList
    participant F as useTournamentsFilters
    participant Q as useTournaments (React Query)
    participant T as tRPC tournament.all
    participant S as getAllTournaments (Server Cache)
    participant DB as SQLite DB

    U->>C: type in SearchInput / select filter
    C->>F: setSearch / setRated / setFormats / setTypes / setStatus
    F-->>C: updated search + queryFilter
    Note over C: useDebounce(search, 300ms)
    C->>Q: useTournaments(queryFilterWithDebounce)
    Q->>T: tournament.all({ search, rated, formats, types, statuses, cursor })
    T->>S: getAllTournaments({ limit, cursor, filter })
    Note over S: 'use cache' — cacheTag(ALL_TOURNAMENTS)
    S->>DB: SELECT … WHERE like(title) OR like(club.name) AND eq(rated) AND inArray(format/type) AND status conditions
    DB-->>S: results
    S-->>T: { tournaments, nextCursor }
    T-->>Q: paginated response
    Q-->>C: tournaments pages
    C-->>U: renders TournamentItemIteratee list
Loading

Last reviewed commit: 5ce24d6

greptile-apps[bot]

This comment was marked as resolved.

yatskovanatoly and others added 2 commits March 10, 2026 17:32
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Copy link

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

View 4 additional findings in Devin Review.

Open in Devin Review

Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@yatskovanatoly
Copy link
Collaborator Author

@greptile

@sukalov sukalov marked this pull request as draft March 13, 2026 14:50
Base automatically changed from beta to main March 13, 2026 19:35
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