From 4f8313f0de37b9da69a22cb40a9574cb4416785a Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Wed, 20 Mar 2024 08:43:00 -0500 Subject: [PATCH] Refine AI button behavior --- src/photo/form/PhotoForm.tsx | 45 +++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/src/photo/form/PhotoForm.tsx b/src/photo/form/PhotoForm.tsx index 5faac6b7..b9443e70 100644 --- a/src/photo/form/PhotoForm.tsx +++ b/src/photo/form/PhotoForm.tsx @@ -142,27 +142,34 @@ export default function PhotoForm({ isLoadingDescriptionLarge, ] = useImageQuery(imageData, 'descriptionLarge'); + const renderAiButton = ( + label: string, + onClick: () => void, + isLoading: boolean, + ) => + ; + return (
-
- - - - +
+ {renderAiButton('Title', requestTitle, isLoadingTitle)} + {renderAiButton('Tags', requestTags, isLoadingTags)} + {renderAiButton( + 'Description (S)', + requestDescriptionSmall, + isLoadingDescriptionSmall, + )} + {renderAiButton( + 'Description (L)', + requestDescriptionLarge, + isLoadingDescriptionLarge, + )}