Ora / app /renderer /start.js
umer-wasim's picture
Ora 0.5.0: the plan app (Cloudflare); Ora 0.4.3 kept in previous/0.4
ea5a1e6 verified
Raw History Blame Contribute Delete
1.24 kB
'use strict';
/* global $, S, plan, planSlot, loadPlan, applyBrand, refreshOnline, showView, renderPicCount, renderStarters, renderDemoBar, aiOn, askCloudflare */
// Starts Ora: state from main, the online accounts, the sidebar's plan chip, then the plan itself.
// the sidebar's plan chip: brand colour and name (or the demo), opens the plan file dialog
function renderPlanChip() {
const b = (plan && plan.brand) || {};
$('planName').textContent = b.name || 'Your plan';
$('planDot').style.background = (b.colors || [])[0] || 'var(--muted)';
$('demoTag').hidden = planSlot() !== 'demo';
}
$('planChip').addEventListener('click', () => { renderStarters(); $('planFileNote').textContent = ''; $('fileDlg').showModal(); });
$('fileClose').addEventListener('click', () => $('fileDlg').close());
(async () => {
try { S = { ...S, ...(await window.ora.state()) }; } catch (e) { console.error(e); }
$('version').textContent = S.version ? `v${S.version}` : '';
renderPicCount();
await refreshOnline();
await loadPlan();
applyBrand();
renderDemoBar();
showView('plan');
// every start without Cloudflare: the setup page (it can be skipped)
if (!aiOn()) askCloudflare(null, 'Set up Ora');
})();