Skip to content

Commit

Permalink
Remove show OCR if not available
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfauquette committed Mar 7, 2024
1 parent a4afc9b commit e19e96c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/pages/ingredients/ImageAnnotation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ function Annotation({
),
)}
{showOCR && (
<p>
<p style={{ marginTop: 5 * 4 }}>
{splitText(data).map(({ isIngredient, text }, i) => (
<React.Fragment key={`${text}-${i}`}>
{isIngredient ? (
Expand All @@ -108,15 +108,16 @@ function Annotation({
</p>
)}

<Button
sx={{ my: 5 }}
variant="outlined"
onClick={() => {
setShowOCR((p) => !p);
}}
>
{showOCR ? "Hidde OCR" : "Show OCR"}
</Button>
{data && (
<Button
variant="outlined"
onClick={() => {
setShowOCR((p) => !p);
}}
>
{showOCR ? "Hidde OCR" : "Show OCR"}
</Button>
)}
</React.Fragment>
);
}
Expand All @@ -142,6 +143,7 @@ export default function ImageAnnotation({
/>
<Button
fullWidth
sx={{ mt: 5 }}
disabled={isLoading || error !== null || data !== null}
onClick={getData}
variant="outlined"
Expand Down
2 changes: 2 additions & 0 deletions src/pages/ingredients/IngeredientDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,8 @@ export function IngredientAnotation(props) {
onClick={() => fetchIngredients(text, lang)}
fullWidth
loading={isLoading}
disabled={!text}
variant="outlined"
>
{t("ingredients.parsing")}
</LoadingButton>
Expand Down

0 comments on commit e19e96c

Please sign in to comment.