Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,9 @@ jobs:
echo "KIMAI_BASE_URL=${{ secrets.KIMAI_BASE_URL }}" >> "$GITHUB_ENV"
echo "KIMAI_API_TOKEN=${{ secrets.KIMAI_API_TOKEN }}" >> "$GITHUB_ENV"

- name: Run tests with pytest
run: |
uv run pytest tests/ -m "not playwright" -v --tb=short

- name: Run tests with coverage
run: |
uv run coverage run -m pytest tests/ -m "not playwright"
uv run coverage run -m pytest tests/ -m "not playwright" -v --tb=short
uv run coverage report
uv run coverage xml

Expand Down
11 changes: 11 additions & 0 deletions apps/admin_dashboard/src/components/empty.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
type EmptyProps = {
children: string
hidden: boolean
}

function Empty({ children, hidden }: EmptyProps) {
if (hidden) return null
return <div className="px-4 py-7 text-center text-sm text-muted-foreground">{children}</div>
}

export { Empty }
50 changes: 50 additions & 0 deletions apps/admin_dashboard/src/components/sortable-table-head.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import { TableHead } from "@/components/ui/table"

type SortDirection = "asc" | "desc"

type SortButtonProps = {
label: string
scope: string
sort: { key: string; direction: SortDirection }
sortKey: string
onSort: (scope: string, key: string) => void
}

function SortButton({ label, scope, sort, sortKey, onSort }: SortButtonProps) {
const active = sort.key === sortKey
const arrow = sort.direction === "asc" ? "↑" : "↓"
return (
<button
type="button"
data-sort-scope={scope}
data-sort-key={sortKey}
className="text-left font-[inherit] text-inherit hover:text-foreground"
onClick={() => onSort(scope, sortKey)}
>
{active ? `${label} ${arrow}` : label}
</button>
)
}

type SortableTableHeadProps = SortButtonProps & {
className?: string
}

function SortableTableHead({
className,
label,
scope,
sort,
sortKey,
onSort,
}: SortableTableHeadProps) {
const ariaSort =
sort.key === sortKey ? (sort.direction === "asc" ? "ascending" : "descending") : "none"
return (
<TableHead className={className} aria-sort={ariaSort}>
<SortButton label={label} scope={scope} sort={sort} sortKey={sortKey} onSort={onSort} />
</TableHead>
)
}

export { SortableTableHead }
2 changes: 1 addition & 1 deletion apps/admin_dashboard/src/configuration-view.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { cleanup, fireEvent, render, screen, waitFor, within } from "@testing-library/react"
import { afterEach, describe, expect, it, vi } from "vitest"

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

afterEach(() => cleanup())

Expand Down
Loading