feat: enhance PantryList and BaslagerPage to support inventory display and improve recipe grid layout
This commit is contained in:
@@ -103,7 +103,7 @@ export default function RecipeGrid({ recipes }: { recipes: Recipe[] }) {
|
||||
) : (
|
||||
<RecipePlaceholder name={recipe.name} />
|
||||
)}
|
||||
<div style={{ padding: '0.75rem 1rem' }}>
|
||||
<div style={{ padding: '0.75rem 1rem 0.85rem' }}>
|
||||
<h3
|
||||
style={{
|
||||
margin: 0,
|
||||
@@ -119,7 +119,7 @@ export default function RecipeGrid({ recipes }: { recipes: Recipe[] }) {
|
||||
{recipe.description && (
|
||||
<p
|
||||
style={{
|
||||
margin: '0.25rem 0 0',
|
||||
margin: '0.25rem 0 0.5rem',
|
||||
fontSize: '0.85rem',
|
||||
color: '#868e96',
|
||||
overflow: 'hidden',
|
||||
@@ -131,6 +131,12 @@ export default function RecipeGrid({ recipes }: { recipes: Recipe[] }) {
|
||||
{recipe.description}
|
||||
</p>
|
||||
)}
|
||||
<div style={{ display: 'flex', gap: '0.75rem', marginTop: recipe.description ? 0 : '0.4rem', fontSize: '0.78rem', color: '#adb5bd' }}>
|
||||
{recipe.ingredients?.length > 0 && (
|
||||
<span>{recipe.ingredients.length} ingredienser</span>
|
||||
)}
|
||||
<span>{new Date(recipe.createdAt).toLocaleDateString('sv-SE')}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Link>
|
||||
|
||||
@@ -33,7 +33,7 @@ type ParseResult = {
|
||||
ingredients: ParsedIngredientRow[];
|
||||
};
|
||||
|
||||
type Step = 'input' | 'review' | 'saving';
|
||||
type Step = 'input' | 'review' | 'saving' | 'saved';
|
||||
|
||||
export default function WriteRecipePage() {
|
||||
const router = useRouter();
|
||||
@@ -201,7 +201,9 @@ export default function WriteRecipePage() {
|
||||
throw new Error(errorMessage);
|
||||
}
|
||||
|
||||
router.push('/recipes');
|
||||
setStep('saved');
|
||||
router.refresh();
|
||||
setTimeout(() => router.push('/recipes'), 2000);
|
||||
} catch (err) {
|
||||
const message = err instanceof Error ? err.message : 'Något gick fel vid sparning.';
|
||||
setError(message);
|
||||
@@ -589,6 +591,26 @@ Stek löken i lite smör. Tillsätt köttfärsen...`}</pre>
|
||||
</div>
|
||||
</section>
|
||||
)}
|
||||
|
||||
{/* SPARAT */}
|
||||
{step === 'saved' && (
|
||||
<div style={{
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
padding: '3rem',
|
||||
gap: '1rem',
|
||||
background: '#f0fdf4',
|
||||
border: '1px solid #86efac',
|
||||
borderRadius: '8px',
|
||||
textAlign: 'center',
|
||||
}}>
|
||||
<div style={{ fontSize: '3rem' }}>✓</div>
|
||||
<h2 style={{ margin: 0, color: '#166534' }}>Receptet sparades!</h2>
|
||||
<p style={{ margin: 0, color: '#15803d' }}>Du skickas strax till receptlistan...</p>
|
||||
</div>
|
||||
)}
|
||||
</main>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user