79 lines
2.0 KiB
JavaScript
79 lines
2.0 KiB
JavaScript
"use strict";
|
|
|
|
import {Div, UL, LI, Span, Nav, A} from "../Utils/HTMLDSL.ecma.js";
|
|
|
|
/**
|
|
* @typedef {import("../Application/AnP.ecma.js").AnP} AnP
|
|
*/
|
|
|
|
/**
|
|
* @class SessionMiniComponent
|
|
* @constructor
|
|
* @param {!AnP} anp
|
|
* @return {void}
|
|
* @access private
|
|
* @static
|
|
*/
|
|
export const SessionMiniComponent = (function(){
|
|
|
|
/**
|
|
* @constructs SessionMiniComponent
|
|
* @param {!AnP} anp
|
|
* @return {void}
|
|
* @access private
|
|
* @static
|
|
*/
|
|
const SessionMiniComponent = function(anp){
|
|
|
|
/** @type {SessionMiniComponent} */
|
|
const self = this;
|
|
|
|
/**
|
|
* @returns {void}
|
|
* @access private
|
|
*/
|
|
const constructor = () => {};
|
|
|
|
/**
|
|
* @returns {Array.<any|null>}
|
|
* @access public
|
|
*/
|
|
this.build = () => Div({
|
|
class : "sessions-mini",
|
|
data_status : "unlogged"
|
|
}, [
|
|
anp.components.image({}),
|
|
UL({class : "info"}, Object.entries({
|
|
user : "Guest",
|
|
ip : "::1"
|
|
}).map(([field, _default]) => LI({
|
|
class : field,
|
|
data_i18n : field,
|
|
data_i18n_without : true,
|
|
title : anp.i18n.get(field),
|
|
}, [
|
|
anp.components.icon(field),
|
|
anp.components.i18n(field),
|
|
Span({class : "value"}, _default)
|
|
]))),
|
|
Nav({class : "actions"}, [
|
|
UL(null, ["login", "register", "logout"].map(action => LI({class : action}, [
|
|
A({
|
|
href : "#/" + action,
|
|
data_i18n : action,
|
|
data_i18n_without : true,
|
|
title : anp.i18n.get(action)
|
|
}, [
|
|
anp.components.icon(action),
|
|
anp.components.i18n(action)
|
|
])
|
|
])))
|
|
])
|
|
]);
|
|
|
|
constructor();
|
|
|
|
};
|
|
|
|
return SessionMiniComponent;
|
|
})(); |