X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=src%2Ftemplate%2Fadmin-maintenance-html.js;h=0f4de44ce599fa62b745f1b63dab9d8ec90a2ca4;hb=f0bf29c75b0fd405ff92fa76f058e61162b87e43;hp=f57a118b371d396d03c62c6e99c0881f1b786ad4;hpb=fba42a499fe1af051b0982c1f3e8b3873c9ed2fb;p=squeep-indie-auther
diff --git a/src/template/admin-maintenance-html.js b/src/template/admin-maintenance-html.js
index f57a118..0f4de44 100644
--- a/src/template/admin-maintenance-html.js
+++ b/src/template/admin-maintenance-html.js
@@ -3,6 +3,11 @@
const th = require('./template-helper');
const { sessionNavLinks } = require('@squeep/authentication-module');
+/**
+ *
+ * @param {object} entry entry
+ * @returns {string} tr
+ */
function renderAlmanacRow(entry) {
const { event, date } = entry;
return `
@@ -11,21 +16,34 @@ function renderAlmanacRow(entry) {
`;
}
+/**
+ *
+ * @param {object[]} almanac entries
+ * @returns {string} section
+ */
function almanacSection(almanac) {
return `
\tAlmanac
\t
\t\t
-\t\t\tEvent |
-\t\t\tDate |
+\t\t\t\t
+\t\t\t\tEvent |
+\t\t\t\tDate |
+\t\t\t
\t\t
\t\t
${almanac.map((entry) => renderAlmanacRow(entry)).join('\n')}
\t\t
-\t
`;
}
+/**
+ *
+ * @param {string} choreName name
+ * @param {object} choreDetails details
+ * @returns {string} tr
+ */
function renderChoreRow(choreName, choreDetails) {
const { intervalMs, nextSchedule } = choreDetails;
return `
@@ -35,33 +53,39 @@ function renderChoreRow(choreName, choreDetails) {
`;
}
+/**
+ *
+ * @param {object} chores chores
+ * @returns {string} section
+ */
function choresSection(chores) {
return `
\tChores
\t
\t\t
-\t\t\tChore |
-\t\t\tFrequency |
-\t\t\tNext Run |
+\t\t\t
+\t\t\t\tChore |
+\t\t\t\tFrequency |
+\t\t\t\tNext Run |
+\t\t\t
\t\t
\t\t
${Object.entries(chores).map((chore) => renderChoreRow(...chore)).join('\n')}
\t\t
-\t
`;
}
/**
*
- * @param {Object} ctx
- * @param {Object[]} ctx.almanac
- * @param {Object} ctx.chores
- * @param {Object} options
- * @param {Object} options.manager
- * @param {String} options.manager.pageTitle
- * @param {String[]} options.manager.footerEntries
- * @param {String} options.adminContactHTML
- * @returns {String}
+ * @param {object} ctx context
+ * @param {object[]} ctx.almanac entries
+ * @param {object} ctx.chores chores
+ * @param {object} options options
+ * @param {object} options.manager manager options
+ * @param {string} options.manager.pageTitle page title
+ * @param {string[]} options.manager.footerEntries footer entires
+ * @returns {string} page
*/
module.exports = (ctx, options) => {
const pagePathLevel = 1;