From 2ea6f1ebaa0329bedaaed384def57327b2f45575 Mon Sep 17 00:00:00 2001 From: sairaj mote Date: Sat, 17 Sep 2022 19:36:03 +0530 Subject: [PATCH] code refactoring and UI/UX improvements --- css/main.css | 26 +++--- css/main.min.css | 2 +- css/main.scss | 28 +++--- index.html | 229 ++++++++++++++++++++--------------------------- 4 files changed, 127 insertions(+), 158 deletions(-) diff --git a/css/main.css b/css/main.css index 6270413..1a70aaf 100644 --- a/css/main.css +++ b/css/main.css @@ -487,6 +487,10 @@ ul { margin-right: auto; } +.margin-top-1 { + margin-top: 1rem; +} + .margin-bottom-0-5 { margin-bottom: 0.5rem; } @@ -906,7 +910,7 @@ ul { } #sheet_description { - margin-top: 0.8rem; + margin-top: 0.5rem; opacity: 0.8; } @@ -941,27 +945,21 @@ ul { #toggle_details { transform: rotateX(180deg); + padding: 0.4rem; + background-color: rgba(var(--text-color), 0.1); } #sheet_details { padding: 1rem; - margin-bottom: 1rem; -} -#sheet_details .flex:first-of-type { - margin-bottom: 1rem; } #sheet_details .flex:nth-of-type(2) { - margin-bottom: 1rem; + padding: 0.5rem 0; } -#sheet_details .flex:not(:first-of-type) { - margin-bottom: 0.3rem; +#sheet_details .flex:nth-of-type(2) button:first-of-type { + margin-left: -0.7rem; } #sheet_details.collapse { padding: 0.5rem 1rem; - margin-bottom: 0; -} -#sheet_details.collapse .flex { - margin-bottom: 0; } #sheet_details.collapse #toggle_details { transform: none; @@ -1063,6 +1061,10 @@ th.ascending::after { #group_by sm-select:last-of-type { margin-left: 0.5rem; } +#group_by th, +#group_by td { + padding: 1rem; +} #side_bar { position: fixed; diff --git a/css/main.min.css b/css/main.min.css index cf2a7ff..5c6f2e5 100644 --- a/css/main.min.css +++ b/css/main.min.css @@ -1 +1 @@ -*{padding:0;margin:0;box-sizing:border-box;font-family:"Roboto",sans-serif}:root{font-size:clamp(1rem,1.2vmax,1.2rem)}html,body{height:100%}body{--accent-color: #3d5afe;--secondary-color: #ffac2e;--text-color: 20, 20, 20;--foreground-color: 252, 253, 255;--background-color: 241, 243, 248;--danger-color: rgb(255, 75, 75);--green: #1cad59;--yellow: rgb(220, 165, 0);color:rgba(var(--text-color), 1);background-color:rgba(var(--background-color), 1);overflow-y:hidden}body[data-theme=dark]{--accent-color: #6d83ff;--secondary-color: #d60739;--text-color: 220, 220, 220;--foreground-color: 27, 28, 29;--background-color: 21, 22, 22;--danger-color: rgb(255, 106, 106);--green: #00e676;--yellow: rgb(255, 213, 5)}body[data-theme=dark] ::-webkit-calendar-picker-indicator{filter:invert(1)}p,strong{font-size:.9rem;max-width:65ch;line-height:1.7;color:rgba(var(--text-color), 0.9)}img{-o-object-fit:cover;object-fit:cover}a:where([class]){color:inherit;text-decoration:none}a:where([class]):focus-visible{box-shadow:0 0 0 .1rem rgba(var(--text-color), 1) inset}a{color:var(--accent-color)}a:-webkit-any-link:focus-visible{outline:rgba(var(--text-color), 1) .1rem solid}a:-moz-any-link:focus-visible{outline:rgba(var(--text-color), 1) .1rem solid}a:any-link:focus-visible{outline:rgba(var(--text-color), 1) .1rem solid}a.button{padding:.4rem .6rem;border-radius:.3rem;font-size:.9rem;font-weight:500;color:inherit}button,.button{-webkit-user-select:none;-moz-user-select:none;user-select:none;position:relative;display:inline-flex;border:none;background-color:rgba(0,0,0,0);overflow:hidden;color:inherit;-webkit-tap-highlight-color:rgba(0,0,0,0);align-items:center;font-size:.9rem;font-weight:500;white-space:nowrap;padding:.8rem;border-radius:.3rem;justify-content:center}button:focus-visible,.button:focus-visible{outline:var(--accent-color) solid medium}button:not(:disabled),.button:not(:disabled){cursor:pointer}.button{background-color:rgba(var(--text-color), 0.1)}.button--primary,.button--danger{color:rgba(var(--background-color), 1) !important}.button--primary .icon,.button--danger .icon{fill:rgba(var(--background-color), 1)}.button--primary{text-transform:capitalize;background-color:var(--accent-color)}.button--danger{background-color:var(--danger-color)}.button--small{padding:.4rem .6rem}.button--outlined{border:solid rgba(var(--text-color), 0.5) .1rem;background-color:rgba(var(--foreground-color), 1)}.button--transparent{background-color:rgba(0,0,0,0)}.cta{text-transform:uppercase;font-size:.8rem;font-weight:700;letter-spacing:.05em;padding:.8rem 1rem}.icon{width:1.2rem;height:1.2rem;fill:rgba(var(--text-color), 0.8);flex-shrink:0}.icon-only{padding:.5rem;border-radius:.3rem;aspect-ratio:1/1}button:disabled{opacity:.5}a:-webkit-any-link:focus-visible{outline:rgba(var(--text-color), 1) .1rem solid}a:-moz-any-link:focus-visible{outline:rgba(var(--text-color), 1) .1rem solid}a:any-link:focus-visible{outline:rgba(var(--text-color), 1) .1rem solid}details summary{display:flex;-webkit-user-select:none;-moz-user-select:none;user-select:none;cursor:pointer;align-items:center;justify-content:space-between;color:var(--accent-color)}details[open] summary{margin-bottom:1rem}details[open]>summary .down-arrow{transform:rotate(180deg)}fieldset{border:none}input{accent-color:var(--accent-color)}input[type=range]:active{cursor:-webkit-grab;cursor:grab}sm-copy{font-size:.9rem}sm-input,sm-textarea{font-size:.9rem;--border-radius: 0.5rem;--background-color: rgba(var(--foreground-color), 1)}sm-input button .icon,sm-textarea button .icon{fill:var(--accent-color)}sm-textarea{--max-height: 32ch}sm-button{--padding: 0.8rem}sm-button[variant=primary] .icon{fill:rgba(var(--background-color), 1)}sm-button[disabled] .icon{fill:rgba(var(--text-color), 0.6)}sm-button.danger{--background: var(--danger-color);color:rgba(var(--background-color), 1)}sm-spinner{--size: 1.5rem;--stroke-width: 0.1rem}sm-form{--gap: 1rem}sm-select{--padding: 0.8rem;font-size:.9rem;--min-width: 8rem;--border-radius: 0.5rem}sm-option{font-size:.9rem;--border-radius: 0.3rem}strip-select{--gap: 0;background-color:rgba(var(--text-color), 0.06);border-radius:.3rem;padding:.3rem}strip-option{position:relative;font-size:.8rem;--border-radius: 0.2rem;-webkit-user-select:none;-moz-user-select:none;user-select:none}sm-button{--border-radius: 0.3rem}sm-button[variant=primary] .icon{fill:rgba(var(--background-color), 1)}sm-button[disabled] .icon{fill:rgba(var(--text-color), 0.6)}sm-select[open]{z-index:10}ul{list-style:none}.overflow-ellipsis{width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.wrap-around{overflow-wrap:break-word;word-wrap:break-word;word-break:break-word;-webkit-hyphens:auto;hyphens:auto}.full-bleed{grid-column:1/-1}.uppercase{text-transform:uppercase}.capitalize{text-transform:capitalize}.sticky{position:-webkit-sticky;position:sticky}.top-0{top:0}.flex{display:flex}.flex-wrap{flex-wrap:wrap}.flex-1{flex:1}.grid{display:grid}.flow-column{grid-auto-flow:column}.gap-0-3{gap:.3rem}.gap-0-5{gap:.5rem}.gap-1{gap:1rem}.gap-1-5{gap:1.5rem}.gap-2{gap:2rem}.gap-3{gap:3rem}.text-align-right{text-align:right}.text-align-left{text-align:left}.align-items-start{align-items:flex-start}.align-content-start{align-content:flex-start}.align-start{align-content:flex-start}.align-center{align-items:center}.align-end{align-items:flex-end}.text-center{text-align:center}.justify-start{justify-items:start}.justify-content-start{justify-content:start}.justify-center{justify-content:center}.justify-right{margin-left:auto}.align-self-start{align-self:start}.align-self-center{align-self:center}.align-self-end{align-self:end}.justify-self-center{justify-self:center}.justify-self-start{justify-self:start}.justify-self-end{justify-self:end}.flex-direction-column{flex-direction:column}.space-between{justify-content:space-between}.w-100{width:100%}.h-100{height:100%}.margin-right-0-3{margin-right:.3rem}.margin-right-0-5{margin-right:.5rem}.margin-left-0-5{margin-left:.5rem}.margin-left-auto{margin-left:auto}.margin-right-auto{margin-right:auto}.margin-bottom-0-5{margin-bottom:.5rem}.margin-bottom-1{margin-bottom:1rem}.margin-bottom-2{margin-bottom:2rem}.margin-block-0-5{margin-block:.5rem}.margin-block-1{margin-block:1rem}.margin-block-1-5{margin-block:1.5rem}.margin-inline-1{margin-inline:1rem}.margin-inline-1-5{margin-inline:1.5rem}.hidden{display:none !important}.no-transformations{transform:none !important}.full-bleed{grid-column:1/4}.h1{font-size:2.5rem}.h2{font-size:2rem}.h3{font-size:1.4rem}.h4{font-size:1rem}.h5{font-size:.8rem}.grid-3{grid-template-columns:1fr auto auto}.flow-column{grid-auto-flow:column}.w-100{width:100%}.color-0-8{color:rgba(var(--text-color), 0.8)}.weight-400{font-weight:400}.weight-500{font-weight:500}.card{background-color:rgba(var(--text-color), 0.06);border-radius:.5rem;padding:max(1rem,3vw)}.ripple{height:8rem;width:8rem;position:absolute;border-radius:50%;transform:scale(0);background:radial-gradient(circle, rgba(var(--text-color), 0.3) 0%, rgba(0, 0, 0, 0) 50%);pointer-events:none}.interactive{position:relative;overflow:hidden;cursor:pointer;-webkit-tap-highlight-color:rgba(0,0,0,0)}.observe-empty-state:empty{display:none}.observe-empty-state:not(:empty)~.empty-state{display:none}.button__icon{height:1.2rem;width:1.2rem}.button__icon--left{margin-right:.5rem}.button__icon--right{margin-left:.5rem}[data-editable]{transition:padding .2s}[data-editable]:focus-within{padding:.5em;border-radius:.3rem;outline:none;background-color:rgba(var(--text-color), 0.06);box-shadow:0 0 0 .1rem var(--accent-color) inset}.multi-state-button{display:grid;text-align:center;align-items:center}.multi-state-button>*{grid-area:1/1/2/2}.multi-state-button button{z-index:1}#confirmation_popup,#prompt_popup{flex-direction:column}#confirmation_popup h4,#prompt_popup h4{font-weight:500;margin-bottom:.5rem}#confirmation_popup sm-button,#prompt_popup sm-button{margin:0}#confirmation_popup .flex,#prompt_popup .flex{padding:0;margin-top:1rem}#confirmation_popup .flex sm-button:first-of-type,#prompt_popup .flex sm-button:first-of-type{margin-right:.6rem;margin-left:auto}.popup__header{display:grid;gap:.5rem;width:100%;padding:0 1.5rem 0 .5rem;align-items:center;grid-template-columns:auto 1fr auto}.popup__header__close{padding:.5rem;cursor:pointer}#sign_in_page{background:url(sign-in-bg.svg) no-repeat center,linear-gradient(rgba(var(--text-color), 0.04), rgba(var(--text-color), 0.04)),linear-gradient(rgba(var(--foreground-color), 1), rgba(var(--foreground-color), 1));background-size:cover;min-height:100vh;width:100vw;align-items:center;padding:0 6vw}#sign_in_page .info h1{font-weight:800;font-size:clamp(1.5rem,8vw,4rem)}#sign_in_page .info h4{font-weight:500;opacity:.8}#sign_in_page .sign-in-box{width:calc(100vw - 4rem);z-index:1}#sign_in_page .sign-in-box sm-input{text-align:left}#sign_in_page .sign-in-box h2{margin-bottom:.5rem}#sign_in_page .sign-in-box h3{font-weight:500}#sign_in_page .sign-in-box h4{font-weight:500;margin-bottom:1.5rem}#sign_in_page .sign-in-box h5{opacity:.8;font-weight:500}#sign_in_page .sign-in-box p{margin-bottom:.5rem;max-width:35ch;margin-top:.5rem;margin-bottom:1.5rem}#sign_in_page .sign-in-box #credentials_section{border-top:1px rgba(var(--text-color), 0.2) solid;margin-top:1rem;padding-top:1.5rem;-webkit-animation:slide-down .3s forwards;animation:slide-down .3s forwards}@-webkit-keyframes slide-down{from{transform:translateY(-1rem)}to{transform:none}}@keyframes slide-down{from{transform:translateY(-1rem)}to{transform:none}}#main_loader{text-align:center;place-content:center;justify-items:center;height:100vh;width:100vw;position:fixed;left:0;gap:1rem}#main_loader sm-button{margin-left:0;margin-top:1rem;width:-webkit-max-content;width:-moz-max-content;width:max-content;justify-self:center}#main_loader h3{width:100%;font-weight:400;word-spacing:.16em}#main_header{padding:1rem;box-shadow:0 .1rem .2rem rgba(0,0,0,.062745098);background:rgba(var(--foreground-color), 1)}#main_header h5{font-weight:500;opacity:.8}#main_header h4{font-size:1.2rem}#home_page{padding:1rem}.section-header{position:-webkit-sticky;position:sticky;top:0;z-index:1;background:var(--dark-shade);margin-bottom:1rem}.section-header h4{font-size:1.2rem;opacity:.8;font-weight:500}#main_section>header sm-input{margin-left:1rem}#user_icon{width:2.4rem;height:2.4rem;padding:.6rem;border-radius:2rem}#sheets_container{display:grid;grid-template-columns:repeat(auto-fill, minmax(20rem, 1fr));gap:.5rem;margin-bottom:3rem;-webkit-animation:slide-up .6s forwards cubic-bezier(0.175, 0.885, 0.32, 1.275);animation:slide-up .6s forwards cubic-bezier(0.175, 0.885, 0.32, 1.275)}@-webkit-keyframes slide-up{from{transform:translateY(2rem)}to{transform:none}}@keyframes slide-up{from{transform:translateY(2rem)}to{transform:none}}#add_new_sheet .sheet-card__icon{display:flex;align-items:center;justify-content:center;position:relative;background:url(card-bg1.svg),#a7003e;background-size:cover}#add_new_sheet .icon{fill:rgba(var(--foreground-color), 1)}.sheet-card{position:relative;display:grid;color:inherit;grid-template-columns:auto 1fr auto;align-items:center;background-color:rgba(var(--foreground-color), 1);padding:1rem;border-radius:.5rem;transition:.2s;border:solid thin rgba(var(--text-color), 0.1)}.sheet-card__icon{display:flex;padding:.6rem;border-radius:2rem;background:rgba(var(--text-color), 0.06);margin-right:1rem}.sheet-card h4{opacity:.9;font-size:1rem}.sheet-card__type{font-size:.8rem;background:rgba(var(--text-color), 0.1);padding:.3rem .6rem;border-radius:1rem}#sheet_view{width:100vw;height:100vh;overflow-x:hidden}#sheet_view.toggle-side-bar #side_bar{transition:transform .3s;z-index:10;transform:none}#sheet_heading{font-weight:600;opacity:.9}#sheet_type{padding:.3rem .6rem;border-radius:.3rem;margin:0 1rem;font-weight:500;opacity:.8;background:rgba(var(--text-color), 0.1)}#sheet_description{margin-top:.8rem;opacity:.8}#sheet_editors{gap:.5rem;color:rgba(var(--text-color), 0.7);font-size:.9rem}#sheet_editors .editor{padding:.4rem .6rem;border-radius:.4rem;background:rgba(var(--text-color), 0.06)}#go_to_home{height:2.4rem;width:2.4rem;padding:.7rem;cursor:pointer}#go_to_home,#go_to_home+h5{transform:translateX(-1rem);cursor:pointer}#go_to_home+h5{font-weight:500;opacity:.9}#toggle_details{transform:rotateX(180deg)}#sheet_details{padding:1rem;margin-bottom:1rem}#sheet_details .flex:first-of-type{margin-bottom:1rem}#sheet_details .flex:nth-of-type(2){margin-bottom:1rem}#sheet_details .flex:not(:first-of-type){margin-bottom:.3rem}#sheet_details.collapse{padding:.5rem 1rem;margin-bottom:0}#sheet_details.collapse .flex{margin-bottom:0}#sheet_details.collapse #toggle_details{transform:none}#sheet_details.collapse #sheet_heading{font-size:1.2rem;font-weight:600;opacity:.9}#sheet_details.collapse #sheet_description,#sheet_details.collapse #sheet_editors,#sheet_details.collapse #sheet_type{display:none}#sheet_container{position:relative;overflow:auto;max-height:100%;bottom:0;max-width:100%}table{border-collapse:collapse;position:relative;width:100%}table input{position:relative;padding:.4rem;border:thin solid rgba(var(--text-color), 0.3);font-size:1rem;width:100%;border-radius:.3rem;background:rgba(var(--text-color), 0.06);color:inherit}table input:disabled{border:rgba(0,0,0,0)}th{position:-webkit-sticky;position:sticky;top:0;background:linear-gradient(rgba(var(--text-color), 0.06), rgba(var(--text-color), 0.06)),rgba(var(--foreground-color), 1);text-align:left;line-height:1;vertical-align:middle;font-weight:500;z-index:1;padding:1rem .8rem;white-space:nowrap;cursor:pointer}tr:nth-of-type(2n){background-color:rgba(var(--text-color), 0.04)}td{padding:.4rem .8rem;opacity:.9}td:nth-of-type(n + 3){min-width:12em}.text-field{min-width:20ch;max-width:30ch}.grade-input{width:10ch}th.descending::after,th.ascending::after{display:inline-flex;justify-self:flex-end;position:relative;margin-left:auto;font-size:.8rem}th.descending::after{content:" ▼"}th.ascending::after{content:" ▲"}#group_by::part(popup){min-height:80vh}#group_by sm-select:last-of-type{margin-left:.5rem}#side_bar{position:fixed;transform:translateX(-100%);background:rgba(var(--background-color), 1);bottom:0;top:0;left:0;right:0;width:100%}#side_bar>.flex:first-of-type{padding:.5rem 1rem}#side_bar .section-header{margin-bottom:0;background:inherit}#right{position:relative;display:flex;flex-direction:column;overflow:auto;max-height:100vh;background:rgba(var(--foreground-color), 1);-webkit-animation:slide-right .6s forwards cubic-bezier(0.175, 0.885, 0.32, 1.275);animation:slide-right .6s forwards cubic-bezier(0.175, 0.885, 0.32, 1.275)}@-webkit-keyframes slide-right{from{transform:translateX(-2rem)}to{transform:translateX(0)}}@keyframes slide-right{from{transform:translateX(-2rem)}to{transform:translateX(0)}}.placeholder{-webkit-animation:placeholder-loading .6s infinite alternate;animation:placeholder-loading .6s infinite alternate;padding:1.5rem 0;width:100%;margin:1.5rem;border-radius:.5rem;background:rgba(var(--text-color), 0.06)}.placeholder#sheet_container{width:calc(100% - 3rem);height:calc(100% - 3rem)}@-webkit-keyframes placeholder-loading{from{opacity:.4}to{opacity:1}}@keyframes placeholder-loading{from{opacity:.4}to{opacity:1}}#people_container{overflow:auto;max-height:calc(100vh - 3.6rem);gap:1.5rem}.person-card{display:grid;align-items:center;grid-template-columns:auto 1fr;grid-template-areas:"initials ." "initials .";cursor:pointer;padding:0 1rem;transition:transform .3s;-webkit-tap-highlight-color:rgba(0,0,0,0)}.person-card:first-of-type{margin-top:1.5rem}.person-card:last-of-type{margin-bottom:2rem}.person-initials{grid-area:initials;display:flex;justify-content:center;height:2.6rem;width:2.6rem;font-size:1.2rem !important;font-weight:500;align-items:center;border-radius:2rem;margin-right:1rem;text-transform:uppercase;opacity:1 !important;color:var(--accent-color);background:rgba(var(--text-color), 0.06)}.person-name{font-size:.9rem;opacity:.9;font-weight:500;text-transform:capitalize}.person-flo-id{opacity:.7;font-weight:400}#user_popup sm-button{margin-top:.5rem}#user_popup section:not(:last-of-type){margin-bottom:1.5rem}#editors_container,#columns_container,#additional_fields{gap:.4rem}#specify_editors{border-top:solid 1px rgba(var(--text-color), 0.2);padding-top:1rem}#add_editor sm-input,#add_column sm-input,#add_detail sm-input{width:100%}#add_detail{gap:.2rem;grid-template-columns:1fr auto;grid-template-areas:". add" ". add"}#add_detail button{grid-area:add;align-self:flex-end}.editor-card,.column-card,.details-card{border-radius:.3rem;background:rgba(var(--text-color), 0.06)}.editor-card .editor-address,.column-card .editor-address,.details-card .editor-address{font-size:.9rem;font-weight:400;opacity:.8}.editor-card{padding:.4rem .8rem}.column-card{padding:.4rem .6rem}.column-card h5{font-weight:500}.column-card .icon{margin-left:.4rem}.details-card{gap:.2rem;padding:.6rem .8rem;grid-template-columns:1fr auto;grid-template-areas:". close" ". close"}.details-card h4,.details-card h5{margin:0 !important}.details-card h5{font-weight:400;opacity:.8}.details-card h4{font-size:1rem !important}.details-card button{grid-area:close}#save_button{position:fixed;overflow:hidden;bottom:0;left:0;right:0;width:min(100% - 2rem,24rem);padding:1rem;margin:1rem;border-radius:.5rem;border:solid thin rgba(var(--text-color), 0.1);background:rgba(var(--foreground-color), 1);z-index:20;box-shadow:0 1rem 2rem rgba(0,0,0,.16)}#save_button #changes_indicator{position:absolute;left:0;width:.3rem;border-radius:0 .5rem .5rem 0;height:2em;background:red}#save_button sm-button{margin-left:1rem}@media screen and (max-width: 640px){#group_by_view{overflow:auto;max-width:calc(100vw - 3rem)}}@media screen and (min-width: 640px){.hide-on-desktop{display:none}sm-popup{--width: 24rem}.popup__header{padding:1.5rem 1.5rem 0 .75rem}#sign_in_page{grid-auto-flow:column}#sign_in_page .sign-in-box{width:26rem;padding:2rem;min-height:80vh;min-width:26rem;border-radius:.5rem;box-shadow:0 0 .3rem rgba(0,0,0,.0862745098),0 6rem 2rem -2rem rgba(0,0,0,.0862745098);background:rgba(var(--foreground-color), 1)}#main_header{padding:1.2rem 3rem}#home_page,#main_header{grid-template-columns:1fr 80vw 1fr;grid-template-areas:". main ."}#main_section,#main_header>div{grid-area:main}#sheet_view.toggle-side-bar{grid-template-columns:19rem 1fr}#sheet_view.toggle-side-bar #side_bar{z-index:initial}#sheet_view:not(.toggle-side-bar) #side_bar{grid-template-columns:1fr;position:fixed;transform:translateX(-100%)}#side_bar{position:relative;transform:none}#group_by::part(popup){width:80vw}#save_button{margin:1rem auto}}@media screen and (min-width: 1920px){#home_page,#main_header{grid-template-columns:1fr 60vw 1fr;grid-template-areas:". main ."}}@media(any-hover: hover){:root{scrollbar-width:thin}::-webkit-scrollbar{width:.7rem;height:.7rem}::-webkit-scrollbar-track{border-radius:10px}::-webkit-scrollbar-thumb{border-radius:10px;background:rgba(var(--text-color), 0.2)}::-webkit-scrollbar-thumb:hover{background:rgba(var(--text-color), 0.4)}#people_container::-webkit-scrollbar{width:.4rem}#right{z-index:1;box-shadow:-0.5rem 0 .5rem rgba(0,0,0,.062745098)}.sheet-card:hover{transform:scale(1.02);box-shadow:0 .5rem 1rem rgba(0,0,0,.1);z-index:1}}.hidden{display:none} \ No newline at end of file +*{padding:0;margin:0;box-sizing:border-box;font-family:"Roboto",sans-serif}:root{font-size:clamp(1rem,1.2vmax,1.2rem)}html,body{height:100%}body{--accent-color: #3d5afe;--secondary-color: #ffac2e;--text-color: 20, 20, 20;--foreground-color: 252, 253, 255;--background-color: 241, 243, 248;--danger-color: rgb(255, 75, 75);--green: #1cad59;--yellow: rgb(220, 165, 0);color:rgba(var(--text-color), 1);background-color:rgba(var(--background-color), 1);overflow-y:hidden}body[data-theme=dark]{--accent-color: #6d83ff;--secondary-color: #d60739;--text-color: 220, 220, 220;--foreground-color: 27, 28, 29;--background-color: 21, 22, 22;--danger-color: rgb(255, 106, 106);--green: #00e676;--yellow: rgb(255, 213, 5)}body[data-theme=dark] ::-webkit-calendar-picker-indicator{filter:invert(1)}p,strong{font-size:.9rem;max-width:65ch;line-height:1.7;color:rgba(var(--text-color), 0.9)}img{-o-object-fit:cover;object-fit:cover}a:where([class]){color:inherit;text-decoration:none}a:where([class]):focus-visible{box-shadow:0 0 0 .1rem rgba(var(--text-color), 1) inset}a{color:var(--accent-color)}a:-webkit-any-link:focus-visible{outline:rgba(var(--text-color), 1) .1rem solid}a:-moz-any-link:focus-visible{outline:rgba(var(--text-color), 1) .1rem solid}a:any-link:focus-visible{outline:rgba(var(--text-color), 1) .1rem solid}a.button{padding:.4rem .6rem;border-radius:.3rem;font-size:.9rem;font-weight:500;color:inherit}button,.button{-webkit-user-select:none;-moz-user-select:none;user-select:none;position:relative;display:inline-flex;border:none;background-color:rgba(0,0,0,0);overflow:hidden;color:inherit;-webkit-tap-highlight-color:rgba(0,0,0,0);align-items:center;font-size:.9rem;font-weight:500;white-space:nowrap;padding:.8rem;border-radius:.3rem;justify-content:center}button:focus-visible,.button:focus-visible{outline:var(--accent-color) solid medium}button:not(:disabled),.button:not(:disabled){cursor:pointer}.button{background-color:rgba(var(--text-color), 0.1)}.button--primary,.button--danger{color:rgba(var(--background-color), 1) !important}.button--primary .icon,.button--danger .icon{fill:rgba(var(--background-color), 1)}.button--primary{text-transform:capitalize;background-color:var(--accent-color)}.button--danger{background-color:var(--danger-color)}.button--small{padding:.4rem .6rem}.button--outlined{border:solid rgba(var(--text-color), 0.5) .1rem;background-color:rgba(var(--foreground-color), 1)}.button--transparent{background-color:rgba(0,0,0,0)}.cta{text-transform:uppercase;font-size:.8rem;font-weight:700;letter-spacing:.05em;padding:.8rem 1rem}.icon{width:1.2rem;height:1.2rem;fill:rgba(var(--text-color), 0.8);flex-shrink:0}.icon-only{padding:.5rem;border-radius:.3rem;aspect-ratio:1/1}button:disabled{opacity:.5}a:-webkit-any-link:focus-visible{outline:rgba(var(--text-color), 1) .1rem solid}a:-moz-any-link:focus-visible{outline:rgba(var(--text-color), 1) .1rem solid}a:any-link:focus-visible{outline:rgba(var(--text-color), 1) .1rem solid}details summary{display:flex;-webkit-user-select:none;-moz-user-select:none;user-select:none;cursor:pointer;align-items:center;justify-content:space-between;color:var(--accent-color)}details[open] summary{margin-bottom:1rem}details[open]>summary .down-arrow{transform:rotate(180deg)}fieldset{border:none}input{accent-color:var(--accent-color)}input[type=range]:active{cursor:-webkit-grab;cursor:grab}sm-copy{font-size:.9rem}sm-input,sm-textarea{font-size:.9rem;--border-radius: 0.5rem;--background-color: rgba(var(--foreground-color), 1)}sm-input button .icon,sm-textarea button .icon{fill:var(--accent-color)}sm-textarea{--max-height: 32ch}sm-button{--padding: 0.8rem}sm-button[variant=primary] .icon{fill:rgba(var(--background-color), 1)}sm-button[disabled] .icon{fill:rgba(var(--text-color), 0.6)}sm-button.danger{--background: var(--danger-color);color:rgba(var(--background-color), 1)}sm-spinner{--size: 1.5rem;--stroke-width: 0.1rem}sm-form{--gap: 1rem}sm-select{--padding: 0.8rem;font-size:.9rem;--min-width: 8rem;--border-radius: 0.5rem}sm-option{font-size:.9rem;--border-radius: 0.3rem}strip-select{--gap: 0;background-color:rgba(var(--text-color), 0.06);border-radius:.3rem;padding:.3rem}strip-option{position:relative;font-size:.8rem;--border-radius: 0.2rem;-webkit-user-select:none;-moz-user-select:none;user-select:none}sm-button{--border-radius: 0.3rem}sm-button[variant=primary] .icon{fill:rgba(var(--background-color), 1)}sm-button[disabled] .icon{fill:rgba(var(--text-color), 0.6)}sm-select[open]{z-index:10}ul{list-style:none}.overflow-ellipsis{width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.wrap-around{overflow-wrap:break-word;word-wrap:break-word;word-break:break-word;-webkit-hyphens:auto;hyphens:auto}.full-bleed{grid-column:1/-1}.uppercase{text-transform:uppercase}.capitalize{text-transform:capitalize}.sticky{position:-webkit-sticky;position:sticky}.top-0{top:0}.flex{display:flex}.flex-wrap{flex-wrap:wrap}.flex-1{flex:1}.grid{display:grid}.flow-column{grid-auto-flow:column}.gap-0-3{gap:.3rem}.gap-0-5{gap:.5rem}.gap-1{gap:1rem}.gap-1-5{gap:1.5rem}.gap-2{gap:2rem}.gap-3{gap:3rem}.text-align-right{text-align:right}.text-align-left{text-align:left}.align-items-start{align-items:flex-start}.align-content-start{align-content:flex-start}.align-start{align-content:flex-start}.align-center{align-items:center}.align-end{align-items:flex-end}.text-center{text-align:center}.justify-start{justify-items:start}.justify-content-start{justify-content:start}.justify-center{justify-content:center}.justify-right{margin-left:auto}.align-self-start{align-self:start}.align-self-center{align-self:center}.align-self-end{align-self:end}.justify-self-center{justify-self:center}.justify-self-start{justify-self:start}.justify-self-end{justify-self:end}.flex-direction-column{flex-direction:column}.space-between{justify-content:space-between}.w-100{width:100%}.h-100{height:100%}.margin-right-0-3{margin-right:.3rem}.margin-right-0-5{margin-right:.5rem}.margin-left-0-5{margin-left:.5rem}.margin-left-auto{margin-left:auto}.margin-right-auto{margin-right:auto}.margin-top-1{margin-top:1rem}.margin-bottom-0-5{margin-bottom:.5rem}.margin-bottom-1{margin-bottom:1rem}.margin-bottom-2{margin-bottom:2rem}.margin-block-0-5{margin-block:.5rem}.margin-block-1{margin-block:1rem}.margin-block-1-5{margin-block:1.5rem}.margin-inline-1{margin-inline:1rem}.margin-inline-1-5{margin-inline:1.5rem}.hidden{display:none !important}.no-transformations{transform:none !important}.full-bleed{grid-column:1/4}.h1{font-size:2.5rem}.h2{font-size:2rem}.h3{font-size:1.4rem}.h4{font-size:1rem}.h5{font-size:.8rem}.grid-3{grid-template-columns:1fr auto auto}.flow-column{grid-auto-flow:column}.w-100{width:100%}.color-0-8{color:rgba(var(--text-color), 0.8)}.weight-400{font-weight:400}.weight-500{font-weight:500}.card{background-color:rgba(var(--text-color), 0.06);border-radius:.5rem;padding:max(1rem,3vw)}.ripple{height:8rem;width:8rem;position:absolute;border-radius:50%;transform:scale(0);background:radial-gradient(circle, rgba(var(--text-color), 0.3) 0%, rgba(0, 0, 0, 0) 50%);pointer-events:none}.interactive{position:relative;overflow:hidden;cursor:pointer;-webkit-tap-highlight-color:rgba(0,0,0,0)}.observe-empty-state:empty{display:none}.observe-empty-state:not(:empty)~.empty-state{display:none}.button__icon{height:1.2rem;width:1.2rem}.button__icon--left{margin-right:.5rem}.button__icon--right{margin-left:.5rem}[data-editable]{transition:padding .2s}[data-editable]:focus-within{padding:.5em;border-radius:.3rem;outline:none;background-color:rgba(var(--text-color), 0.06);box-shadow:0 0 0 .1rem var(--accent-color) inset}.multi-state-button{display:grid;text-align:center;align-items:center}.multi-state-button>*{grid-area:1/1/2/2}.multi-state-button button{z-index:1}#confirmation_popup,#prompt_popup{flex-direction:column}#confirmation_popup h4,#prompt_popup h4{font-weight:500;margin-bottom:.5rem}#confirmation_popup sm-button,#prompt_popup sm-button{margin:0}#confirmation_popup .flex,#prompt_popup .flex{padding:0;margin-top:1rem}#confirmation_popup .flex sm-button:first-of-type,#prompt_popup .flex sm-button:first-of-type{margin-right:.6rem;margin-left:auto}.popup__header{display:grid;gap:.5rem;width:100%;padding:0 1.5rem 0 .5rem;align-items:center;grid-template-columns:auto 1fr auto}.popup__header__close{padding:.5rem;cursor:pointer}#sign_in_page{background:url(sign-in-bg.svg) no-repeat center,linear-gradient(rgba(var(--text-color), 0.04), rgba(var(--text-color), 0.04)),linear-gradient(rgba(var(--foreground-color), 1), rgba(var(--foreground-color), 1));background-size:cover;min-height:100vh;width:100vw;align-items:center;padding:0 6vw}#sign_in_page .info h1{font-weight:800;font-size:clamp(1.5rem,8vw,4rem)}#sign_in_page .info h4{font-weight:500;opacity:.8}#sign_in_page .sign-in-box{width:calc(100vw - 4rem);z-index:1}#sign_in_page .sign-in-box sm-input{text-align:left}#sign_in_page .sign-in-box h2{margin-bottom:.5rem}#sign_in_page .sign-in-box h3{font-weight:500}#sign_in_page .sign-in-box h4{font-weight:500;margin-bottom:1.5rem}#sign_in_page .sign-in-box h5{opacity:.8;font-weight:500}#sign_in_page .sign-in-box p{margin-bottom:.5rem;max-width:35ch;margin-top:.5rem;margin-bottom:1.5rem}#sign_in_page .sign-in-box #credentials_section{border-top:1px rgba(var(--text-color), 0.2) solid;margin-top:1rem;padding-top:1.5rem;-webkit-animation:slide-down .3s forwards;animation:slide-down .3s forwards}@-webkit-keyframes slide-down{from{transform:translateY(-1rem)}to{transform:none}}@keyframes slide-down{from{transform:translateY(-1rem)}to{transform:none}}#main_loader{text-align:center;place-content:center;justify-items:center;height:100vh;width:100vw;position:fixed;left:0;gap:1rem}#main_loader sm-button{margin-left:0;margin-top:1rem;width:-webkit-max-content;width:-moz-max-content;width:max-content;justify-self:center}#main_loader h3{width:100%;font-weight:400;word-spacing:.16em}#main_header{padding:1rem;box-shadow:0 .1rem .2rem rgba(0,0,0,.062745098);background:rgba(var(--foreground-color), 1)}#main_header h5{font-weight:500;opacity:.8}#main_header h4{font-size:1.2rem}#home_page{padding:1rem}.section-header{position:-webkit-sticky;position:sticky;top:0;z-index:1;background:var(--dark-shade);margin-bottom:1rem}.section-header h4{font-size:1.2rem;opacity:.8;font-weight:500}#main_section>header sm-input{margin-left:1rem}#user_icon{width:2.4rem;height:2.4rem;padding:.6rem;border-radius:2rem}#sheets_container{display:grid;grid-template-columns:repeat(auto-fill, minmax(20rem, 1fr));gap:.5rem;margin-bottom:3rem;-webkit-animation:slide-up .6s forwards cubic-bezier(0.175, 0.885, 0.32, 1.275);animation:slide-up .6s forwards cubic-bezier(0.175, 0.885, 0.32, 1.275)}@-webkit-keyframes slide-up{from{transform:translateY(2rem)}to{transform:none}}@keyframes slide-up{from{transform:translateY(2rem)}to{transform:none}}#add_new_sheet .sheet-card__icon{display:flex;align-items:center;justify-content:center;position:relative;background:url(card-bg1.svg),#a7003e;background-size:cover}#add_new_sheet .icon{fill:rgba(var(--foreground-color), 1)}.sheet-card{position:relative;display:grid;color:inherit;grid-template-columns:auto 1fr auto;align-items:center;background-color:rgba(var(--foreground-color), 1);padding:1rem;border-radius:.5rem;transition:.2s;border:solid thin rgba(var(--text-color), 0.1)}.sheet-card__icon{display:flex;padding:.6rem;border-radius:2rem;background:rgba(var(--text-color), 0.06);margin-right:1rem}.sheet-card h4{opacity:.9;font-size:1rem}.sheet-card__type{font-size:.8rem;background:rgba(var(--text-color), 0.1);padding:.3rem .6rem;border-radius:1rem}#sheet_view{width:100vw;height:100vh;overflow-x:hidden}#sheet_view.toggle-side-bar #side_bar{transition:transform .3s;z-index:10;transform:none}#sheet_heading{font-weight:600;opacity:.9}#sheet_type{padding:.3rem .6rem;border-radius:.3rem;margin:0 1rem;font-weight:500;opacity:.8;background:rgba(var(--text-color), 0.1)}#sheet_description{margin-top:.5rem;opacity:.8}#sheet_editors{gap:.5rem;color:rgba(var(--text-color), 0.7);font-size:.9rem}#sheet_editors .editor{padding:.4rem .6rem;border-radius:.4rem;background:rgba(var(--text-color), 0.06)}#go_to_home{height:2.4rem;width:2.4rem;padding:.7rem;cursor:pointer}#go_to_home,#go_to_home+h5{transform:translateX(-1rem);cursor:pointer}#go_to_home+h5{font-weight:500;opacity:.9}#toggle_details{transform:rotateX(180deg);padding:.4rem;background-color:rgba(var(--text-color), 0.1)}#sheet_details{padding:1rem}#sheet_details .flex:nth-of-type(2){padding:.5rem 0}#sheet_details .flex:nth-of-type(2) button:first-of-type{margin-left:-0.7rem}#sheet_details.collapse{padding:.5rem 1rem}#sheet_details.collapse #toggle_details{transform:none}#sheet_details.collapse #sheet_heading{font-size:1.2rem;font-weight:600;opacity:.9}#sheet_details.collapse #sheet_description,#sheet_details.collapse #sheet_editors,#sheet_details.collapse #sheet_type{display:none}#sheet_container{position:relative;overflow:auto;max-height:100%;bottom:0;max-width:100%}table{border-collapse:collapse;position:relative;width:100%}table input{position:relative;padding:.4rem;border:thin solid rgba(var(--text-color), 0.3);font-size:1rem;width:100%;border-radius:.3rem;background:rgba(var(--text-color), 0.06);color:inherit}table input:disabled{border:rgba(0,0,0,0)}th{position:-webkit-sticky;position:sticky;top:0;background:linear-gradient(rgba(var(--text-color), 0.06), rgba(var(--text-color), 0.06)),rgba(var(--foreground-color), 1);text-align:left;line-height:1;vertical-align:middle;font-weight:500;z-index:1;padding:1rem .8rem;white-space:nowrap;cursor:pointer}tr:nth-of-type(2n){background-color:rgba(var(--text-color), 0.04)}td{padding:.4rem .8rem;opacity:.9}td:nth-of-type(n + 3){min-width:12em}.text-field{min-width:20ch;max-width:30ch}.grade-input{width:10ch}th.descending::after,th.ascending::after{display:inline-flex;justify-self:flex-end;position:relative;margin-left:auto;font-size:.8rem}th.descending::after{content:" ▼"}th.ascending::after{content:" ▲"}#group_by::part(popup){min-height:80vh}#group_by sm-select:last-of-type{margin-left:.5rem}#group_by th,#group_by td{padding:1rem}#side_bar{position:fixed;transform:translateX(-100%);background:rgba(var(--background-color), 1);bottom:0;top:0;left:0;right:0;width:100%}#side_bar>.flex:first-of-type{padding:.5rem 1rem}#side_bar .section-header{margin-bottom:0;background:inherit}#right{position:relative;display:flex;flex-direction:column;overflow:auto;max-height:100vh;background:rgba(var(--foreground-color), 1);-webkit-animation:slide-right .6s forwards cubic-bezier(0.175, 0.885, 0.32, 1.275);animation:slide-right .6s forwards cubic-bezier(0.175, 0.885, 0.32, 1.275)}@-webkit-keyframes slide-right{from{transform:translateX(-2rem)}to{transform:translateX(0)}}@keyframes slide-right{from{transform:translateX(-2rem)}to{transform:translateX(0)}}.placeholder{-webkit-animation:placeholder-loading .6s infinite alternate;animation:placeholder-loading .6s infinite alternate;padding:1.5rem 0;width:100%;margin:1.5rem;border-radius:.5rem;background:rgba(var(--text-color), 0.06)}.placeholder#sheet_container{width:calc(100% - 3rem);height:calc(100% - 3rem)}@-webkit-keyframes placeholder-loading{from{opacity:.4}to{opacity:1}}@keyframes placeholder-loading{from{opacity:.4}to{opacity:1}}#people_container{overflow:auto;max-height:calc(100vh - 3.6rem);gap:1.5rem}.person-card{display:grid;align-items:center;grid-template-columns:auto 1fr;grid-template-areas:"initials ." "initials .";cursor:pointer;padding:0 1rem;transition:transform .3s;-webkit-tap-highlight-color:rgba(0,0,0,0)}.person-card:first-of-type{margin-top:1.5rem}.person-card:last-of-type{margin-bottom:2rem}.person-initials{grid-area:initials;display:flex;justify-content:center;height:2.6rem;width:2.6rem;font-size:1.2rem !important;font-weight:500;align-items:center;border-radius:2rem;margin-right:1rem;text-transform:uppercase;opacity:1 !important;color:var(--accent-color);background:rgba(var(--text-color), 0.06)}.person-name{font-size:.9rem;opacity:.9;font-weight:500;text-transform:capitalize}.person-flo-id{opacity:.7;font-weight:400}#user_popup sm-button{margin-top:.5rem}#user_popup section:not(:last-of-type){margin-bottom:1.5rem}#editors_container,#columns_container,#additional_fields{gap:.4rem}#specify_editors{border-top:solid 1px rgba(var(--text-color), 0.2);padding-top:1rem}#add_editor sm-input,#add_column sm-input,#add_detail sm-input{width:100%}#add_detail{gap:.2rem;grid-template-columns:1fr auto;grid-template-areas:". add" ". add"}#add_detail button{grid-area:add;align-self:flex-end}.editor-card,.column-card,.details-card{border-radius:.3rem;background:rgba(var(--text-color), 0.06)}.editor-card .editor-address,.column-card .editor-address,.details-card .editor-address{font-size:.9rem;font-weight:400;opacity:.8}.editor-card{padding:.4rem .8rem}.column-card{padding:.4rem .6rem}.column-card h5{font-weight:500}.column-card .icon{margin-left:.4rem}.details-card{gap:.2rem;padding:.6rem .8rem;grid-template-columns:1fr auto;grid-template-areas:". close" ". close"}.details-card h4,.details-card h5{margin:0 !important}.details-card h5{font-weight:400;opacity:.8}.details-card h4{font-size:1rem !important}.details-card button{grid-area:close}#save_button{position:fixed;overflow:hidden;bottom:0;left:0;right:0;width:min(100% - 2rem,24rem);padding:1rem;margin:1rem;border-radius:.5rem;border:solid thin rgba(var(--text-color), 0.1);background:rgba(var(--foreground-color), 1);z-index:20;box-shadow:0 1rem 2rem rgba(0,0,0,.16)}#save_button #changes_indicator{position:absolute;left:0;width:.3rem;border-radius:0 .5rem .5rem 0;height:2em;background:red}#save_button sm-button{margin-left:1rem}@media screen and (max-width: 640px){#group_by_view{overflow:auto;max-width:calc(100vw - 3rem)}}@media screen and (min-width: 640px){.hide-on-desktop{display:none}sm-popup{--width: 24rem}.popup__header{padding:1.5rem 1.5rem 0 .75rem}#sign_in_page{grid-auto-flow:column}#sign_in_page .sign-in-box{width:26rem;padding:2rem;min-height:80vh;min-width:26rem;border-radius:.5rem;box-shadow:0 0 .3rem rgba(0,0,0,.0862745098),0 6rem 2rem -2rem rgba(0,0,0,.0862745098);background:rgba(var(--foreground-color), 1)}#main_header{padding:1.2rem 3rem}#home_page,#main_header{grid-template-columns:1fr 80vw 1fr;grid-template-areas:". main ."}#main_section,#main_header>div{grid-area:main}#sheet_view.toggle-side-bar{grid-template-columns:19rem 1fr}#sheet_view.toggle-side-bar #side_bar{z-index:initial}#sheet_view:not(.toggle-side-bar) #side_bar{grid-template-columns:1fr;position:fixed;transform:translateX(-100%)}#side_bar{position:relative;transform:none}#group_by::part(popup){width:80vw}#save_button{margin:1rem auto}}@media screen and (min-width: 1920px){#home_page,#main_header{grid-template-columns:1fr 60vw 1fr;grid-template-areas:". main ."}}@media(any-hover: hover){:root{scrollbar-width:thin}::-webkit-scrollbar{width:.7rem;height:.7rem}::-webkit-scrollbar-track{border-radius:10px}::-webkit-scrollbar-thumb{border-radius:10px;background:rgba(var(--text-color), 0.2)}::-webkit-scrollbar-thumb:hover{background:rgba(var(--text-color), 0.4)}#people_container::-webkit-scrollbar{width:.4rem}#right{z-index:1;box-shadow:-0.5rem 0 .5rem rgba(0,0,0,.062745098)}.sheet-card:hover{transform:scale(1.02);box-shadow:0 .5rem 1rem rgba(0,0,0,.1);z-index:1}}.hidden{display:none} \ No newline at end of file diff --git a/css/main.scss b/css/main.scss index bd61f83..ade72ff 100644 --- a/css/main.scss +++ b/css/main.scss @@ -481,7 +481,9 @@ ul { .margin-right-auto { margin-right: auto; } - +.margin-top-1 { + margin-top: 1rem; +} .margin-bottom-0-5 { margin-bottom: 0.5rem; } @@ -895,7 +897,7 @@ ul { background: rgba(var(--text-color), 0.1); } #sheet_description { - margin-top: 0.8rem; + margin-top: 0.5rem; opacity: 0.8; } #sheet_editors { @@ -925,25 +927,19 @@ ul { } #toggle_details { transform: rotateX(180deg); + padding: 0.4rem; + background-color: rgba(var(--text-color), 0.1); } #sheet_details { padding: 1rem; - margin-bottom: 1rem; - .flex:first-of-type { - margin-bottom: 1rem; - } .flex:nth-of-type(2) { - margin-bottom: 1rem; - } - .flex:not(:first-of-type) { - margin-bottom: 0.3rem; + padding: 0.5rem 0; + button:first-of-type { + margin-left: -0.7rem; + } } &.collapse { padding: 0.5rem 1rem; - margin-bottom: 0; - .flex { - margin-bottom: 0; - } #toggle_details { transform: none; } @@ -1042,6 +1038,10 @@ th.ascending::after { sm-select:last-of-type { margin-left: 0.5rem; } + th, + td { + padding: 1rem; + } } #side_bar { diff --git a/index.html b/index.html index 0f4fc4d..2116082 100644 --- a/index.html +++ b/index.html @@ -758,6 +758,14 @@ }) } + document.addEventListener('popupopened', e => { + let popup = e.detail.popup + switch (popup.id) { + case 'group_by': + renderGroup() + break; + } + }) document.addEventListener('popupclosed', e => { let popup = e.detail.popup switch (popup.id) { @@ -765,6 +773,9 @@ getRef('columns_container').innerHTML = '' getRef('editors_container').innerHTML = '' break; + case 'group_by': + renderElem(getRef("group_by_view"), html``) + break; } }) function showLoader() { @@ -785,32 +796,25 @@ el.setAttribute(key, attrs[key]); } } + delegate(getRef('people_container'), 'click', '.person-card', e => { + copyToLogInput(e.delegateTarget.dataset.floId) + }) let currentTableHeader - document.addEventListener('click', e => { - try { - if (e.target.closest(".person-card")) - copyToLogInput(e.target.closest(".person-card").dataset.floId) - else if (e.target.closest("th")) { - let trgt = e.target.closest('th') - if (currentTableHeader && currentTableHeader !== trgt) - currentTableHeader.classList.remove('ascending', 'descending') - sortTable(trgt.cellIndex, trgt.classList.contains('descending')) - if (trgt.classList.contains('descending')) - trgt.classList.add('ascending') - else - trgt.classList.remove('ascending') - trgt.classList.toggle('descending') - currentTableHeader = trgt - } - } catch (error) { - //do nothing - } + delegate(getRef('sheet_container__header'), 'click', 'th', e => { + if (currentTableHeader && currentTableHeader !== e.delegateTarget) + currentTableHeader.classList.remove('ascending', 'descending') + sortTable(e.delegateTarget.cellIndex, e.delegateTarget.classList.contains('descending')) + if (e.delegateTarget.classList.contains('descending')) + e.delegateTarget.classList.add('ascending') + else + e.delegateTarget.classList.remove('ascending') + e.delegateTarget.classList.toggle('descending') + currentTableHeader = e.delegateTarget }) const observer = new IntersectionObserver((entries, observer) => { entries.forEach(entry => { if (entry.isIntersecting) { - let { id, title, description, editors, attributes, sheet, isWriteable, isSubAdmin } = floGlobals.currentSheet; - renderSheetView(id, title, description, editors, attributes, sheet, isWriteable, isSubAdmin, true, true) + renderSheetView({ ...floGlobals.currentSheet, onlyRenderTable: true, lazyLoad: true }) observer.disconnect() } }) @@ -828,20 +832,15 @@ if (this.value.trim !== '') { for (child of getRef('sheets_container').children) { if (child.id === 'add_new_sheet') continue - if (child.dataset.name.toUpperCase().indexOf(this.value.toUpperCase()) > -1) { + if (child.dataset.name.toLowerCase().includes(this.value.trim().toLowerCase())) { child.classList.remove('hidden') - } - else { + } else { child.classList.add('hidden') } } } }) - function removeUnderscore(word) { - return word.replace(/_/g, ' ') - } - const render = { sheetCard(sheetId, details) { const { title, editors } = details @@ -1073,39 +1072,28 @@ }).catch(error => notify(`Save Unsuccessful [${error}]`, error)) }) - getRef('first_select').addEventListener("change", function (e) { + getRef('first_select').addEventListener("change", renderGroup) + + getRef('second_select').addEventListener("change", renderGroup) + + function renderGroup() { try { - let sheetId = floGlobals.currentSheet.id; - let sheet = floGlobals.currentSheet.sheet; - let type = this.value; + const type = getRef('first_select').value + const column = getRef('second_select').value + const { sheetId, sheet } = floGlobals.currentSheet if (type === 'count') { getRef('second_select').classList.add("hidden") let data = logSheet.groupBy.count(sheetId, sheet) renderGroupByView("count", data) } else { getRef('second_select').classList.remove("hidden") - let column = getRef('second_select').value; let data = logSheet.groupBy[type](sheetId, sheet, column); renderGroupByView(`${type}(${column})`, data) } } catch (error) { notify(error, "error") } - }) - - getRef('second_select').addEventListener("change", function (e) { - try { - console.log(this) - let sheetId = floGlobals.currentSheet.id; - let sheet = floGlobals.currentSheet.sheet; - let type = getRef('first_select').value; - let column = this.value; - let data = logSheet.groupBy[type](sheetId, sheet, column); - renderGroupByView(`${type}(${column})`, data) - } catch (error) { - notify(error, "error") - } - }) + } function clearElement(element) { element.innerHTML = ''; @@ -1184,12 +1172,11 @@ let input = document.forms['new-log'][0] if (input.tagName === 'INPUT') input.value = floID; - console.log(floID, input) } function enterLog(e) { e.preventDefault() - let sheetId = floGlobals.currentSheet.id; + let sheetId = floGlobals.currentSheet.sheetId; let form = document.forms['new-log'], allFormElements = document.querySelectorAll('input[form="new-log"]') if (form[0].tagName === 'INPUT') { @@ -1243,9 +1230,8 @@ getRef('sheet_type').classList.remove('placeholder') getRef('sheet_description').classList.remove('placeholder') getRef('sheet_container__header').classList.remove('hidden') - let data = logSheet.viewLogs(sheetId) - renderSheetView(data.id, data.title, data.description, data.editors, data.attributes, data.sheet.reverse(), - !data.editors || data.editors.includes(myFloID), floGlobals.subAdmins.includes(myFloID)) + const { id, title, description, editors, attributes, sheet } = logSheet.viewLogs(sheetId) + renderSheetView({ sheetId: id, title, description, editors, attributes, sheet: sheet.reverse() }) }).catch(error => notify(error, "error")) } @@ -1289,22 +1275,15 @@ let startingIndex = 0, endingIndex = 0 - function renderSheetView(sheetId, title, description, editors, attributes, sheet, isWriteable, isSubAdmin, onlyRenderTable = false, lazyLoad = false) { + function renderSheetView(details = {}) { + const { sheetId, title, description, editors, attributes, sheet, onlyRenderTable = false, lazyLoad = false } = details + const isWriteable = !editors || editors.includes(myFloID) + const isSubAdmin = floGlobals.subAdmins.includes(myFloID) if (!lazyLoad) - floGlobals.currentSheet = { - id: sheetId, - title, - description, - editors, - attributes, - sheet, - isWriteable, - isSubAdmin, - } + floGlobals.currentSheet = { sheetId, title, description, editors, attributes, sheet, } const parseVectorClock = (vc) => { - vc = vc.split('_') - let time = new Date(parseInt(vc[0])).toString().slice(4, 24); - let floID = vc[1] + const [vectorClock, floID] = vc.split('_') + let time = new Date(parseInt(vectorClock)).toString().slice(4, 24); return `by ${floID} (${time})` } const createGradeField = (vc, grade) => { @@ -1315,8 +1294,8 @@ if (!isWriteable || !isSubAdmin || vc.split('_')[1] == myFloID) gradeField.disabled = true; else { - gradeField.addEventListener("keypress", (event) => { - if (event.keyCode == 13) { + gradeField.addEventListener("keydown", (event) => { + if (event.key === 'Enter') { event.preventDefault(); gradeField.disabled = true; logSheet.gradeLog(sheetId, vc, gradeField.value) @@ -1338,61 +1317,51 @@ if (!onlyRenderTable) { //Add Sheet Details getRef('sheet_heading').textContent = title; - if (editors) { - getRef('sheet_type').textContent = 'Private' - editors.forEach(editor => { - let card = document.createElement('div') - card.className = 'editor' - card.textContent = editor; - frag.append(card) - }) - getRef('sheet_editors').innerHTML = 'Maintained by: ' - getRef('sheet_editors').append(frag) - } - else { - getRef('sheet_type').textContent = 'Public' - getRef('sheet_editors').innerHTML = '' - } + getRef('sheet_type').textContent = editors ? 'Private' : 'Public'; + renderElem(getRef('sheet_editors'), html`${editors ? html`Maintained by: ${editors.map(editor => html`
${editor}
`)}` : ''}`) getRef('sheet_description').textContent = description; - clearElement(getRef('sheet_container__header')) - let row = getRef('sheet_container__header').insertRow(); - row.append(createTh("FLO ID"), createTh("Grade")); - attributes.forEach(a => row.append(createTh(a))) - //Add input fields if writable let blockEditingID = (!isSubAdmin && (editors || true)); + let addLogRow = null + //Add input fields if writable if (isWriteable && !lazyLoad) { - getRef('sheet_container__header').append(html.node` + addLogRow = html` - + ${blockEditingID ? myFloID : html``} ${attributes.map(attr => html``)} - `) + `; } + renderElem(getRef('sheet_container__header'), html` + + FLO ID + Grade + ${attributes.map(attr => html`${attr}`)} + + ${addLogRow} + `) + } if (onlyRenderTable) { if (!lazyLoad) getRef('sheet_container__body').innerHTML = '' } for (let i = startingIndex; i < endingIndex; i++) { - let data = sheet[i] - if (!data.log || !data.floID || !data.vc) + const { log, floID, vc, grade } = sheet[i] + if (!log || !floID || !vc) continue; - let row = document.createElement('tr') - row.setAttribute("title", parseVectorClock(data.vc)) - row.append(createCell(data.floID)) - let gradeF = document.createElement('td') - gradeF.append(createGradeField(data.vc, data.grade)) - row.append(gradeF) - data.log.forEach(l => row.append(createCell(l))) - frag.append(row) + frag.append(html.node` + + ${floID} + ${createGradeField(vc, grade)} + ${log.map(l => html`${l}`)} + + `) } getRef('sheet_container__body').append(frag) if (!onlyRenderTable) { //Add options for groupBy getRef('group_by_title').textContent = `Group ${title} by`; - getRef('group_by_view').innerHTML = - `
FLO IDnull
` let colSelect = clearElement(getRef('group_by_menu').children[1]); attributes.forEach(a => { let opt = document.createElement('sm-option'); @@ -1404,22 +1373,27 @@ } function renderGroupByView(groupName, groupData) { - let table = document.createElement("table") - let head = table.createTHead().insertRow(0) - head.insertCell(0).textContent = "FLO ID"; - head.insertCell(1).textContent = groupName; - let tbody = document.createElement("tbody") - for (floID in groupData) { - let row = tbody.insertRow(0); - row.insertCell(0).textContent = floID - row.insertCell(1).textContent = groupData[floID] - } - table.appendChild(tbody); - clearElement(getRef("group_by_view")).appendChild(table); + renderElem(getRef("group_by_view"), html` + + + + + + + + + ${Object.keys(groupData).map(floID => html` + + + + + `)} + +
FLO ID${groupName}
${floID}${groupData[floID]}
+ `) } function sortTable(n, ascending) { - console.log(n) if (ascending) { if (n === 0) floGlobals.currentSheet.sheet.sort((a, b) => a.floID.toLowerCase().localeCompare(b.floID.toLowerCase())) @@ -1427,8 +1401,7 @@ floGlobals.currentSheet.sheet.sort((a, b) => { if (a.grade === b.grade) { return 0; - } - else { + } else { return (a.grade < b.grade) ? -1 : 1; } }) @@ -1439,12 +1412,10 @@ let y = (b.log[n - 2]) ? b.log[n - 2].toLowerCase() : b.log[n - 2] if (x === y) { return 0; - } - else { + } else { return (x < y) ? -1 : 1; } - } - else + } else return a.log[n - 2] - b.log[n - 2] }) } else { @@ -1454,8 +1425,7 @@ floGlobals.currentSheet.sheet.sort((a, b) => { if (a.grade === b.grade) { return 0; - } - else { + } else { return (a.grade > b.grade) ? -1 : 1; } }) @@ -1466,17 +1436,14 @@ let y = (b.log[n - 2]) ? b.log[n - 2].toLowerCase() : b.log[n - 2] if (x === y) { return 0; - } - else { + } else { return (x > y) ? -1 : 1; } - } - else + } else return b.log[n - 2] - a.log[n - 2] }) } - let { id, title, description, editors, attributes, sheet, isWriteable, isSubAdmin } = floGlobals.currentSheet - renderSheetView(id, title, description, editors, attributes, sheet, isWriteable, isSubAdmin, true, false) + renderSheetView({ ...floGlobals.currentSheet, onlyRenderTable: true }) }