Add basic UI fo /#instance views

This commit is contained in:
Bofh 2022-11-27 21:20:18 +01:00
parent 13505f5346
commit 70d87fc25e
2 changed files with 62 additions and 11 deletions

View File

@ -84,6 +84,27 @@ a {
height: 2.5em; height: 2.5em;
} }
#window-instance #tabs {
position: relative;
z-index: 10;
}
#window-instance #tabs .item {
float: left;
}
#window-instance #tabs .tab-content {
padding: 1em;
}
#window-instance #content {
display: flex;
width: 100vw;
background: #d7d7d7;
height: 100vh;
}
#window-instance #content #container {
margin: 0 auto;
padding-top: 1em;
}
#window-instance_config { #window-instance_config {
background: #d7d7d7; background: #d7d7d7;
} }

View File

@ -1,4 +1,15 @@
<div class="flex hmax"> <div class="hmax">
<div id="tabs"></div>
<div id="tabs-item">
<a href="javascript:{action}">
<div class="tab-content">
<span>{title}</span>
</div>
</a>
</div>
<div id="content">
<div id="container"></div>
</div>
</div> </div>
<script> <script>
@ -12,8 +23,30 @@ function load__instance(args) {
}; };
const _paint = function() { const _paint = function() {
console.log(window.vars['current_instance']); const menu = [
console.log('TODO: handle UI and stuff here'); {
title: 'Filter users',
action: 'alert(&quot;hello&quot;)',
},
{
title: 'Filter posts',
action: 'alert(&quot;hello&quot;)',
},
{
title: 'New accounts',
action: 'alert(&quot;hello&quot;)',
},
];
E.template('tabs', function(TPL) {
var html = '';
for (var i = 0; i < menu.length; i++) {
var tpl = TPL;
tpl = tpl.replaceAll('{title}', menu[i]['title']);
tpl = tpl.replaceAll('{action}', menu[i]['action']);
html += tpl;
}
return html;
});
}; };
const _main = function() { const _main = function() {
@ -38,16 +71,13 @@ function load__instance(args) {
apcontrol_title(`Instance (${hargs['instance']})`); apcontrol_title(`Instance (${hargs['instance']})`);
const config = parse_ini_config(window.vars['current_instance']['config']); const config = parse_ini_config(window.vars['current_instance']['config']);
if (hargs['software'] === 'mastodon') const musthave = window.consts['instance_config'][hargs['software']]['musthave'];
{
const musthave = window.consts['instance_config']['mastodon']['musthave'];
for (var i = 0; i < musthave.length; i++) { for (var i = 0; i < musthave.length; i++) {
if (config[musthave[i]] === undefined) { if (config[musthave[i]] === undefined) {
window.location.hash = window.location.hash.replace('#instance/','#instance_config/'); window.location.hash = window.location.hash.replace('#instance/','#instance_config/');
return false; return false;
} }
} }
}
return _paint(); return _paint();
}; };