Skip to content

feat(contacts): sortable columns on the contacts table#52

Merged
overthelex merged 1 commit into
mainfrom
feat/contacts-sortable-columns
Jul 10, 2026
Merged

feat(contacts): sortable columns on the contacts table#52
overthelex merged 1 commit into
mainfrom
feat/contacts-sortable-columns

Conversation

@overthelex

Copy link
Copy Markdown
Owner

What

Клик по заголовку любой колонки на /contacts сортирует таблицу; повторный клик — реверс (индикатор ▲/▼). Специально просили «Останній контакт» и «Статус».

Why server-side

Сортировка выполняется на сервере по всей отфильтрованной выборке, а не только по загруженным 100 строкам. Иначе контакты, которым уже писали (импортированы давно), не всплывали бы наверх при сортировке по дате/статусу.

Changes

  • core/clients.tslistClients принимает sort/dir, ORDER BY строится из whitelist колонок (name/email/org/region/segment/status/last) + ASC|DESC NULLS LAST. Пользовательский ввод в SQL не попадает.
  • web/api.ts — проброс sort/dir из query.
  • web/public/index.html — кликабельные заголовки, refetch с сортировкой, i18n-подсказка (EN/UA).

Verify

  • tsc --noEmit — clean.
  • Проверил ORDER BY last_contacted_at DESC NULLS LAST на прод-данных: сверху корректно оказываются те, кому писали (mspcorporate, Inly, Intelex…).

🤖 Generated with Claude Code

Click any column header on /contacts to sort; click again to reverse
(▲/▼ indicator). Sort is server-side over the whole filtered set — not
just the loaded page — so contacts that were emailed (imported long ago)
surface to the top when sorting by "Last contacted" or "Status".

- clients.ts: listClients accepts sort/dir, built from a column whitelist
  with ASC|DESC NULLS LAST (no user input in SQL).
- api.ts: pass through sort/dir query params.
- index.html: clickable headers, refetch sorted, i18n hint (EN/UA).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@overthelex
overthelex merged commit e7c6d20 into main Jul 10, 2026
2 checks passed
@overthelex
overthelex deleted the feat/contacts-sortable-columns branch July 10, 2026 22:01
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