Skip to content

Commit 7968cbd

Browse files
Refactor CRM, API, and dashboard monoliths (#372)
* Refactor CRM, API, and dashboard monoliths * Address refactor review comments * Fix CRM selection retry behavior and centralize selection audits. Restore usable contact-selection views after callback failures, add shared audit logging for all selection flows, and guard error replies when the interaction is not yet acknowledged. Co-authored-by: Cursor <cursoragent@cursor.com> * Keep member agreement selections locked during send --------- Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 8821310 commit 7968cbd

21 files changed

Lines changed: 2247 additions & 2868 deletions

File tree

.github/workflows/test.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,9 @@ jobs:
4141
echo "KIMAI_BASE_URL=${{ secrets.KIMAI_BASE_URL }}" >> "$GITHUB_ENV"
4242
echo "KIMAI_API_TOKEN=${{ secrets.KIMAI_API_TOKEN }}" >> "$GITHUB_ENV"
4343
44-
- name: Run tests with pytest
45-
run: |
46-
uv run pytest tests/ -m "not playwright" -v --tb=short
47-
4844
- name: Run tests with coverage
4945
run: |
50-
uv run coverage run -m pytest tests/ -m "not playwright"
46+
uv run coverage run -m pytest tests/ -m "not playwright" -v --tb=short
5147
uv run coverage report
5248
uv run coverage xml
5349
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
type EmptyProps = {
2+
children: string
3+
hidden: boolean
4+
}
5+
6+
function Empty({ children, hidden }: EmptyProps) {
7+
if (hidden) return null
8+
return <div className="px-4 py-7 text-center text-sm text-muted-foreground">{children}</div>
9+
}
10+
11+
export { Empty }
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import { TableHead } from "@/components/ui/table"
2+
3+
type SortDirection = "asc" | "desc"
4+
5+
type SortButtonProps = {
6+
label: string
7+
scope: string
8+
sort: { key: string; direction: SortDirection }
9+
sortKey: string
10+
onSort: (scope: string, key: string) => void
11+
}
12+
13+
function SortButton({ label, scope, sort, sortKey, onSort }: SortButtonProps) {
14+
const active = sort.key === sortKey
15+
const arrow = sort.direction === "asc" ? "↑" : "↓"
16+
return (
17+
<button
18+
type="button"
19+
data-sort-scope={scope}
20+
data-sort-key={sortKey}
21+
className="text-left font-[inherit] text-inherit hover:text-foreground"
22+
onClick={() => onSort(scope, sortKey)}
23+
>
24+
{active ? `${label} ${arrow}` : label}
25+
</button>
26+
)
27+
}
28+
29+
type SortableTableHeadProps = SortButtonProps & {
30+
className?: string
31+
}
32+
33+
function SortableTableHead({
34+
className,
35+
label,
36+
scope,
37+
sort,
38+
sortKey,
39+
onSort,
40+
}: SortableTableHeadProps) {
41+
const ariaSort =
42+
sort.key === sortKey ? (sort.direction === "asc" ? "ascending" : "descending") : "none"
43+
return (
44+
<TableHead className={className} aria-sort={ariaSort}>
45+
<SortButton label={label} scope={scope} sort={sort} sortKey={sortKey} onSort={onSort} />
46+
</TableHead>
47+
)
48+
}
49+
50+
export { SortableTableHead }

apps/admin_dashboard/src/configuration-view.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { cleanup, fireEvent, render, screen, waitFor, within } from "@testing-library/react"
22
import { afterEach, describe, expect, it, vi } from "vitest"
33

4-
import { type ConfigurationItem, ConfigurationView } from "./main"
4+
import { type ConfigurationItem, ConfigurationView } from "./views/configuration-view"
55

66
afterEach(() => cleanup())
77

0 commit comments

Comments
 (0)