71 lines
1.2 KiB
TypeScript
71 lines
1.2 KiB
TypeScript
![]() |
/**
|
||
|
*/
|
||
|
namespace _zeitbild.frontend
|
||
|
{
|
||
|
|
||
|
/**
|
||
|
*/
|
||
|
type type_conf = {
|
||
|
view_mode : string;
|
||
|
calendar_id : int;
|
||
|
timezone_shift : int;
|
||
|
};
|
||
|
|
||
|
|
||
|
/**
|
||
|
*/
|
||
|
export async function main(
|
||
|
) : Promise<void>
|
||
|
{
|
||
|
// init
|
||
|
lib_plankton.log.conf_push(
|
||
|
[
|
||
|
lib_plankton.log.channel_make({"kind": "console", "data": {"threshold": "info"}}),
|
||
|
]
|
||
|
);
|
||
|
|
||
|
// conf
|
||
|
const conf : type_conf = lib_plankton.json.decode(await lib_plankton.file.read("conf.json"));
|
||
|
|
||
|
// exec
|
||
|
let content : string;
|
||
|
switch (conf.view_mode) {
|
||
|
default: {
|
||
|
content = "";
|
||
|
throw (new Error("invalid view mode"));
|
||
|
break;
|
||
|
}
|
||
|
case "table": {
|
||
|
content = await _zeitbild.frontend.view.calendar_view_table_html(
|
||
|
conf.calendar_id,
|
||
|
{
|
||
|
"from": {
|
||
|
"year": 2024,
|
||
|
"week": 35
|
||
|
},
|
||
|
"to": {
|
||
|
"year": 2024,
|
||
|
"week": 43
|
||
|
},
|
||
|
"timezone_shift": conf.timezone_shift,
|
||
|
}
|
||
|
);
|
||
|
break;
|
||
|
}
|
||
|
case "list": {
|
||
|
content = await _zeitbild.frontend.view.calendar_view_list_html(
|
||
|
conf.calendar_id,
|
||
|
{
|
||
|
"timezone_shift": conf.timezone_shift,
|
||
|
}
|
||
|
);
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
(document.querySelector("body") as HTMLBodyElement).innerHTML = content;
|
||
|
return Promise.resolve<void>(undefined);
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|