stackchain-dashboard/frontend/mobile-work-entry.js
timmy 971656b76c
All checks were successful
CI / lint (pull_request) Successful in 2m17s
CI / build-release (pull_request) Successful in 6s
CI / browser-journey (pull_request) Successful in 1m34s
CI / release-candidate (pull_request) Has been skipped
test: gate packaged mobile Plan Today handoff (Closes #985)
2026-08-16 20:27:25 +00:00

28 lines
1.1 KiB
JavaScript

(function (root, factory) {
if (typeof module === 'object' && module.exports) module.exports = factory;
else root.createMobileWorkEntry = factory;
})(typeof self !== 'undefined' ? self : this, function createMobileWorkEntry(options) {
function mode() {
if (options.isTodayActive()) return 'continue';
const recommended = options.queueLauncher && options.queueLauncher.recommend();
if (recommended && !['today', 'find'].includes(recommended.name)) return recommended.name;
if (options.getTodayCount() > 0 && options.isTodayResumable()) return 'resume';
if (options.getTodayCount() > 0) return 'start';
if (options.getEligibleCount() > 0) return 'plan';
return 'find';
}
function open() {
const current = mode();
if (current === 'continue') options.continueToday();
else if (current === 'resume') options.resumeToday();
else if (current === 'start') options.startToday();
else if (current === 'plan') options.planToday();
else if (current === 'find') options.findWork();
else options.queueLauncher.open(current);
return current;
}
return {mode, open};
});