0.0.4
This commit is contained in:
parent
188286cf44
commit
91d46135d3
65
css/main.css
65
css/main.css
@ -188,12 +188,6 @@ sm-popup sm-input:not(:last-of-type) {
|
|||||||
sm-popup sm-textarea {
|
sm-popup sm-textarea {
|
||||||
margin-top: 1rem;
|
margin-top: 1rem;
|
||||||
}
|
}
|
||||||
sm-popup sm-textarea::part(textarea) {
|
|
||||||
border-radius: 0.4rem;
|
|
||||||
}
|
|
||||||
sm-popup p {
|
|
||||||
margin-block-end: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.popup-header {
|
.popup-header {
|
||||||
padding: 1.5rem;
|
padding: 1.5rem;
|
||||||
@ -208,7 +202,7 @@ sm-popup p {
|
|||||||
stroke-width: 10;
|
stroke-width: 10;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
.popup-header sm-button {
|
.popup-header sm-button, .popup-header button {
|
||||||
width: auto;
|
width: auto;
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
}
|
}
|
||||||
@ -251,6 +245,9 @@ button:disabled {
|
|||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
margin-bottom: 1.5rem;
|
margin-bottom: 1.5rem;
|
||||||
}
|
}
|
||||||
|
#confirmation .flex {
|
||||||
|
margin-top: 1rem;
|
||||||
|
}
|
||||||
#confirmation .flex sm-button:first-of-type {
|
#confirmation .flex sm-button:first-of-type {
|
||||||
margin-right: 0.6em;
|
margin-right: 0.6em;
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
@ -282,6 +279,7 @@ button:disabled {
|
|||||||
width: auto;
|
width: auto;
|
||||||
}
|
}
|
||||||
.copy-row h4 {
|
.copy-row h4 {
|
||||||
|
font-family: "Roboto", sans-serif;
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
}
|
}
|
||||||
@ -402,13 +400,9 @@ button:disabled {
|
|||||||
border-radius: 2rem;
|
border-radius: 2rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
sm-input::part(input) {
|
|
||||||
border-radius: 0.4rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
#sheets_container {
|
#sheets_container {
|
||||||
gap: 2rem 1.5rem;
|
gap: 2rem 1.5rem;
|
||||||
grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr));
|
grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
|
||||||
margin-bottom: 3rem;
|
margin-bottom: 3rem;
|
||||||
animation: slide-up 0.6s forwards cubic-bezier(0.175, 0.885, 0.32, 1.275);
|
animation: slide-up 0.6s forwards cubic-bezier(0.175, 0.885, 0.32, 1.275);
|
||||||
}
|
}
|
||||||
@ -452,7 +446,8 @@ sm-input::part(input) {
|
|||||||
transform: scale(0.95);
|
transform: scale(0.95);
|
||||||
}
|
}
|
||||||
.sheet-card .card {
|
.sheet-card .card {
|
||||||
border-radius: 0.8rem;
|
position: relative;
|
||||||
|
border-radius: 0.4rem;
|
||||||
background: url(card-bg2.svg) center, rgba(var(--text-color), 0.06);
|
background: url(card-bg2.svg) center, rgba(var(--text-color), 0.06);
|
||||||
background-size: contain;
|
background-size: contain;
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
@ -468,6 +463,18 @@ sm-input::part(input) {
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
max-width: 90%;
|
max-width: 90%;
|
||||||
}
|
}
|
||||||
|
.sheet-card h5 {
|
||||||
|
font-family: "Roboto", sans-serif;
|
||||||
|
background: rgba(var(--text-color), 0.1);
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
margin: 0.5rem 0;
|
||||||
|
padding: 0.4rem 0.6rem;
|
||||||
|
border-radius: 0.2rem 0 0 0.2rem;
|
||||||
|
font-weight: 500;
|
||||||
|
opacity: 0.8;
|
||||||
|
}
|
||||||
|
|
||||||
#sheet_page {
|
#sheet_page {
|
||||||
width: 100vw;
|
width: 100vw;
|
||||||
@ -480,6 +487,15 @@ sm-input::part(input) {
|
|||||||
opacity: 0.9;
|
opacity: 0.9;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#sheet_type {
|
||||||
|
padding: 0.3rem 0.6rem;
|
||||||
|
border-radius: 0.3rem;
|
||||||
|
margin: 0 1rem;
|
||||||
|
font-weight: 500;
|
||||||
|
opacity: 0.8;
|
||||||
|
background: rgba(var(--text-color), 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
#sheet_description {
|
#sheet_description {
|
||||||
margin-top: 0.8rem;
|
margin-top: 0.8rem;
|
||||||
opacity: 0.8;
|
opacity: 0.8;
|
||||||
@ -526,6 +542,9 @@ sm-input::part(input) {
|
|||||||
#sheet_details .flex:first-of-type {
|
#sheet_details .flex:first-of-type {
|
||||||
margin-bottom: 1rem;
|
margin-bottom: 1rem;
|
||||||
}
|
}
|
||||||
|
#sheet_details .flex:nth-of-type(2) {
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
}
|
||||||
#sheet_details .flex:not(:first-of-type) {
|
#sheet_details .flex:not(:first-of-type) {
|
||||||
margin-bottom: 0.3rem;
|
margin-bottom: 0.3rem;
|
||||||
}
|
}
|
||||||
@ -550,7 +569,8 @@ sm-input::part(input) {
|
|||||||
opacity: 0.9;
|
opacity: 0.9;
|
||||||
}
|
}
|
||||||
#sheet_details.collapse #sheet_description,
|
#sheet_details.collapse #sheet_description,
|
||||||
#sheet_details.collapse #sheet_editors {
|
#sheet_details.collapse #sheet_editors,
|
||||||
|
#sheet_details.collapse #sheet_type {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -578,10 +598,6 @@ table input:disabled {
|
|||||||
border: transparent;
|
border: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
thead {
|
|
||||||
background-color: rgba(var(--text-color), 0.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
th {
|
th {
|
||||||
position: sticky;
|
position: sticky;
|
||||||
top: 0;
|
top: 0;
|
||||||
@ -692,6 +708,13 @@ td {
|
|||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#user_popup sm-button {
|
||||||
|
margin-top: 0.5rem;
|
||||||
|
}
|
||||||
|
#user_popup section:not(:last-of-type) {
|
||||||
|
margin-bottom: 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
@media screen and (min-width: 640px) {
|
@media screen and (min-width: 640px) {
|
||||||
sm-popup::part(popup) {
|
sm-popup::part(popup) {
|
||||||
width: 24rem;
|
width: 24rem;
|
||||||
@ -730,6 +753,12 @@ td {
|
|||||||
transform: none;
|
transform: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@media screen and (min-width: 1920px) {
|
||||||
|
#home_page, #main_header {
|
||||||
|
grid-template-columns: 1fr 60vw 1fr;
|
||||||
|
grid-template-areas: ". main .";
|
||||||
|
}
|
||||||
|
}
|
||||||
@media (any-hover: hover) {
|
@media (any-hover: hover) {
|
||||||
:root {
|
:root {
|
||||||
scrollbar-width: thin;
|
scrollbar-width: thin;
|
||||||
|
|||||||
2
css/main.min.css
vendored
2
css/main.min.css
vendored
File diff suppressed because one or more lines are too long
@ -182,12 +182,6 @@ sm-popup{
|
|||||||
}
|
}
|
||||||
sm-textarea{
|
sm-textarea{
|
||||||
margin-top: 1rem;
|
margin-top: 1rem;
|
||||||
&::part(textarea){
|
|
||||||
border-radius: 0.4rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
p{
|
|
||||||
margin-block-end: 1rem;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -203,7 +197,7 @@ sm-popup{
|
|||||||
stroke-width: 10;
|
stroke-width: 10;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
sm-button{
|
sm-button, button{
|
||||||
width: auto;
|
width: auto;
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
}
|
}
|
||||||
@ -245,6 +239,7 @@ button {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.flex {
|
.flex {
|
||||||
|
margin-top: 1rem;
|
||||||
sm-button:first-of-type {
|
sm-button:first-of-type {
|
||||||
margin-right: 0.6em;
|
margin-right: 0.6em;
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
@ -280,10 +275,10 @@ button {
|
|||||||
gap: 0.5rem;
|
gap: 0.5rem;
|
||||||
width: auto;
|
width: auto;
|
||||||
h4 {
|
h4 {
|
||||||
|
font-family: 'Roboto', sans-serif;
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon {
|
.icon {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
padding: 0.4rem;
|
padding: 0.4rem;
|
||||||
@ -406,13 +401,9 @@ button {
|
|||||||
border-radius: 2rem;
|
border-radius: 2rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
sm-input::part(input){
|
|
||||||
border-radius: 0.4rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
#sheets_container{
|
#sheets_container{
|
||||||
gap: 2rem 1.5rem;
|
gap: 2rem 1.5rem;
|
||||||
grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr));
|
grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
|
||||||
margin-bottom: 3rem;
|
margin-bottom: 3rem;
|
||||||
animation: slide-up 0.6s forwards cubic-bezier(0.175, 0.885, 0.32, 1.275);
|
animation: slide-up 0.6s forwards cubic-bezier(0.175, 0.885, 0.32, 1.275);
|
||||||
}
|
}
|
||||||
@ -458,7 +449,8 @@ sm-input::part(input){
|
|||||||
transform: scale(0.95);
|
transform: scale(0.95);
|
||||||
}
|
}
|
||||||
.card{
|
.card{
|
||||||
border-radius: 0.8rem;
|
position: relative;
|
||||||
|
border-radius: 0.4rem;
|
||||||
background: url(card-bg2.svg) center, rgba(var(--text-color), 0.06);
|
background: url(card-bg2.svg) center, rgba(var(--text-color), 0.06);
|
||||||
background-size: contain;
|
background-size: contain;
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
@ -474,6 +466,18 @@ sm-input::part(input){
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
max-width: 90%;
|
max-width: 90%;
|
||||||
}
|
}
|
||||||
|
h5{
|
||||||
|
font-family: 'Roboto', sans-serif;
|
||||||
|
background: rgba(var(--text-color), 0.1);
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
margin: 0.5rem 0;
|
||||||
|
padding: 0.4rem 0.6rem;
|
||||||
|
border-radius: .2rem 0 0 .2rem;
|
||||||
|
font-weight: 500;
|
||||||
|
opacity: 0.8;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#sheet_page{
|
#sheet_page{
|
||||||
@ -485,6 +489,14 @@ sm-input::part(input){
|
|||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
opacity: 0.9;
|
opacity: 0.9;
|
||||||
}
|
}
|
||||||
|
#sheet_type{
|
||||||
|
padding: 0.3rem 0.6rem;
|
||||||
|
border-radius: 0.3rem;
|
||||||
|
margin: 0 1rem;
|
||||||
|
font-weight: 500;
|
||||||
|
opacity: 0.8;
|
||||||
|
background: rgba(var(--text-color), 0.1);
|
||||||
|
}
|
||||||
#sheet_description{
|
#sheet_description{
|
||||||
margin-top: 0.8rem;
|
margin-top: 0.8rem;
|
||||||
opacity: 0.8;
|
opacity: 0.8;
|
||||||
@ -524,6 +536,9 @@ sm-input::part(input){
|
|||||||
.flex:first-of-type{
|
.flex:first-of-type{
|
||||||
margin-bottom: 1rem;
|
margin-bottom: 1rem;
|
||||||
}
|
}
|
||||||
|
.flex:nth-of-type(2){
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
}
|
||||||
.flex:not(:first-of-type){
|
.flex:not(:first-of-type){
|
||||||
margin-bottom: 0.3rem;
|
margin-bottom: 0.3rem;
|
||||||
.icon{
|
.icon{
|
||||||
@ -547,7 +562,8 @@ sm-input::part(input){
|
|||||||
opacity: 0.9;
|
opacity: 0.9;
|
||||||
}
|
}
|
||||||
#sheet_description,
|
#sheet_description,
|
||||||
#sheet_editors{
|
#sheet_editors,
|
||||||
|
#sheet_type{
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -574,9 +590,6 @@ table{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
thead{
|
|
||||||
background-color: rgba(var(--text-color), 0.1);
|
|
||||||
}
|
|
||||||
th{
|
th{
|
||||||
position: sticky;
|
position: sticky;
|
||||||
top: 0;
|
top: 0;
|
||||||
@ -683,6 +696,15 @@ td{
|
|||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#user_popup{
|
||||||
|
sm-button{
|
||||||
|
margin-top: 0.5rem;
|
||||||
|
}
|
||||||
|
section:not(:last-of-type){
|
||||||
|
margin-bottom: 1.5rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@media screen and (min-width: 640px){
|
@media screen and (min-width: 640px){
|
||||||
sm-popup::part(popup){
|
sm-popup::part(popup){
|
||||||
width: 24rem;
|
width: 24rem;
|
||||||
@ -718,6 +740,12 @@ td{
|
|||||||
transform: none;
|
transform: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@media screen and (min-width: 1920px){
|
||||||
|
#home_page, #main_header{
|
||||||
|
grid-template-columns: 1fr 60vw 1fr;
|
||||||
|
grid-template-areas: '. main .';
|
||||||
|
}
|
||||||
|
}
|
||||||
@media (any-hover: hover){
|
@media (any-hover: hover){
|
||||||
:root{
|
:root{
|
||||||
scrollbar-width: thin;
|
scrollbar-width: thin;
|
||||||
|
|||||||
153
index.html
153
index.html
@ -47,8 +47,7 @@
|
|||||||
//document.getElementById("loading-screen").classList.remove("hide")
|
//document.getElementById("loading-screen").classList.remove("hide")
|
||||||
//clear Rendered Elements
|
//clear Rendered Elements
|
||||||
/*clearElement(document.getElementById('person-list'))*/
|
/*clearElement(document.getElementById('person-list'))*/
|
||||||
clearElement(document.getElementById('sheets_container'))
|
clearElement(sheetsContainer)
|
||||||
clearElement(document.getElementById('sheet_container'))
|
|
||||||
//set the custom Privkey input
|
//set the custom Privkey input
|
||||||
floDapps.setCustomPrivKeyInput(() => {
|
floDapps.setCustomPrivKeyInput(() => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
@ -155,9 +154,15 @@
|
|||||||
<path d="M.5,47.52V6.5a6,6,0,0,1,6-6h41" />
|
<path d="M.5,47.52V6.5a6,6,0,0,1,6-6h41" />
|
||||||
</svg>
|
</svg>
|
||||||
</div>
|
</div>
|
||||||
|
<sm-button id="sign_out_btn" onclick="signOut()">Sign out</sm-button>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<h4>Theme</h4>
|
||||||
|
<div class="flex align-center space-between">
|
||||||
|
<p>Turn dark theme on/off.</p>
|
||||||
|
<sm-switch id="theme_switcher"></sm-switch>
|
||||||
|
</div>
|
||||||
</section>
|
</section>
|
||||||
<sm-switch id="theme_switcher"></sm-switch>
|
|
||||||
<sm-button id="sign_out_btn" onclick="signOut()">Sign out</sm-button>
|
|
||||||
</sm-popup>
|
</sm-popup>
|
||||||
<sm-popup id="new_sheet_popup">
|
<sm-popup id="new_sheet_popup">
|
||||||
<header class="popup-header" slot="header">
|
<header class="popup-header" slot="header">
|
||||||
@ -169,10 +174,12 @@
|
|||||||
<h4>
|
<h4>
|
||||||
Create new sheet
|
Create new sheet
|
||||||
</h4>
|
</h4>
|
||||||
<sm-button variant="primary">Create</sm-button>
|
<button onclick="createSheet()" class="primary-btn expand" type="submit" disabled>
|
||||||
|
Create
|
||||||
|
</button>
|
||||||
</header>
|
</header>
|
||||||
<sm-input placeholder="Name"></sm-input>
|
<sm-input placeholder="Name" required></sm-input>
|
||||||
<sm-textarea placeholder="Description"></sm-textarea>
|
<sm-textarea placeholder="Description" required></sm-textarea>
|
||||||
</sm-popup>
|
</sm-popup>
|
||||||
<sm-popup id="group_by">
|
<sm-popup id="group_by">
|
||||||
<div>Group Title By</div>
|
<div>Group Title By</div>
|
||||||
@ -183,7 +190,8 @@
|
|||||||
<option value="avg">Avg</option>
|
<option value="avg">Avg</option>
|
||||||
<option value="max">Max</option>
|
<option value="max">Max</option>
|
||||||
<option value="min">Min</option>
|
<option value="min">Min</option>
|
||||||
</select><select></select>
|
</select>
|
||||||
|
<select></select>
|
||||||
</div>
|
</div>
|
||||||
<div class="table-container" id="group_by_view"></div>
|
<div class="table-container" id="group_by_view"></div>
|
||||||
</sm-popup>
|
</sm-popup>
|
||||||
@ -206,7 +214,7 @@
|
|||||||
<section id="main_section">
|
<section id="main_section">
|
||||||
<header class="flex align-center space-between section-header">
|
<header class="flex align-center space-between section-header">
|
||||||
<h4>Sheets</h4>
|
<h4>Sheets</h4>
|
||||||
<sm-input placeholder="Search sheets" type="search"></sm-input>
|
<sm-input id="search_sheets" placeholder="Search sheets" type="search"></sm-input>
|
||||||
</header>
|
</header>
|
||||||
<section id="sheets_container" class="grid"></section>
|
<section id="sheets_container" class="grid"></section>
|
||||||
</section>
|
</section>
|
||||||
@ -234,6 +242,7 @@
|
|||||||
<line y1="45.5" x2="42" y2="45.5"/>
|
<line y1="45.5" x2="42" y2="45.5"/>
|
||||||
</svg>
|
</svg>
|
||||||
<h3 id="sheet_heading"></h3>
|
<h3 id="sheet_heading"></h3>
|
||||||
|
<h5 id="sheet_type"></h5>
|
||||||
<svg id="toggle_details" class="icon justify-right" onclick="toggleDetails()" viewBox="0 0 64 64">
|
<svg id="toggle_details" class="icon justify-right" onclick="toggleDetails()" viewBox="0 0 64 64">
|
||||||
<title>expand/collapse</title>
|
<title>expand/collapse</title>
|
||||||
<polyline points="63.65 15.99 32 47.66 0.35 15.99"/>
|
<polyline points="63.65 15.99 32 47.66 0.35 15.99"/>
|
||||||
@ -242,7 +251,12 @@
|
|||||||
<div id="sheet_editors" class="flex align-center"></div>
|
<div id="sheet_editors" class="flex align-center"></div>
|
||||||
<p id="sheet_description"></p>
|
<p id="sheet_description"></p>
|
||||||
</section>
|
</section>
|
||||||
<div id="sheet_container"></div>
|
<div id="sheet_container">
|
||||||
|
<table>
|
||||||
|
<thead><tr></tr></thead>
|
||||||
|
<tbody></tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
<form id="new-log" style="display: none;" onsubmit="enterLog(event); return false;"></form>
|
<form id="new-log" style="display: none;" onsubmit="enterLog(event); return false;"></form>
|
||||||
<button type="submit" form="new-log" style="display: none;"></button>
|
<button type="submit" form="new-log" style="display: none;"></button>
|
||||||
</section>
|
</section>
|
||||||
@ -501,6 +515,7 @@
|
|||||||
document.addEventListener('input', e => {
|
document.addEventListener('input', e => {
|
||||||
if (e.target.closest('sm-input')) {
|
if (e.target.closest('sm-input')) {
|
||||||
let input = e.target.closest('sm-input')
|
let input = e.target.closest('sm-input')
|
||||||
|
if(!input.closest('sm-popup')) return
|
||||||
formValidation(input)
|
formValidation(input)
|
||||||
if(input.value === '')
|
if(input.value === '')
|
||||||
input.setValidity('')
|
input.setValidity('')
|
||||||
@ -555,13 +570,44 @@
|
|||||||
else if (e.target.closest(".person-card"))
|
else if (e.target.closest(".person-card"))
|
||||||
copyToLogInput(e.target.closest(".person-card").dataset.floId)
|
copyToLogInput(e.target.closest(".person-card").dataset.floId)
|
||||||
else if (e.target.closest("th")){
|
else if (e.target.closest("th")){
|
||||||
sortTable(e.target.cellIndex, e.target.closest('th').classList.contains('descending'))
|
sortTable(e.target.closest("th").cellIndex, e.target.closest('th').classList.contains('descending'))
|
||||||
e.target.closest('th').classList.toggle('descending')
|
e.target.closest('th').classList.toggle('descending')
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
//do nothing
|
//do nothing
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
const observer = new IntersectionObserver((entries, observer) => {
|
||||||
|
entries.forEach(entry => {
|
||||||
|
if(entry.isIntersecting){
|
||||||
|
let {title, description, editors, attributes, sheet, isWriteable, isSubAdmin} = floGlobals.currentSheet
|
||||||
|
renderSheetView(title, description, editors, attributes, sheet, isWriteable, isSubAdmin, true, true)
|
||||||
|
observer.disconnect()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
const watchLastElement = new MutationObserver(mutations => {
|
||||||
|
mutations.forEach(mutation => {
|
||||||
|
if(mutation.addedNodes.length){
|
||||||
|
observer.observe(mutation.addedNodes[mutation.addedNodes.length - 1])
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
watchLastElement.observe(tableBody, {childList: true, subtree: true})
|
||||||
|
|
||||||
|
document.getElementById('search_sheets').addEventListener('input', function() {
|
||||||
|
if(this.value.trim !== ''){
|
||||||
|
for(child of sheetsContainer.children) {
|
||||||
|
if(child.id === 'add_new_sheet') continue
|
||||||
|
if(child.dataset.name.toUpperCase().indexOf(this.value.toUpperCase()) > -1){
|
||||||
|
child.classList.remove('hide-completely')
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
child.classList.add('hide-completely')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
function removeUnderscore(word){
|
function removeUnderscore(word){
|
||||||
@ -570,11 +616,16 @@
|
|||||||
|
|
||||||
const render = {
|
const render = {
|
||||||
sheetCard(sheetName, editors){
|
sheetCard(sheetName, editors){
|
||||||
let card = document.createElement('div')
|
let card = document.createElement('div'),
|
||||||
|
type = 'Public'
|
||||||
card.classList.add('sheet-card')
|
card.classList.add('sheet-card')
|
||||||
card.setAttribute('data-name', sheetName)
|
card.setAttribute('data-name', sheetName)
|
||||||
|
if(editors)
|
||||||
|
type = 'Private'
|
||||||
card.innerHTML = `
|
card.innerHTML = `
|
||||||
<div class="card"></div>
|
<div class="card">
|
||||||
|
<h5>${type}</h5>
|
||||||
|
</div>
|
||||||
<h4>${removeUnderscore(sheetName)}</h4>
|
<h4>${removeUnderscore(sheetName)}</h4>
|
||||||
`
|
`
|
||||||
return card
|
return card
|
||||||
@ -615,7 +666,7 @@
|
|||||||
else
|
else
|
||||||
mainHeader.classList.remove('hide-completely')
|
mainHeader.classList.remove('hide-completely')
|
||||||
if(page === 'home_page')
|
if(page === 'home_page')
|
||||||
sheetContainer.innerHTML = ''
|
tableBody.innerHTML = ''
|
||||||
}
|
}
|
||||||
|
|
||||||
function signOut() {
|
function signOut() {
|
||||||
@ -779,7 +830,7 @@
|
|||||||
allFormElements.forEach(element => element.disabled = false)
|
allFormElements.forEach(element => element.disabled = false)
|
||||||
form.reset();
|
form.reset();
|
||||||
notify('Log entry successful', 'success')
|
notify('Log entry successful', 'success')
|
||||||
let row = sheetContainer.getElementsByTagName("tbody")[0].insertRow(1);
|
let row = tableBody.insertRow(0);
|
||||||
row.insertCell().textContent = floID
|
row.insertCell().textContent = floID
|
||||||
row.insertCell().innerHTML = `<input type="text" class="grade-input" disabled>`
|
row.insertCell().innerHTML = `<input type="text" class="grade-input" disabled>`
|
||||||
log.forEach(l => row.insertCell().textContent = l)
|
log.forEach(l => row.insertCell().textContent = l)
|
||||||
@ -830,8 +881,8 @@
|
|||||||
peopleContainer.append(frag)
|
peopleContainer.append(frag)
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderSheetList(sheetList = {}) {
|
const sheetsContainer = document.getElementById("sheets_container")
|
||||||
let sheetHolder = document.getElementById("sheets_container")
|
function renderSheetList(sheetList) {
|
||||||
for(sheet in sheetList){
|
for(sheet in sheetList){
|
||||||
frag.append(render.sheetCard(sheet, sheetList[sheet].editors))
|
frag.append(render.sheetCard(sheet, sheetList[sheet].editors))
|
||||||
}
|
}
|
||||||
@ -851,7 +902,7 @@
|
|||||||
`
|
`
|
||||||
frag.prepend(firstCard)
|
frag.prepend(firstCard)
|
||||||
}
|
}
|
||||||
sheetHolder.append(frag)
|
sheetsContainer.append(frag)
|
||||||
}
|
}
|
||||||
|
|
||||||
function createTh(text){
|
function createTh(text){
|
||||||
@ -867,12 +918,16 @@
|
|||||||
|
|
||||||
const sheetContainer = document.getElementById('sheet_container'),
|
const sheetContainer = document.getElementById('sheet_container'),
|
||||||
sheetHeading = document.getElementById('sheet_heading'),
|
sheetHeading = document.getElementById('sheet_heading'),
|
||||||
|
sheetType = document.getElementById('sheet_type'),
|
||||||
sheetDescription = document.getElementById('sheet_description'),
|
sheetDescription = document.getElementById('sheet_description'),
|
||||||
sheetEditors = document.getElementById('sheet_editors')
|
sheetEditors = document.getElementById('sheet_editors'),
|
||||||
|
tableHeader = sheetContainer.firstElementChild.firstElementChild,
|
||||||
|
tableBody = sheetContainer.firstElementChild.children[1]
|
||||||
let startingIndex = 0,
|
let startingIndex = 0,
|
||||||
endingIndex = 0
|
endingIndex = 0
|
||||||
|
|
||||||
function renderSheetView(title, description, editors, attributes, sheet, isWriteable, isSubAdmin, onlyRenderTable = false, lazyLoad = false) {
|
function renderSheetView(title, description, editors, attributes, sheet, isWriteable, isSubAdmin, onlyRenderTable = false, lazyLoad = false) {
|
||||||
|
if(!lazyLoad)
|
||||||
floGlobals.currentSheet = {
|
floGlobals.currentSheet = {
|
||||||
title,
|
title,
|
||||||
description,
|
description,
|
||||||
@ -882,14 +937,6 @@
|
|||||||
isWriteable,
|
isWriteable,
|
||||||
isSubAdmin,
|
isSubAdmin,
|
||||||
}
|
}
|
||||||
if(lazyLoad){
|
|
||||||
startingIndex = sheet.length > endingIndex ? endingIndex : sheet.length
|
|
||||||
endingIndex = sheet.length - endingIndex > 20 ? endingIndex + 20 : sheet.length
|
|
||||||
console.log('lazy...')
|
|
||||||
}else{
|
|
||||||
startingIndex = 0
|
|
||||||
endingIndex = sheet.length > 20 ? 20 : sheet.length
|
|
||||||
}
|
|
||||||
const parseVectorClock = (vc) => {
|
const parseVectorClock = (vc) => {
|
||||||
vc = vc.split('_')
|
vc = vc.split('_')
|
||||||
let time = new Date(parseInt(vc[0])).toString().slice(4, 24);
|
let time = new Date(parseInt(vc[0])).toString().slice(4, 24);
|
||||||
@ -917,12 +964,19 @@
|
|||||||
}
|
}
|
||||||
return gradeField
|
return gradeField
|
||||||
}
|
}
|
||||||
|
if(lazyLoad){
|
||||||
|
startingIndex = sheet.length > endingIndex ? endingIndex : sheet.length
|
||||||
|
endingIndex = sheet.length - endingIndex > 20 ? endingIndex + 20 : sheet.length
|
||||||
|
}else{
|
||||||
|
startingIndex = 0
|
||||||
|
endingIndex = sheet.length > 20 ? 20 : sheet.length
|
||||||
|
}
|
||||||
if(!onlyRenderTable){
|
if(!onlyRenderTable){
|
||||||
showPage('sheet_page')
|
showPage('sheet_page')
|
||||||
|
|
||||||
//Add Sheet Details
|
//Add Sheet Details
|
||||||
sheetHeading.textContent = removeUnderscore(title);
|
sheetHeading.textContent = removeUnderscore(title);
|
||||||
if(editors){
|
if(editors){
|
||||||
|
sheetType.textContent = 'Private'
|
||||||
editors.forEach(editor =>{
|
editors.forEach(editor =>{
|
||||||
let card = document.createElement('div')
|
let card = document.createElement('div')
|
||||||
card.className = 'editor'
|
card.className = 'editor'
|
||||||
@ -932,24 +986,27 @@
|
|||||||
sheetEditors.innerHTML = 'Maintained by: '
|
sheetEditors.innerHTML = 'Maintained by: '
|
||||||
sheetEditors.append(frag)
|
sheetEditors.append(frag)
|
||||||
}
|
}
|
||||||
else
|
else{
|
||||||
sheetEditors.textContent = "Public";
|
sheetType.textContent = 'Public'
|
||||||
|
sheetEditors.innerHTML = ''
|
||||||
|
}
|
||||||
sheetDescription.textContent = description;
|
sheetDescription.textContent = description;
|
||||||
|
clearElement(tableHeader)
|
||||||
|
let row = tableHeader.insertRow();
|
||||||
|
row.append(createTh("FLO ID"), createTh("Grade"));
|
||||||
|
attributes.forEach(a => row.append(createTh(a)))
|
||||||
|
//Add input fields if writable
|
||||||
|
if (isWriteable && !lazyLoad) {
|
||||||
|
let row = tableHeader.insertRow();
|
||||||
|
row.insertCell().innerHTML = `<input form="new-log" class="log-input" type="text">`;
|
||||||
|
row.insertCell().textContent = ``;
|
||||||
|
attributes.forEach(a => row.insertCell().innerHTML = `<input form="new-log" class="log-input" type="text">`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
let table
|
|
||||||
if(onlyRenderTable){
|
if(onlyRenderTable){
|
||||||
table = sheetContainer.querySelector('table')
|
if(!lazyLoad)
|
||||||
sheetContainer.querySelector('tbody').remove()
|
tableBody.innerHTML = ''
|
||||||
}
|
}
|
||||||
else{
|
|
||||||
//Create and add the sheet table
|
|
||||||
table = document.createElement("table")
|
|
||||||
let thead = table.createTHead()
|
|
||||||
let head = thead.insertRow(0)
|
|
||||||
head.append(createTh("FLO ID"), createTh("Grade"));
|
|
||||||
attributes.forEach(a => head.append(createTh(a)))
|
|
||||||
}
|
|
||||||
let tbody = document.createElement("tbody")
|
|
||||||
for(let i = startingIndex; i < endingIndex; i++){
|
for(let i = startingIndex; i < endingIndex; i++){
|
||||||
let data = sheet[i]
|
let data = sheet[i]
|
||||||
let row = document.createElement('tr')
|
let row = document.createElement('tr')
|
||||||
@ -959,17 +1016,8 @@
|
|||||||
data.log.forEach(l => row.append(createCell(l)))
|
data.log.forEach(l => row.append(createCell(l)))
|
||||||
frag.append(row)
|
frag.append(row)
|
||||||
}
|
}
|
||||||
tbody.append(frag)
|
tableBody.append(frag)
|
||||||
//Add input fields if writable
|
|
||||||
if (isWriteable) {
|
|
||||||
let row = tbody.insertRow(0);
|
|
||||||
row.insertCell().innerHTML = `<input form="new-log" class="log-input" type="text">`;
|
|
||||||
row.insertCell().textContent = ``;
|
|
||||||
attributes.forEach(a => row.insertCell().innerHTML = `<input form="new-log" class="log-input" type="text">`);
|
|
||||||
}
|
|
||||||
table.appendChild(tbody);
|
|
||||||
if(!onlyRenderTable){
|
if(!onlyRenderTable){
|
||||||
clearElement(sheetContainer).appendChild(table);
|
|
||||||
//Add options for groupBy
|
//Add options for groupBy
|
||||||
document.getElementById('group_by').children[0].textContent = `Group ${title} by`;
|
document.getElementById('group_by').children[0].textContent = `Group ${title} by`;
|
||||||
document.getElementById('group_by_view').innerHTML =
|
document.getElementById('group_by_view').innerHTML =
|
||||||
@ -1056,7 +1104,6 @@
|
|||||||
return b.log[n-2] - a.log[n-2]
|
return b.log[n-2] - a.log[n-2]
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
console.log(floGlobals.currentSheet.sheet[0])
|
|
||||||
let {title, description, editors, attributes, sheet, isWriteable, isSubAdmin} = floGlobals.currentSheet
|
let {title, description, editors, attributes, sheet, isWriteable, isSubAdmin} = floGlobals.currentSheet
|
||||||
renderSheetView(title, description, editors, attributes, sheet, isWriteable, isSubAdmin, true, false)
|
renderSheetView(title, description, editors, attributes, sheet, isWriteable, isSubAdmin, true, false)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user