/** * @external MenuDefinition */ import menuTemplate from '!!raw-loader!../includes/templates/Menu.mustache'; import { htmlUserLanguageAttributes } from './utils'; /** * @param {string} name of the menu * @param {string} htmlItems * @return {MenuDefinition} */ function helperMakeMenuData( name, htmlItems ) { let label; switch ( name ) { case 'personal': label = 'Personal tools'; break; default: label = 'Menu label'; break; } return { id: `p-${name}`, class: `mw-portlet mw-portlet-${name} vector-menu`, label, 'html-user-language-attributes': htmlUserLanguageAttributes, 'html-items': htmlItems }; } /** * @type {MenuDefinition} */ const loggedOut = helperMakeMenuData( 'personal', `
  • Not logged in
  • Talk
  • Contributions
  • Create account
  • Log in
  • ` ); /** * @type {MenuDefinition} */ const loggedInWithEcho = helperMakeMenuData( 'personal', `
  • Jdlrobson
  • Alerts (0)
  • Notices (3)
  • Talk
  • Sandbox
  • Preferences
  • Beta
  • Watchlist
  • Contributions
  • Log out
  • ` ); const ULS_LANGUAGE_SELECTOR = '
  • English
  • '; /** * @type {MenuDefinition} */ const defaultMenu = helperMakeMenuData( 'generic', `
  • Item 1
  • Item 2
  • Item 3
  • ` ); /** * @type {MenuDefinition} */ const loggedInWithULS = helperMakeMenuData( 'personal', `${ULS_LANGUAGE_SELECTOR}
  • Jdlrobson
  • Alerts (0)
  • Notices (3)
  • Talk
  • Sandbox
  • Preferences
  • Beta
  • Watchlist
  • Contributions
  • Log out
  • ` ); /** * @type {Object.} */ const PERSONAL_MENU_TEMPLATE_DATA = { loggedOut, defaultMenu, loggedInWithEcho, loggedInWithULS }; export { PERSONAL_MENU_TEMPLATE_DATA, menuTemplate };