feat: expand camera analysis display with new fields
- Added distilled date, bottled date, and batch info to the analysis result summary in CameraCapture - These fields now appear only if Gemini successfully identifies them from the photo
This commit is contained in:
@@ -463,6 +463,24 @@ export default function CameraCapture({ onImageCaptured, onAnalysisComplete, onS
|
|||||||
<span className="text-zinc-500">{t('bottle.abvLabel')}:</span>
|
<span className="text-zinc-500">{t('bottle.abvLabel')}:</span>
|
||||||
<span className="font-semibold">{analysisResult.abv ? `${analysisResult.abv}%` : '-'}</span>
|
<span className="font-semibold">{analysisResult.abv ? `${analysisResult.abv}%` : '-'}</span>
|
||||||
</div>
|
</div>
|
||||||
|
{analysisResult.distilled_at && (
|
||||||
|
<div className="flex justify-between text-sm">
|
||||||
|
<span className="text-zinc-500">{t('bottle.distilledLabel')}:</span>
|
||||||
|
<span className="font-semibold">{analysisResult.distilled_at}</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{analysisResult.bottled_at && (
|
||||||
|
<div className="flex justify-between text-sm">
|
||||||
|
<span className="text-zinc-500">{t('bottle.bottledLabel')}:</span>
|
||||||
|
<span className="font-semibold">{analysisResult.bottled_at}</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{analysisResult.batch_info && (
|
||||||
|
<div className="flex justify-between text-sm">
|
||||||
|
<span className="text-zinc-500">{t('bottle.batchLabel')}:</span>
|
||||||
|
<span className="font-semibold">{analysisResult.batch_info}</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -9,7 +9,9 @@ export async function updateBottleStatus(bottleId: string, status: 'sealed' | 'o
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const { data: { session } } = await supabase.auth.getSession();
|
const { data: { session } } = await supabase.auth.getSession();
|
||||||
if (!session) throw new Error('Nicht autorisiert');
|
if (!session) {
|
||||||
|
throw new Error('Nicht autorisiert');
|
||||||
|
}
|
||||||
|
|
||||||
const { error } = await supabase
|
const { error } = await supabase
|
||||||
.from('bottles')
|
.from('bottles')
|
||||||
@@ -21,7 +23,9 @@ export async function updateBottleStatus(bottleId: string, status: 'sealed' | 'o
|
|||||||
.eq('id', bottleId)
|
.eq('id', bottleId)
|
||||||
.eq('user_id', session.user.id);
|
.eq('user_id', session.user.id);
|
||||||
|
|
||||||
if (error) throw error;
|
if (error) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
|
||||||
revalidatePath(`/bottles/${bottleId}`);
|
revalidatePath(`/bottles/${bottleId}`);
|
||||||
revalidatePath('/');
|
revalidatePath('/');
|
||||||
@@ -29,6 +33,7 @@ export async function updateBottleStatus(bottleId: string, status: 'sealed' | 'o
|
|||||||
return { success: true };
|
return { success: true };
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Update Status Error:', error);
|
console.error('Update Status Error:', error);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false,
|
||||||
error: error instanceof Error ? error.message : 'Fehler beim Aktualisieren des Status',
|
error: error instanceof Error ? error.message : 'Fehler beim Aktualisieren des Status',
|
||||||
|
|||||||
Reference in New Issue
Block a user