3 const th
= require('./template-helper');
6 * Show a summary of all topics.
7 * @param {object} ctx context
8 * @param {object[]} ctx.topics topics
9 * @param {object} options options
10 * @param {object} options.manager manager options
11 * @param {string} options.manager.pageTitle page title
12 * @returns {string} html
14 module
.exports
= (ctx
, options
) => {
15 const pageTitle
= `${options.manager.pageTitle} - Topics`;
16 const logoUrl
= options
.manager
.logoUrl
;
17 const footerEntries
= options
.manager
.footerEntries
;
29 ` <section class="topics">
30 <p>${ctx.topics.length ? ctx.topics.length : 'no'} topic${(ctx.topics.length === 1) ? '' : 's'}</p>
33 th
.renderTopicRowHeader(),
36 ...((ctx
?.topics
|| []).map((topic
) => th
.renderTopicRow(topic
, { length: topic
.subscribers
}))),
42 return th
.htmlPage(1, ctx
, htmlOptions
, content
);