update dependencies and devDependencies, address lint issues
[squeep-indie-auther] / src / template / root-html.js
index 1c3f4ebec70a547e9151cd08a1d93e9fbda48f2e..c6095dc4384bd59e0792a3754d55b59a76bad609 100644 (file)
@@ -1,7 +1,11 @@
 'use strict';
 
 const th = require('./template-helper');
+const { sessionNavLinks } = require('@squeep/authentication-module');
 
+/**
+ * @returns {string} section
+ */
 function aboutSection() {
   return `
       <section class="about">
@@ -18,6 +22,10 @@ function aboutSection() {
       </section>`;
 }
 
+/**
+ * @param {string} contactHTML content
+ * @returns {string} section
+ */
 function contactSection(contactHTML) {
   let section = '';
   if (contactHTML) {
@@ -30,37 +38,31 @@ ${contactHTML}
 
 /**
  * 
- * @param {Object} ctx
- * @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} options options
+ * @param {object} options.manager manager options
+ * @param {string} options.manager.pageTitle page title
+ * @param {string[]} options.manager.footerEntries footer entries
+ * @param {string=} options.adminContactHTML content
+ * @returns {string} page
  */
 module.exports = (ctx, options) => {
+  const pagePathLevel = 0;
   const contactHTML = options.adminContactHTML;
   const htmlOptions = {
+    pageIdentifier: 'root',
     pageTitle: options.manager.pageTitle,
     logoUrl: options.manager.logoUrl,
     footerEntries: options.manager.footerEntries,
-    navLinks: [
-      {
-        text: 'Admin',
-        href: 'admin/',
-      },
-      {
-        text: 'Ticket',
-        href: 'admin/ticket',
-      },
-    ],
     headElements: [
       `<link rel="indieauth-metadata" href="${options.dingus.selfBaseUrl}${options.route.metadata}">`,
     ],
   };
+  th.navLinks(pagePathLevel, ctx, htmlOptions);
+  sessionNavLinks(pagePathLevel, ctx, htmlOptions);
   const content = [
     aboutSection(),
     contactSection(contactHTML),
   ];
-  return th.htmlPage(1, ctx, htmlOptions, content);
+  return th.htmlPage(pagePathLevel, ctx, htmlOptions, content);
 };
\ No newline at end of file