'use strict'; /* global $, S, store, brand, cleanErr, picSrc, needFields, goStep, POSTER_FONTS, wrapLines, roundRect, luminance, loadImg, renderCalendar, renderPresent, renderCampaign, renderResults, renderCourse, renderCourseSteps, renderMarket, renderAutomate, decorateAi, portraitsMaking, addDismiss, applyMissing, aiOn, askCloudflare, makePortraitNow, renderPlanChip */ // The plan (steps in renderer/course.js): 1 Brand and 2 Personas (here), 3 Competitors (market.js), 4 Campaign and // 6 Results (campaign.js), 5 Content plan and 7 Presentation (calendar.js). It lives in userData/plan.json; // "Use this brand" feeds the pictures (words, colours, logo, font) and the captions (tone, audience). const PERSONALITIES = ['Friendly', 'Premium', 'Playful', 'Bold', 'Calm', 'Expert', 'Warm', 'Modern', 'Natural', 'Trustworthy', 'Creative', 'Energetic']; const WHERE_ONLINE = ['Instagram', 'Facebook', 'LinkedIn', 'TikTok', 'YouTube', 'Google', 'Email', 'WhatsApp']; // a few colour names so image prompts get words instead of hex codes const COLOR_NAMES = [['black', '#111111'], ['charcoal', '#36454f'], ['grey', '#8a8a8a'], ['white', '#ffffff'], ['cream', '#f5efe0'], ['beige', '#d9c7a6'], ['brown', '#7b4a2a'], ['red', '#d32f2f'], ['coral', '#ff6f61'], ['pink', '#f48fb1'], ['blush pink', '#f6d1d1'], ['orange', '#f57c00'], ['peach', '#ffcc9e'], ['gold', '#d4a72c'], ['yellow', '#fdd835'], ['olive green', '#6b7b2a'], ['green', '#2e7d32'], ['mint green', '#a8e6cf'], ['teal', '#00897b'], ['turquoise', '#26c6da'], ['sky blue', '#81d4fa'], ['blue', '#1e5bd8'], ['navy blue', '#1a2a5a'], ['purple', '#6a1b9a'], ['lavender', '#c7b8ea'], ['burgundy', '#7b1f3a']]; let plan = { brand: {}, personas: [] }; const planSlot = () => (store('ora.planSlot') === 'demo' ? 'demo' : 'mine'); let planLoaded = false, planTab = 'brand'; function resetPlanLoaded() { planLoaded = false; } function hexName(hex) { const n = h => [1, 3, 5].map(i => parseInt(h.slice(i, i + 2), 16)); const [r, g, b] = n(hex); let best = COLOR_NAMES[0], d0 = Infinity; for (const c of COLOR_NAMES) { const [r2, g2, b2] = n(c[1]); const d = (r - r2) ** 2 * 0.3 + (g - g2) ** 2 * 0.59 + (b - b2) ** 2 * 0.11; if (d < d0) { d0 = d; best = c; } } return best[0]; } // --- load / save --------------------------------------------------------------------------------------------------- async function loadPlan() { if (planLoaded) return; try { plan = { brand: {}, personas: [], ...(await window.ora.planGet(planSlot())) }; } catch { } plan.brand = { name: '', offer: '', mission: '', values: '', personality: [], tone: '', tagline: '', avoid: '', colors: ['#1c6b4f', '#f5efe0'], font: 'modern', logo: null, use: true, ...plan.brand }; plan.personas = Array.isArray(plan.personas) ? plan.personas : []; planLoaded = true; } let saveTimer = null; function savePlan() { clearTimeout(saveTimer); saveTimer = setTimeout(async () => { try { await window.ora.planSet(plan, planSlot()); $('bSaved').textContent = 'Saved on this computer.'; } catch (e) { $('bSaved').textContent = cleanErr(e); } applyBrand(); if (typeof renderCourse === 'function') { renderCourseSteps(); applyMissing(); } }, 400); } // The brand as pictures use it: words and colour names added to every picture prompt (plan-make.js) function applyBrand() { const b = plan.brand; brand.on = !!(b.use !== false && b.name); brand.name = b.name || ''; brand.words = [...(b.personality || []).map(x => x.toLowerCase()), b.values].filter(Boolean).join(', '); brand.colors = (b.colors || []).map(hexName).filter((x, i, a) => a.indexOf(x) === i).join(' and '); brand.avoid = b.avoid || ''; if (typeof renderPlanChip === 'function') renderPlanChip(); } // Used by itemContext (base.js) for captions function brandVoice() { const b = plan.brand || {}; if (!b.use || !b.name) return null; return { brand: b.name, tone: [b.tone, (b.personality || []).join(', ').toLowerCase(), b.tagline && `tagline: ${b.tagline}`].filter(Boolean).join('; ') }; } function personaDesc(p) { if (!p || !p.name) return ''; return [`${p.name}${p.age ? `, ${p.age}` : ''}${p.job ? `, ${p.job}` : ''}`, p.needs && `needs: ${p.needs}`, p.motivations && `cares about: ${p.motivations}`].filter(Boolean).join('; '); } function mainPersona() { return personaDesc(plan.personas.find(x => x.main) || plan.personas[0]); } // --- Brand --------------------------------------------------------------------------------------------------------- function renderPlan() { loadPlan().then(() => { applyBrand(); renderCourse(); for (const [tab, id] of [['brand', 'paneBrand'], ['personas', 'panePersonas'], ['market', 'paneMarket'], ['campaign', 'paneCampaign'], ['calendar', 'paneCalendar'], ['automate', 'paneAutomate'], ['results', 'paneResults'], ['present', 'panePresent']]) $(id).hidden = planTab !== tab; ({ brand: renderBrandPane, personas: renderPersonas, market: renderMarket, campaign: renderCampaign, calendar: renderCalendar, automate: renderAutomate, results: renderResults, present: renderPresent })[planTab](); decorateAi(); // after the pane is drawn, so the AI draft labels land on its cards applyMissing(); }); } const BRAND_FIELDS = [['bName', 'name'], ['bOffer', 'offer'], ['bMission', 'mission'], ['bValues', 'values'], ['bTone', 'tone'], ['bTagline', 'tagline'], ['bAvoid', 'avoid']]; function renderBrandPane() { renderStarters(); const b = plan.brand; for (const [id, k] of BRAND_FIELDS) $(id).value = b[k] || ''; $('bUse').checked = b.use !== false; const chips = $('bPersonality'); chips.innerHTML = ''; for (const p of PERSONALITIES) { const c = document.createElement('button'); c.type = 'button'; c.textContent = p; c.setAttribute('aria-pressed', String(b.personality.includes(p))); c.addEventListener('click', () => { const on = b.personality.includes(p); if (!on && b.personality.length >= 3) return; b.personality = on ? b.personality.filter(x => x !== p) : [...b.personality, p]; renderBrandPane(); savePlan(); }); chips.appendChild(c); } const sw = $('bColors'); sw.innerHTML = ''; b.colors.forEach((hex, i) => { const box = document.createElement('span'); box.className = 'swatch'; const inp = document.createElement('input'); inp.type = 'color'; inp.value = hex; inp.title = hexName(hex); inp.addEventListener('input', () => { b.colors[i] = inp.value; inp.title = hexName(inp.value); savePlan(); }); box.appendChild(inp); // every colour can be removed, as long as one is left if (b.colors.length > 1) { const rm = document.createElement('button'); rm.type = 'button'; rm.className = 'swatch-x'; rm.textContent = '✕'; rm.title = `Remove ${hexName(hex)}`; rm.setAttribute('aria-label', `Remove colour ${hexName(hex)}`); rm.addEventListener('click', () => { b.colors.splice(i, 1); renderBrandPane(); savePlan(); }); box.appendChild(rm); } sw.appendChild(box); }); if (b.colors.length < 4) { const add = document.createElement('button'); add.className = 'link'; add.type = 'button'; add.textContent = '+ colour'; add.addEventListener('click', () => { b.colors.push('#d4a72c'); renderBrandPane(); savePlan(); }); sw.appendChild(add); } const fs = $('bFontSeg'); fs.innerHTML = ''; for (const [v, l] of [['modern', 'Modern'], ['serif', 'Elegant'], ['display', 'Bold']]) { const x = document.createElement('button'); x.type = 'button'; x.textContent = l; x.setAttribute('aria-checked', String(b.font === v)); x.style.fontFamily = POSTER_FONTS[v].family; x.addEventListener('click', () => { b.font = v; renderBrandPane(); savePlan(); }); fs.appendChild(x); } $('bLogoImg').hidden = !b.logo; $('bLogoRemove').hidden = !b.logo; if (b.logo) $('bLogoImg').src = picSrc(b.logo.id, b.logo.file); $('bLogoBtn').textContent = b.logo ? 'Change logo…' : 'Add logo…'; } for (const [id, k] of BRAND_FIELDS) $(id).addEventListener('input', e => { plan.brand[k] = e.target.value; savePlan(); }); $('bUse').addEventListener('change', e => { plan.brand.use = e.target.checked; savePlan(); }); $('bLogoBtn').addEventListener('click', async () => { try { const p = await window.ora.pickPhoto('logo'); if (!p) return; plan.brand.logo = { id: p.id, file: p.file }; renderBrandPane(); savePlan(); } catch (e) { $('bSaved').textContent = cleanErr(e); } }); $('bLogoRemove').addEventListener('click', () => { plan.brand.logo = null; renderBrandPane(); savePlan(); }); function brandFacts() { const b = plan.brand; return [b.name && `Brand: ${b.name}`, b.offer && `Offers: ${b.offer}`, b.values && `Values: ${b.values}`, b.personality.length && `Personality: ${b.personality.join(', ')}`, b.tone && `Tone: ${b.tone}`, b.mission && `Mission: ${b.mission}`].filter(Boolean).join('\n'); } // Every ✨ Draft and ✨ Suggest starts from the brand name and the offer: false (and those fields marked) when one is empty function brandBasicsReady(why) { const missing = [['bName', plan.brand.name], ['bOffer', plan.brand.offer]].filter(([, v]) => !String(v || '').trim()).map(([id]) => id); if (!missing.length) return true; if (planTab !== 'brand' || $('planView').hidden) goStep('brand'); setTimeout(() => needFields(missing, why), 80); return false; } async function suggest(kind, btn) { if (!brandBasicsReady(`Needed for ✨ Suggest ${kind}`)) return null; if (!aiOn() && !(await askCloudflare(`✨ Suggest writes a ${kind} with your free Cloudflare account. Connect it now, or skip and write your own.`, `Suggest a ${kind}`))) { $('bSaved').textContent = `Connect Cloudflare (in Settings › Accounts) for suggestions, or write your own ${kind}.`; return null; } const label = btn.textContent; btn.disabled = true; btn.textContent = 'Thinking…'; try { return await window.ora.improvePrompt(brandFacts(), kind); } catch (e) { const m = cleanErr(e); $('bSaved').textContent = /offline/.test(m) ? 'Connect Cloudflare (free, in Settings › Accounts) for suggestions, or write your own.' : /declined/.test(m) ? 'The online helper declined; write your own.' : m; return null; } finally { btn.disabled = false; btn.textContent = label; } } $('bMissionAi').addEventListener('click', async e => { const t = await suggest('mission', e.currentTarget); if (t) { plan.brand.mission = t.split('\n')[0]; $('bMission').value = plan.brand.mission; savePlan(); } }); $('bTaglineAi').addEventListener('click', async e => { const t = await suggest('tagline', e.currentTarget); if (!t) return; const picks = $('bTagPicks'); picks.innerHTML = ''; for (const line of t.split('\n')) { const b = document.createElement('button'); b.type = 'button'; b.textContent = line; b.addEventListener('click', () => { plan.brand.tagline = line; $('bTagline').value = line; picks.innerHTML = ''; savePlan(); }); picks.appendChild(b); } addDismiss(picks); }); // --- Personas ------------------------------------------------------------------------------------------------------ const PERSONA_FIELDS = [['name', 'Name', 'Léa'], ['age', 'Age', '29'], ['job', 'Job or situation', 'Office worker in Kirchberg'], ['needs', 'Needs and goals', 'A quick, healthy lunch she can grab on the way'], ['pains', 'Frustrations', 'Sandwiches all week; no time to cook'], ['motivations', 'What makes her choose a brand', 'Fresh, local, looks good on Instagram'], ['quote', 'In her words', '"I want healthy to be the easy choice."']]; function renderPersonas() { const g = $('personaGrid'); g.innerHTML = ''; if (!plan.personas.length) { plan.personas.push(newPersona()); plan.personas[0].main = true; } plan.personas.forEach((p, i) => { const c = document.createElement('div'); c.className = 'panel persona'; c.innerHTML = `
Where they find brands online
`; for (const el of c.querySelectorAll('[data-k]')) { const k = el.dataset.k; if (k === 'where') continue; const ph = (PERSONA_FIELDS.find(f => f[0] === k) || [])[2]; if (ph && i === 0) el.placeholder = ph; el.value = p[k] || ''; el.addEventListener('input', () => { p[k] = el.value; // a gender worked out from the name goes with that name; one picked by hand stays if (k === 'gender') delete p.genderGuessed; if (k === 'name' && p.genderGuessed) { p.gender = ''; delete p.genderGuessed; c.querySelector('[data-k=gender]').value = ''; } savePlan(); }); } const where = c.querySelector('[data-k=where]'); for (const w of WHERE_ONLINE) { const b = document.createElement('button'); b.type = 'button'; b.textContent = w; b.setAttribute('aria-pressed', String((p.where || []).includes(w))); b.addEventListener('click', () => { const on = (p.where || []).includes(w); p.where = on ? p.where.filter(x => x !== w) : [...(p.where || []), w]; b.setAttribute('aria-pressed', String(!on)); savePlan(); }); where.appendChild(b); } const pic = c.querySelector('.persona-pic'); if (p.portrait) { const im = document.createElement('img'); im.src = picSrc(p.portrait.id, p.portrait.file); pic.appendChild(im); } else pic.textContent = (p.name || '?')[0].toUpperCase(); // while its portrait is being made, the picture spins and the button waits if (portraitsMaking.has(p.id)) { pic.classList.add('making'); const b = c.querySelector('[data-a=make]'); b.disabled = true; b.textContent = 'Making…'; } const main = c.querySelector('input[type=radio]'); main.checked = !!p.main; main.addEventListener('change', () => { plan.personas.forEach(x => { x.main = x === p; }); savePlan(); }); c.querySelector('[data-a=del]').addEventListener('click', () => { if (!confirm(`Remove ${p.name || 'this persona'}?`)) return; plan.personas.splice(i, 1); if (plan.personas.length && !plan.personas.some(x => x.main)) plan.personas[0].main = true; renderPersonas(); savePlan(); }); c.querySelector('[data-a=pic]').addEventListener('click', () => pickPortrait(p, c.querySelector('.pic-picker'))); c.querySelector('[data-a=make]').addEventListener('click', e => makePortraitNow(p, e.currentTarget)); // the small remove links at the top show only when there is something to remove const nopic = c.querySelector('[data-a=nopic]'), del = c.querySelector('[data-a=del]'); nopic.hidden = !p.portrait; del.hidden = plan.personas.length < 2 && !p.name; c.querySelector('.persona-tools').hidden = nopic.hidden && del.hidden; nopic.addEventListener('click', () => { p.portrait = null; renderPersonas(); savePlan(); }); g.appendChild(c); }); $('addPersona').hidden = plan.personas.length >= 3; } function newPersona() { return { id: `p${Date.now()}`, name: '', age: '', gender: '', job: '', needs: '', pains: '', motivations: '', where: [], quote: '', portrait: null, main: false }; } function pickPortrait(p, box) { box.hidden = !box.hidden; if (box.hidden) return; box.innerHTML = ''; const own = document.createElement('button'); own.className = 'ghost'; own.type = 'button'; own.textContent = 'Choose a photo…'; own.addEventListener('click', async () => { const r = await window.ora.pickPhoto('photo'); if (r) { p.portrait = { id: r.id, file: r.file }; renderPersonas(); savePlan(); } }); box.appendChild(own); for (const m of S.pictures.filter(v => v.kind === 'image').slice(0, 40)) { for (const f of (m.images || []).slice(0, 4)) { const im = document.createElement('img'); im.src = picSrc(m.id, f); im.title = m.prompt; im.addEventListener('click', () => { p.portrait = { id: m.id, file: f }; renderPersonas(); savePlan(); }); box.appendChild(im); } } } $('addPersona').addEventListener('click', () => { plan.personas.push(newPersona()); renderPersonas(); savePlan(); }); // --- Brand Identity Summary (A4 PNG) --------------------------------------------------------------------------------- async function exportSummary() { await loadPlan(); const b = plan.brand; if (!b.name) { planTab = 'brand'; renderPlan(); $('bSaved').textContent = 'Write the brand name first.'; return; } const W = 1240, H = 1754, m = 80; const cv = document.createElement('canvas'); cv.width = W; cv.height = H; const x = cv.getContext('2d'); const F = POSTER_FONTS[b.font] || POSTER_FONTS.modern; const font = (s, w = 500) => `${w} ${s}px ${F.family}`; const body = (s, w = 400) => `${w} ${s}px -apple-system, "Segoe UI", Helvetica, Arial, sans-serif`; const c1 = b.colors[0] || '#1c1530', onC1 = luminance(c1) > 0.62 ? '#1c1530' : '#ffffff'; x.fillStyle = '#fbf8f3'; x.fillRect(0, 0, W, H); // header band x.fillStyle = c1; x.fillRect(0, 0, W, 380); let logo = null; if (b.logo) { try { logo = await loadImg(picSrc(b.logo.id, b.logo.file)); } catch { } } if (logo) { const lh = 110, lw = Math.min(260, lh * logo.width / logo.height); x.drawImage(logo, m, 70, lw, lw * logo.height / logo.width); } x.fillStyle = onC1; x.textBaseline = 'top'; x.font = body(22, 600); x.globalAlpha = 0.75; x.fillText('BRAND IDENTITY SUMMARY', m, logo ? 200 : 80); x.globalAlpha = 1; x.font = font(76, F.weight); x.fillText(b.name, m, logo ? 232 : 118, W - 2 * m); if (b.tagline) { x.font = font(34, 500); x.fillText(b.tagline, m, logo ? 322 : 214, W - 2 * m); } let y = 430; const section = (title, text, h) => { x.fillStyle = c1; x.font = body(20, 700); x.fillText(title.toUpperCase(), m, y); y += 34; x.fillStyle = '#1c1530'; x.font = body(27); for (const line of wrapLines(x, text, W - 2 * m).slice(0, h || 4)) { x.fillText(line, m, y); y += 38; } y += 26; }; if (b.offer) section('What we offer', b.offer, 2); if (b.mission) section('Mission', b.mission, 4); if (b.values) section('Values', b.values.split(',').map(v => v.trim()).filter(Boolean).join(' · '), 2); if (b.personality.length || b.tone) section('Personality and tone', [b.personality.join(', '), b.tone].filter(Boolean).join(' — '), 3); // colours and font x.fillStyle = c1; x.font = body(20, 700); x.fillText('COLOURS AND TYPE', m, y); y += 40; b.colors.forEach((hex, i) => { const sx = m + i * 170; x.fillStyle = hex; roundRect(x, sx, y, 140, 110, 16); x.fill(); x.strokeStyle = 'rgba(0,0,0,.08)'; x.stroke(); x.fillStyle = '#1c1530'; x.font = body(19, 600); x.fillText(hex.toUpperCase(), sx, y + 122); x.font = body(18); x.fillStyle = '#6b6478'; x.fillText(hexName(hex), sx, y + 148); }); x.fillStyle = '#1c1530'; x.font = font(46, F.weight); x.fillText('Aa', m + 4 * 170 + 20, y + 10); x.font = body(18); x.fillStyle = '#6b6478'; x.fillText({ modern: 'Modern', serif: 'Elegant', display: 'Bold' }[b.font] || 'Modern', m + 4 * 170 + 22, y + 72); y += 210; if (b.avoid) section('We avoid', b.avoid, 2); // personas const ps = plan.personas.filter(p => p.name).slice(0, 3); if (ps.length) { x.fillStyle = c1; x.font = body(20, 700); x.fillText('WHO WE TALK TO', m, y); y += 40; const cw = (W - 2 * m - (ps.length - 1) * 24) / ps.length, ch = Math.min(420, H - y - 110); for (const [i, p] of ps.entries()) { const cx = m + i * (cw + 24); x.fillStyle = '#ffffff'; roundRect(x, cx, y, cw, ch, 20); x.fill(); x.strokeStyle = 'rgba(28,21,48,.1)'; x.stroke(); let im = null; if (p.portrait) { try { im = await loadImg(picSrc(p.portrait.id, p.portrait.file)); } catch { } } x.save(); x.beginPath(); x.arc(cx + 70, y + 70, 46, 0, Math.PI * 2); x.closePath(); x.clip(); if (im) { const s = Math.max(92 / im.width, 92 / im.height); x.drawImage(im, cx + 70 - im.width * s / 2, y + 70 - im.height * s / 2, im.width * s, im.height * s); } else { x.fillStyle = '#eee6dc'; x.fillRect(cx + 24, y + 24, 92, 92); } x.restore(); x.fillStyle = '#1c1530'; x.font = body(26, 700); x.fillText(p.name, cx + 130, y + 40, cw - 150); x.font = body(18); x.fillStyle = '#6b6478'; x.fillText([p.age, p.job].filter(Boolean).join(' · '), cx + 130, y + 76, cw - 150); let py = y + 140; for (const [k, label] of [['needs', 'Needs'], ['pains', 'Frustrations'], ['motivations', 'Chooses a brand for']]) { if (!p[k]) continue; x.fillStyle = c1; x.font = body(15, 700); x.fillText(label.toUpperCase(), cx + 24, py); py += 22; x.fillStyle = '#1c1530'; x.font = body(18); for (const line of wrapLines(x, p[k], cw - 48).slice(0, 3)) { if (py > y + ch - 60) break; x.fillText(line, cx + 24, py); py += 25; } py += 10; } if (p.where && p.where.length && py < y + ch - 30) { x.fillStyle = '#6b6478'; x.font = body(16); x.fillText(p.where.join(' · '), cx + 24, y + ch - 40, cw - 48); } } } x.fillStyle = '#9a93a6'; x.font = body(16); x.fillText(`Made with Ora · ${new Date().toLocaleDateString()}`, m, H - 50); const blob = await new Promise(r => cv.toBlob(r, 'image/png')); const target = await window.ora.planExport(`${b.name} - Brand Identity Summary`, new Uint8Array(await blob.arrayBuffer()), 'png'); // the same page as an A4 PDF, for printing and handing in const html = ``; const pdf = await window.ora.planPdf(`${b.name} - Brand Identity Summary`, html, 'a4'); $('bSaved').textContent = `Saved in Documents/Ora: ${target.split(/[\\/]/).pop()} and ${pdf.split(/[\\/]/).pop()}`; return target; } $('bExport').addEventListener('click', () => exportSummary().catch(e => { $('bSaved').textContent = cleanErr(e); })); $('pExport').addEventListener('click', async e => { const b = e.currentTarget, label = b.textContent; try { await exportSummary(); b.textContent = 'Saved ✓ (Documents/Ora)'; } catch (err) { b.textContent = cleanErr(err); } setTimeout(() => { b.textContent = label; }, 4000); }); // --- classroom pack: example businesses, and the plan as a file ----------------------------------------------------- const STARTERS = [ { label: 'Café', brand: { name: 'Bean & Bloom', offer: 'Specialty coffee and homemade cakes in Esch-sur-Alzette', mission: 'A warm corner where neighbours meet over great coffee and cakes baked every morning.', values: 'local, homemade, welcoming, fair trade', personality: ['Warm', 'Friendly', 'Natural'], tone: 'warm and chatty, like a friendly barista', tagline: 'Your daily cup of calm.', avoid: 'paper cups piled up', colors: ['#7b4a2a', '#f5efe0', '#d4a72c'], font: 'serif' }, personas: [{ name: 'Sofia', gender: 'woman', age: '34', job: 'Remote designer', needs: 'A calm place to work for a few hours with good wifi', pains: 'Noisy chains and rushed service', motivations: 'Atmosphere, good coffee, friendly staff', where: ['Instagram', 'Google'] }, { name: 'Jean', gender: 'man', age: '67', job: 'Retired teacher', needs: 'Somewhere to meet friends in the afternoon', pains: 'Modern places feel cold', motivations: 'Homemade cakes and a personal welcome', where: ['Facebook', 'Google'] }], campaign: { name: 'Autumn Cake Week', goal: 'visits', message: 'A new homemade cake every day this week.', value: 'Baked in our kitchen every morning', offer: 'Free cake with your second coffee', cta: 'Visit us today', channels: ['Instagram', 'Facebook', 'Google Business'] } }, { label: 'Fitness trainer', brand: { name: 'MoveWithMia', offer: 'Personal training and small group classes in Luxembourg City', mission: 'Help busy people feel strong and confident with short, effective workouts.', values: 'energy, consistency, no judgement', personality: ['Energetic', 'Friendly', 'Expert'], tone: 'motivating, direct and positive', tagline: 'Thirty minutes. Stronger every week.', avoid: 'extreme diets, before-and-after photos', colors: ['#e34948', '#1a2a5a', '#f5efe0'], font: 'display' }, personas: [{ name: 'Tom', gender: 'man', age: '38', job: 'Bank employee, father of two', needs: 'Get fit with little time', pains: 'Gyms feel intimidating; no time', motivations: 'Clear plan, quick results, flexible times', where: ['Instagram', 'LinkedIn'] }, { name: 'Ana', gender: 'woman', age: '27', job: 'Nurse working shifts', needs: 'Workouts that fit irregular hours', pains: 'Classes always at the wrong time', motivations: 'Community and encouragement', where: ['Instagram', 'TikTok'] }], campaign: { name: '30-Day Kickstart', goal: 'leads', message: 'Thirty days, three short sessions a week, real results.', value: 'Coaching that fits your calendar', offer: 'First session free', cta: 'Book your free session', channels: ['Instagram', 'Facebook', 'Website'] } }, { label: 'Clothing brand', brand: { name: 'Lumo Wear', offer: 'Sustainable everyday clothing made in Europe', mission: 'Make simple, durable clothes people love wearing for years.', values: 'sustainable, timeless, transparent', personality: ['Modern', 'Calm', 'Trustworthy'], tone: 'calm, clear and honest', tagline: 'Made to stay.', avoid: 'fast-fashion hauls', colors: ['#36454f', '#d9c7a6', '#ffffff'], font: 'modern' }, personas: [{ name: 'Clara', gender: 'woman', age: '31', job: 'Architect', needs: 'A small wardrobe that works for office and weekend', pains: 'Clothes that fall apart after a season', motivations: 'Quality, origin, simple design', where: ['Instagram', 'Email'] }, { name: 'Max', gender: 'man', age: '24', job: 'Student', needs: 'Affordable basics that last', pains: 'Not sure what is really sustainable', motivations: 'Honest information and fair prices', where: ['TikTok', 'Instagram'] }], campaign: { name: 'The Lasting Basics', goal: 'sales', message: 'Five basics you will wear for years.', value: 'Made in Europe from organic cotton', offer: '15% off the basics set', cta: 'Shop the set', channels: ['Instagram', 'Website', 'Email'] } }, { label: 'Startup', brand: { name: 'Taskly', offer: 'A simple planning app for small teams', mission: 'Help small teams plan their week in ten minutes and get back to real work.', values: 'simple, fast, helpful', personality: ['Modern', 'Friendly', 'Expert'], tone: 'clear, friendly and practical; no buzzwords', tagline: 'Plan less. Do more.', avoid: 'stock photos of handshakes', colors: ['#6250d6', '#1baf7a', '#f5efe0'], font: 'display' }, personas: [{ name: 'Nadia', gender: 'woman', age: '36', job: 'Runs a 6-person agency', needs: 'See who is doing what this week', pains: 'Too many tools, meetings to plan meetings', motivations: 'Time saved, easy to learn', where: ['LinkedIn', 'Email'] }, { name: 'Luca', gender: 'man', age: '29', job: 'Freelance developer', needs: 'Keep client work on track', pains: 'Forgets small tasks', motivations: 'Free plan, works on phone', where: ['LinkedIn', 'YouTube'] }], campaign: { name: 'Ten-Minute Monday', goal: 'leads', message: 'Plan your team\'s week in ten minutes, every Monday.', value: 'Set up in 5 minutes, free for small teams', offer: 'Free for teams up to 5', cta: 'Try it free', channels: ['LinkedIn', 'Website', 'Email'] } }, { label: 'Personal brand', brand: { name: 'Sara Haddad', offer: 'Career coaching for young professionals in Luxembourg', mission: 'Help young professionals find work they enjoy and grow with confidence.', values: 'honest, practical, encouraging', personality: ['Warm', 'Expert', 'Trustworthy'], tone: 'personal, encouraging and practical', tagline: 'Your next step, with confidence.', avoid: 'empty motivational quotes', colors: ['#1e5bd8', '#f6d1d1', '#ffffff'], font: 'serif' }, personas: [{ name: 'Yanis', gender: 'man', age: '26', job: 'Junior analyst, two years in', needs: 'Decide whether to change job or ask for a promotion', pains: 'Feels stuck, unsure how to negotiate', motivations: 'Concrete advice from someone who has done it', where: ['LinkedIn', 'Instagram'] }, { name: 'Emma', gender: 'woman', age: '23', job: 'New graduate', needs: 'Land a first job in Luxembourg', pains: 'Applications without answers', motivations: 'CV and interview tips that work', where: ['LinkedIn', 'TikTok'] }], campaign: { name: 'Career Clarity Month', goal: 'engagement', message: 'One practical career tip every week this month.', value: 'Real advice from ten years in hiring', offer: 'Free 20-minute CV check', cta: 'Book your CV check', channels: ['LinkedIn', 'Instagram'] } }, ]; function useStarter(st) { if ((plan.brand && plan.brand.name) && !confirm(`Replace your plan with the example "${st.brand.name}"? Save yours to a file first if you want to keep it.`)) return; plan = { brand: { ...plan.brand, ...st.brand, logo: null, use: true }, personas: st.personas.map((p, i) => ({ ...newPersona(), id: `p${Date.now()}${i}`, ...p, main: i === 0 })), campaign: { start: '', end: '', funnel: {}, metrics: [{ id: 'reach', target: '2000' }, { id: 'er', target: '4' }, { id: 'followers', target: '50' }], ...st.campaign } }; savePlan(); renderPlan(); $('planFileNote').textContent = `Example loaded: ${st.brand.name}. Next: 4 · Campaign, then 5 · Content plan › ✨ Suggest ideas › Fill the month.`; } function renderStarters() { const box = $('starterList'); if (box.childElementCount) return; for (const st of STARTERS) { const b = document.createElement('button'); b.type = 'button'; b.textContent = `${st.label} · ${st.brand.name}`; b.addEventListener('click', () => useStarter(st)); box.appendChild(b); } } $('planSaveFile').addEventListener('click', async () => { try { const f = await window.ora.planExport(`${plan.brand.name || 'My'} plan`, new TextEncoder().encode(JSON.stringify({ app: 'Ora', kind: 'plan', version: 1, plan }, null, 2)), 'json'); $('planFileNote').textContent = `Saved ${f.split(/[\\/]/).pop()} in Documents/Ora.`; } catch (e) { $('planFileNote').textContent = cleanErr(e); } }); $('planOpenFile').addEventListener('click', () => $('planFile').click()); $('planNew').addEventListener('click', async () => { if (planSlot() === 'demo') { $('planFileNote').textContent = 'This is the demo: press Back to my plan first.'; return; } if (!confirm('Start a new, empty plan? Everything in your plan now is cleared (brand, personas, competitors, campaign, calendar and results). Your pictures stay in Pictures. Save your plan to a file first if you want to keep it.')) return; plan = { brand: {}, personas: [] }; planLoaded = false; await window.ora.planSet(plan, planSlot()); await loadPlan(); savePlan(); goStep('brand'); $('planFileNote').textContent = 'A new, empty plan. Start with your brand name and what you offer.'; }); $('planFile').addEventListener('change', async e => { const file = e.target.files[0]; e.target.value = ''; if (!file) return; try { const data = JSON.parse(await file.text()); const p = data && data.kind === 'plan' ? data.plan : data; if (!p || typeof p !== 'object' || !p.brand) throw new Error('This is not a plan file (Ora or Ora).'); if (plan.brand && plan.brand.name && !confirm(`Replace your plan with "${p.brand.name || 'this plan'}"?`)) return; // pictures (logo, portraits) point to this computer's pictures; drop the ones that are not here const here = id => S.pictures.some(v => v.id === id) || /^upload-/.test(id); if (p.brand.logo && !here(p.brand.logo.id)) p.brand.logo = null; for (const x of p.personas || []) if (x.portrait && !here(x.portrait.id)) x.portrait = null; plan = { brand: {}, personas: [], ...p }; planLoaded = false; await window.ora.planSet(plan, planSlot()); await loadPlan(); savePlan(); renderPlan(); $('planFileNote').textContent = `Opened the plan for ${plan.brand.name || 'your brand'}.`; } catch (err) { $('planFileNote').textContent = cleanErr(err); } });