/**
* @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 inTalkContributionsCreate accountLog in`
);
/**
* @type {MenuDefinition}
*/
const loggedInWithEcho = helperMakeMenuData(
'personal',
`JdlrobsonAlerts (0)Notices (3)TalkSandboxPreferencesBetaWatchlistContributionsLog 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}JdlrobsonAlerts (0)Notices (3)TalkSandboxPreferencesBetaWatchlistContributionsLog out`
);
/**
* @type {Object.}
*/
const PERSONAL_MENU_TEMPLATE_DATA = {
loggedOut,
defaultMenu,
loggedInWithEcho,
loggedInWithULS
};
export { PERSONAL_MENU_TEMPLATE_DATA, menuTemplate };