// Komida – Collection (clean) + Add recipe flow const CPLUM='#5A2D39', CDEEP='#361A22', CSAND='#F2ECE2', CCARD='#FBF8F3', CINK='#36302E', CMUT='rgba(54,48,46,0.6)', CLINE='rgba(90,45,57,0.14)'; const RECIPES = [ { n:'Homemade fish gratin', cat:'Dinner', t:'45 min', d:'Easy', img:'assets/fiskegrateng.png' }, { n:'Coconut chicken stew', cat:'Dinner', t:'40 min', d:'Medium', img:'assets/food-kylling.png' }, { n:'Lentil stew with spinach', cat:'Dinner', t:'30 min', d:'Easy', img:'assets/food-linsegryte.png' }, { n:'Green galette', cat:'Dinner', t:'50 min', d:'Medium', img:'assets/food-galette.png' }, { n:'Red lentil soup', cat:'Soup', t:'25 min', d:'Easy', img:'assets/food-linsesuppe.png' }, { n:'Berry smoothie', cat:'Smoothies', t:'5 min', d:'Easy', img:'assets/food-smoothie.png' }, { n:'Chocolate brownie', cat:'Cakes', t:'55 min', d:'Medium', img:'assets/food-brownie.png' }, { n:'Tomato soup with egg', cat:'Soup', t:'25 min', d:'Easy', img:'https://images.unsplash.com/photo-1547592180-85f173990554?w=400&q=70' }, ]; const CATS = ['All','Breakfast','Soup','Dinner','Smoothies','Cakes','Cookies']; function CDiff({ d, c=CMUT }) { const f = d==='Advanced'?1 : d==='Medium'?0.5 : 0.28; const h = f*12.8, y = 18.4-h, id='cl'+d; return ; } function CClock({ c=CMUT }) { return ; } // ── Collection: quiet, no visible scroll chrome function SCollection({ onNav, open, add }) { const [cat, setCat] = React.useState('All'); const list = cat==='All' ? RECIPES : RECIPES.filter(r=>r.cat===cat); return (
Collection
{/* add recipe – single clear action under the title */}
Add new recipe
{/* categories – one row, evenly spaced */}
{CATS.map(c=>{ const on = c===cat; return ( ); })}
{/* grid – clipped by the fade, no scrollbar */}
{list.map(r=>(
{r.n}
{r.d} {r.t}
))}
); } // ── Add recipe: choose a route function SAddChoose({ back, url, manual }) { const Opt = ({ icon, h, p, onClick, primary }) => (
{icon}
{h}
{p}
); return (
Add a recipe
Paste a link and we pull it apart for you, or write it from scratch.
} h="Paste a link" p="From any recipe site. We find the ingredients and steps, then you check them."/> } h="Write it myself" p="Type the ingredients and steps, and add your own photos."/>
); } // ── Paste a link function SAddUrl({ back, next }) { const [v, setV] = React.useState(''); const ok = v.trim().length > 6; return (
Add from a link
We set up the ingredients and steps as a draft. You check it before saving.
setV(e.target.value)} placeholder="Paste a link" style={{ width:'100%', height:54, borderRadius:14, padding:'0 16px', outline:'none', marginTop:30, border:`1.5px solid ${ok ? CPLUM : CLINE}`, background:'#fff', fontFamily:'Manrope', fontSize:15.5, color:CDEEP }}/>
); } // ── Review / edit before saving function SAddEdit({ back, save, prefilled }) { const [tab, setTab] = React.useState('details'); const [ings, setIngs] = React.useState(prefilled ? [['Cod fillet','600','g'],['Macaroni','300','g'],['Milk','5','dl'],['Butter','60','g'],['Cheese','150','g']] : [['','','g']]); const [steps, setSteps] = React.useState(prefilled ? [['Boil the macaroni for 8 minutes','assets/fiskegrateng.png'], ['Melt butter, stir in flour, add milk','assets/food-linsesuppe.png'], ['Fold in the cod and pour into a dish',''], ['Bake at 200°C for 25 minutes','']] : [['','']]); const [hero, setHero] = React.useState(prefilled ? 'assets/fiskegrateng.png' : null); const Fld = ({ l, v, ph }) => (
{l}
); const TABS = [['details','Details'],['ingredients','Ingredients'],['steps','Steps']]; return (
{prefilled ? 'Check the recipe' : 'New recipe'}
{prefilled && (
We found 5 ingredients and 4 steps. Edit anything before saving.
)}
{TABS.map(([k,l])=>(
setTab(k)} style={{ flex:1, textAlign:'center', padding:'8px 0', borderRadius:999, cursor:'pointer', background: tab===k?'#fff':'transparent', fontSize:12.5, fontWeight: tab===k?700:600, color: tab===k?CPLUM:CMUT }}>{l}
))}
{tab==='details' && ( <>
Final photo
{hero ? : + Add top-view photo}
)} {tab==='ingredients' && ( <> {ings.map((it,i)=>(
))} )} {tab==='steps' && ( <> {steps.map((st,i)=>(
{i+1}
{st[1] ? : + Step photo}
))} )}
); } Object.assign(window, { SCollection, SAddChoose, SAddUrl, SAddEdit });