File tree Expand file tree Collapse file tree
transactions/[transaction_id] Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11'use client'
22
33import { useActionState , useEffect } from 'react'
4+ import Link from 'next/link'
45import { useRouter } from 'next/navigation'
56import { createLoan } from '@/lib/actions/loans'
67import { 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 }
Original file line number Diff line number Diff line change 11'use client'
22
33import { useActionState , useEffect , useState } from 'react'
4+ import Link from 'next/link'
45import { useRouter } from 'next/navigation'
56import { updateTransaction } from '@/lib/actions/transactions'
67import { 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 }
Original file line number Diff line number Diff 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 )
Original file line number Diff line number Diff 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"
You can’t perform that action at this time.
0 commit comments