lotus/curiosrc/web/static/ux/curio-ux.mjs
Andrew Jackson (Ajax) 6b3e9b109f
feat: curio: sectors UI (#11869)
* cfg edit 1

* jsonschema deps

* feat: lp mig - first few steps

* lp mig: default tasks

* code comments

* docs

* lp-mig-progress

* shared

* comments and todos

* fix: curio: rename lotus-provider to curio (#11645)

* rename provider to curio

* install gotext

* fix lint errors, mod tidy

* fix typo

* fix API_INFO and add gotext to circleCI

* add back gotext

* add gotext after remerge

* lp: channels doc

* finish easy-migration TODOs

* out generate

* merging and more renames

* avoid make-all

* minor doc stuff

* cu: make gen

* make gen fix

* make gen

* tryfix

* go mod tidy

* minor ez migration fixes

* ez setup - ui cleanups

* better error message

* guided setup colors

* better path to saveconfigtolayer

* loadconfigwithupgrades fix

* readMiner oops

* guided - homedir

* err if miner is running

* prompt error should exit

* process already running, miner_id sectors in migration

* dont prompt for language a second time

* check miner stopped

* unlock repo

* render and sql oops

* curio easyMig - some fixes

* easyMigration runs successfully

* lint

* part 2 of last

* message

* merge addtl

* fixing guided setup for myself

* warn-on-no-post

* EditorLoads

* cleanups and styles

* create info

* fix tests

* make gen

* sector early bird

* sectors v2

* sector termination v1

* terminate2

* mjs

* minor things

* flag bad sectors

* fix errors

* add dealweight and deals

* change column width

* refactor sql, handle sealing sectors

* fix estimates

---------

Co-authored-by: LexLuthr <88259624+LexLuthr@users.noreply.github.com>
Co-authored-by: LexLuthr <lexluthr@protocol.ai>
Co-authored-by: LexLuthr <lexluthr@curiostorage.org>
2024-04-18 14:57:29 -05:00

70 lines
1.9 KiB
JavaScript

import {LitElement, css, html} from 'https://cdn.jsdelivr.net/gh/lit/dist@3/all/lit-all.min.js';
class CurioUX extends LitElement {
static styles = css`
.curio-slot {
}
`;
connectedCallback() {
super.connectedCallback();
const links = [
"https://unpkg.com/@cds/core/global.min.css",
"https://unpkg.com/@cds/city/css/bundles/default.min.css",
"https://unpkg.com/@cds/core/styles/theme.dark.min.css",
"https://unpkg.com/@clr/ui/clr-ui.min.css",
"https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css"
];
const head = document.head;
links.forEach(link => {
const linkNode = document.createElement('link');
linkNode.rel = 'stylesheet';
linkNode.href = link;
head.appendChild(linkNode);
});
var theme = document.createAttribute('cds-theme');
theme.value = localStorage.getItem('theme') || 'dark';
document.body.attributes.setNamedItem(theme);
var cdsText = document.createAttribute('cds-text');
cdsText.value = 'body';
document.body.attributes.setNamedItem(cdsText);
document.body.style.visibility = 'initial';
// how Bootstrap & DataTables expect dark mode declared.
document.documentElement.classList.add('dark');
this.messsage = this.getCookieMessage();
}
render() {
return html`
<!-- wrap the slot -->
<div>
${this.message? html`<div>${this.message}</div>`: html``}
<slot class="curio-slot"></slot>
</div>
`;
}
getCookieMessage() {
const name = 'message';
const cookies = document.cookie.split(';');
for (let i = 0; i < cookies.length; i++) {
const cookie = cookies[i].trim();
if (cookie.startsWith(name + '=')) {
var val = cookie.substring(name.length + 1);
document.cookie = name + '=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;';
return val;
}
}
return null;
}
};
customElements.define('curio-ux', CurioUX);