diff --git a/apps/web/src/lib/api.ts b/apps/web/src/lib/api.ts index 2d4731b..7a81dfc 100644 --- a/apps/web/src/lib/api.ts +++ b/apps/web/src/lib/api.ts @@ -1,15 +1,8 @@ /** * API client utilities for the web app. - * - * BUG: imports `useThrottle` from @e2e/utils, but that hook was renamed to - * `useDebounce`. This causes a TypeScript error and a runtime crash. - * - * Fix: change the import to `useDebounce`. */ -// BUG: useThrottle no longer exists — was renamed to useDebounce -import { useThrottle } from "@e2e/utils" -import { formatDate, formatAUD } from "@e2e/utils" +import { useSearchDebounce, formatDate, formatAUD } from "@e2e/utils" export const BASE_URL = process.env.API_URL ?? "http://localhost:3000" @@ -28,5 +21,4 @@ export async function fetchPosts() { // Re-export formatting utilities used throughout the app export { formatDate, formatAUD } -// Re-export the debounce hook (currently broken import) -export { useThrottle as useSearchDebounce } +export { useSearchDebounce } diff --git a/bun-env.d.ts b/bun-env.d.ts new file mode 100644 index 0000000..22f6a66 --- /dev/null +++ b/bun-env.d.ts @@ -0,0 +1 @@ +/// diff --git a/packages/ui/src/components/Button/Button.tsx b/packages/ui/src/components/Button/Button.tsx index af65c97..e0387b5 100644 --- a/packages/ui/src/components/Button/Button.tsx +++ b/packages/ui/src/components/Button/Button.tsx @@ -39,8 +39,7 @@ export function Button({ className={`btn btn-${variant}`} disabled={disabled} onClick={onClick} - // BUG: aria-label is not applied when iconOnly is true and no ariaLabel is passed - // The component should enforce aria-label for icon-only buttons + aria-label={iconOnly ? (ariaLabel ?? "icon button") : ariaLabel} > {icon && {icon}} {!iconOnly && children} diff --git a/packages/utils/src/format/date.ts b/packages/utils/src/format/date.ts index 609e46c..3ee04c6 100644 --- a/packages/utils/src/format/date.ts +++ b/packages/utils/src/format/date.ts @@ -1,21 +1,8 @@ /** * Date formatting utilities. - * - * BUG: formatDate passes `'en-AU'` as the locale but then uses a US-style - * format string option (`month: 'numeric'` before `day: 'numeric'`), which - * produces MM/DD/YYYY output instead of DD/MM/YYYY for Australian dates. - * - * Fix: use `dateStyle: 'short'` with `'en-AU'` locale, which correctly - * produces DD/MM/YYYY, or explicitly set `day: 'numeric', month: 'numeric', year: 'numeric'` - * and rely on the locale to order them correctly. */ export function formatDate(date: Date): string { - // BUG: explicit field order overrides locale ordering — produces M/D/YYYY not D/M/YYYY - return new Intl.DateTimeFormat("en-AU", { - month: "numeric", - day: "numeric", - year: "numeric", - }).format(date) + return new Intl.DateTimeFormat("en-AU", { dateStyle: "short" }).format(date) } export function formatDateTime(date: Date): string { diff --git a/packages/utils/src/index.ts b/packages/utils/src/index.ts index 0799012..355c639 100644 --- a/packages/utils/src/index.ts +++ b/packages/utils/src/index.ts @@ -1,4 +1,5 @@ export { useDebounce } from "./hooks/useDebounce" +export { useDebounce as useSearchDebounce } from "./hooks/useDebounce" export { usePagination } from "./hooks/usePagination" export { formatAUD } from "./format/currency" export { formatDate, formatDateTime } from "./format/date" diff --git a/tsconfig.json b/tsconfig.json index 167f910..2d0b85f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -11,5 +11,5 @@ "@e2e/utils": ["./packages/utils/src/index.ts"] } }, - "include": ["packages/*/src/**/*", "packages/*/test/**/*", "apps/*/src/**/*"] + "include": ["*.d.ts", "packages/*/src/**/*", "packages/*/test/**/*", "apps/*/src/**/*"] }