Skip to content

Commit 84f3d3c

Browse files
Lint issues fix
1 parent 6bf0f3c commit 84f3d3c

4 files changed

Lines changed: 15 additions & 15 deletions

File tree

src/app/(app)/admin/loans/new/new-loan-form.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use client'
22

33
import { useActionState, useEffect } from 'react'
4+
import Link from 'next/link'
45
import { useRouter } from 'next/navigation'
56
import { createLoan } from '@/lib/actions/loans'
67
import { todayISO } from '@/lib/format'
@@ -126,12 +127,12 @@ export function NewLoanForm({
126127
)}
127128

128129
<div className="flex justify-end gap-3">
129-
<a
130+
<Link
130131
href="/dashboard/loans"
131132
className="rounded-md border border-gray-300 px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50"
132133
>
133134
Cancel
134-
</a>
135+
</Link>
135136
<button
136137
type="submit"
137138
disabled={pending}

src/app/(app)/admin/transactions/[transaction_id]/edit-transaction-form.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use client'
22

33
import { useActionState, useEffect, useState } from 'react'
4+
import Link from 'next/link'
45
import { useRouter } from 'next/navigation'
56
import { updateTransaction } from '@/lib/actions/transactions'
67
import { CONTRIBUTION_TYPES, type ContributionType } from '@/lib/constants'
@@ -225,12 +226,12 @@ export function EditTransactionForm({
225226
)}
226227

227228
<div className="flex justify-end gap-3">
228-
<a
229+
<Link
229230
href="/admin/transactions"
230231
className="rounded-md border border-gray-300 px-3 py-1.5 text-sm font-medium text-gray-700 hover:bg-gray-50"
231232
>
232233
Cancel
233-
</a>
234+
</Link>
234235
<button
235236
type="submit"
236237
disabled={pending}

src/app/(app)/dashboard/contributions/contributions-filters.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ export function ContributionsFilters({
8686
options={members}
8787
selected={memberIds}
8888
label={memberLabel}
89-
allLabel="All members"
9089
onChange={(next) => {
9190
setMemberIds(next)
9291
push({ members: next })
@@ -102,7 +101,6 @@ export function ContributionsFilters({
102101
options={TYPE_OPTIONS}
103102
selected={types}
104103
label={typeLabel}
105-
allLabel="All types"
106104
onChange={(next) => {
107105
setTypes(next as TypeKey[])
108106
push({ types: next as TypeKey[] })
@@ -158,13 +156,11 @@ function MultiSelect({
158156
options,
159157
selected,
160158
label,
161-
allLabel,
162159
onChange,
163160
}: {
164161
options: Option[]
165162
selected: string[]
166163
label: string
167-
allLabel: string
168164
onChange: (next: string[]) => void
169165
}) {
170166
const [open, setOpen] = useState(false)

src/components/searchable-select.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,6 @@ export function SearchableSelect({
6767
return () => document.removeEventListener('mousedown', onClick)
6868
}, [open])
6969

70-
// Reset highlight whenever filter changes or dropdown opens.
71-
useEffect(() => {
72-
if (open) setHighlight(0)
73-
}, [query, open])
74-
7570
// Focus the search input when opening.
7671
useEffect(() => {
7772
if (open) searchRef.current?.focus()
@@ -119,7 +114,11 @@ export function SearchableSelect({
119114

120115
<button
121116
type="button"
122-
onClick={() => !disabled && setOpen((v) => !v)}
117+
onClick={() => {
118+
if (disabled) return
119+
if (!open) setHighlight(0)
120+
setOpen((v) => !v)
121+
}}
123122
disabled={disabled}
124123
aria-haspopup="listbox"
125124
aria-expanded={open}
@@ -141,7 +140,10 @@ export function SearchableSelect({
141140
ref={searchRef}
142141
type="text"
143142
value={query}
144-
onChange={(e) => setQuery(e.target.value)}
143+
onChange={(e) => {
144+
setQuery(e.target.value)
145+
setHighlight(0)
146+
}}
145147
onKeyDown={onKeyDown}
146148
placeholder="Type to search…"
147149
className="block w-full rounded-md border border-gray-200 bg-gray-50 px-3 py-1.5 text-sm focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500"

0 commit comments

Comments
 (0)