@@ -224,114 +224,118 @@ export default function AddToWishlistModal({
224224 < form onSubmit = { handleSubmit } className = "space-y-5" >
225225 { step === 1 && (
226226 < >
227- < ModalFormRow >
228- < ModalTextField
229- label = "Title"
230- name = "name"
231- placeholder = "Placeholder name"
232- required
233- value = { form . name }
234- inputProps = { { "data-tutorial" : "wishlist-title-input" } }
235- onChange = { ( e ) => {
236- setForm ( ( f ) => ( { ...f , name : e . target . value } ) ) ;
237- setSuggestions ( [ ] ) ;
238- } }
239- />
240- </ ModalFormRow >
227+ < div data-tutorial = "wishlist-title-field" >
228+ < ModalFormRow >
229+ < div className = "grow" data-tutorial = "wishlist-title-input-box" >
230+ < ModalTextField
231+ label = "Title"
232+ name = "name"
233+ placeholder = "Placeholder name"
234+ required
235+ value = { form . name }
236+ onChange = { ( e ) => {
237+ setForm ( ( f ) => ( { ...f , name : e . target . value } ) ) ;
238+ setSuggestions ( [ ] ) ;
239+ } }
240+ />
241+ </ div >
242+ </ ModalFormRow >
243+ </ div >
241244
242- { /* Suggestions block (red highlighted) */ }
243- { showSuggestions && (
244- < >
245- < div
246- className = "rounded-lg border border-red-primary bg-red-50/50 p-3 md:p-4"
247- data-tutorial = "wishlist-suggestions"
248- >
249- < div className = "mb-3" >
250- { effectiveHardMatch ? (
251- < h3 className = "text-red-primary font-semibold text-lg" >
252- This item already exists in our inventory. < br /> { " " }
253- Please request that item instead.
254- </ h3 >
245+ < div data-tutorial = "wishlist-suggestions" >
246+ { /* Suggestions block (red highlighted) */ }
247+ { showSuggestions && (
248+ < >
249+ < div className = "rounded-lg border border-red-primary bg-red-50/50 p-3 md:p-4" >
250+ < div className = "mb-3" >
251+ { effectiveHardMatch ? (
252+ < h3 className = "text-red-primary font-semibold text-lg" >
253+ This item already exists in our inventory. < br /> { " " }
254+ Please request that item instead.
255+ </ h3 >
256+ ) : (
257+ < h3 className = "text-red-primary font-semibold text-lg" >
258+ Similar items are in our inventory. < br /> Please go
259+ to Items Page if any of these match.
260+ </ h3 >
261+ ) }
262+ </ div >
263+
264+ { isTutorialSuggestions ? (
265+ < div className = "overflow-hidden rounded border border-red-primary/25 bg-white" >
266+ < div className = "grid grid-cols-2 bg-red-primary/80 px-4 py-2 text-sm font-medium text-white" >
267+ < span > Title</ span >
268+ < span > Quantity</ span >
269+ </ div >
270+ { displaySuggestions . map ( ( suggestion ) => (
271+ < div
272+ key = { suggestion . id }
273+ className = "grid grid-cols-2 border-t border-gray-100 px-4 py-2 text-sm text-gray-900"
274+ >
275+ < span > { suggestion . title } </ span >
276+ < span > { suggestion . quantity ?? "-" } </ span >
277+ </ div >
278+ ) ) }
279+ </ div >
255280 ) : (
256- < h3 className = "text-red-primary font-semibold text-lg" >
257- Similar items are in our inventory. < br /> Please go
258- to Items Page if any of these match.
259- </ h3 >
281+ < AdvancedBaseTable < AddToWishlistSuggestion >
282+ columns = { suggestionColumns }
283+ fetchFn = { suggestionFetchFn }
284+ rowId = "id"
285+ headerClassName = "bg-red-primary/80 text-white"
286+ rowCellStyles = "border border-transparent bg-white"
287+ emptyState = {
288+ < div className = "py-3 text-sm text-red-700" >
289+ No similar items found.
290+ </ div >
291+ }
292+ toolBar = { null }
293+ disablePagination
294+ disableFilters
295+ />
260296 ) }
261297 </ div >
262298
263- { isTutorialSuggestions ? (
264- < div className = "overflow-hidden rounded border border-red-primary/25 bg-white" >
265- < div className = "grid grid-cols-2 bg-red-primary/80 px-4 py-2 text-sm font-medium text-white" >
266- < span > Title</ span >
267- < span > Quantity</ span >
268- </ div >
269- { displaySuggestions . map ( ( suggestion ) => (
270- < div
271- key = { suggestion . id }
272- className = "grid grid-cols-2 border-t border-gray-100 px-4 py-2 text-sm text-gray-900"
273- >
274- < span > { suggestion . title } </ span >
275- < span > { suggestion . quantity ?? "-" } </ span >
276- </ div >
277- ) ) }
278- </ div >
279- ) : (
280- < AdvancedBaseTable < AddToWishlistSuggestion >
281- columns = { suggestionColumns }
282- fetchFn = { suggestionFetchFn }
283- rowId = "id"
284- headerClassName = "bg-red-primary/80 text-white"
285- rowCellStyles = "border border-transparent bg-white"
286- emptyState = {
287- < div className = "py-3 text-sm text-red-700" >
288- No similar items found.
289- </ div >
290- }
291- toolBar = { null }
292- disablePagination
293- disableFilters
294- />
295- ) }
296- </ div >
297-
298- < div className = "mt-6 flex gap-4" >
299- < Link
300- href = { `/items?initialItems=${ encodeURIComponent (
301- JSON . stringify ( displaySuggestions . map ( ( s ) => s . id ) )
302- ) } `}
303- className = "inline-block w-1/2 rounded-lg border border-red-primary px-4 py-2 font-medium text-red-primary hover:bg-red-50 active:translate-y-px text-center"
304- >
305- Go to Items Page
306- </ Link >
299+ < div className = "mt-6 flex gap-4" >
300+ < Link
301+ href = { `/items?initialItems=${ encodeURIComponent (
302+ JSON . stringify ( displaySuggestions . map ( ( s ) => s . id ) )
303+ ) } `}
304+ className = "inline-block w-1/2 rounded-lg border border-red-primary px-4 py-2 font-medium text-red-primary hover:bg-red-50 active:translate-y-px text-center"
305+ >
306+ Go to Items Page
307+ </ Link >
308+
309+ { /* Continue → Step 2 */ }
310+ < button
311+ type = "button"
312+ onClick = { goToStep2 }
313+ disabled = { effectiveHardMatch || ! form . name . trim ( ) }
314+ className = { `w-1/2 rounded-lg px-4 py-2 font-medium text-white active:translate-y-px ${
315+ effectiveHardMatch || ! form . name . trim ( )
316+ ? "bg-red-300 cursor-not-allowed"
317+ : "bg-red-primary hover:brightness-95"
318+ } `}
319+ >
320+ Continue with Wish
321+ </ button >
322+ </ div >
323+ </ >
324+ ) }
307325
308- { /* Continue → Step 2 */ }
326+ { /* No suggestions but non-empty title */ }
327+ { ! searching &&
328+ displaySuggestions . length === 0 &&
329+ form . name !== "" && (
309330 < button
310331 type = "button"
311332 onClick = { goToStep2 }
312- disabled = { effectiveHardMatch || ! form . name . trim ( ) }
313- className = { `w-1/2 rounded-lg px-4 py-2 font-medium text-white active:translate-y-px ${
314- effectiveHardMatch || ! form . name . trim ( )
315- ? "bg-red-300 cursor-not-allowed"
316- : "bg-red-primary hover:brightness-95"
317- } `}
333+ className = "w-full rounded-lg px-4 py-2 font-medium text-white active:translate-y-px bg-red-primary hover:brightness-95"
318334 >
319335 Continue with Wish
320336 </ button >
321- </ div >
322- </ >
323- ) }
324-
325- { /* No suggestions but non-empty title */ }
326- { ! searching && displaySuggestions . length === 0 && form . name !== "" && (
327- < button
328- type = "button"
329- onClick = { goToStep2 }
330- className = "w-full rounded-lg px-4 py-2 font-medium text-white active:translate-y-px bg-red-primary hover:brightness-95"
331- >
332- Continue with Wish
333- </ button >
334- ) }
337+ ) }
338+ </ div >
335339 </ >
336340 ) }
337341
0 commit comments