diff --git a/css/main.css b/css/main.css index 4f911df..45e85da 100644 --- a/css/main.css +++ b/css/main.css @@ -106,7 +106,7 @@ button, .button { white-space: nowrap; - padding: 0.5rem 0.8rem; + padding: 0.6rem 0.8rem; border-radius: 0.3rem; background-color: rgba(var(--text-color), 0.06); color: rgba(var(--text-color), 0.8); @@ -579,7 +579,7 @@ main { grid-template-columns: auto 1fr auto auto; background-color: rgba(var(--background-color), 1); z-index: 2; - border-bottom: thin solid rgba(var(--text-color), 0.2); + border-bottom: thin solid rgba(var(--text-color), 0.1); } #expanding_search { @@ -623,6 +623,7 @@ theme-toggle { } #main_page { + align-content: flex-start; display: grid; padding: 1.5rem; gap: 1.5rem; @@ -631,14 +632,31 @@ theme-toggle { #news_categories_list { overflow-x: auto; + gap: 0.5rem; } .category { - padding: 0.5rem; + display: flex; + flex-direction: column; + padding: 0.8rem 0.5rem; color: inherit; - font-size: 0.9rem; + font-size: 0.8rem; white-space: nowrap; flex-shrink: 0; + align-items: center; + border-radius: 0.5rem; + min-width: 4rem; + background-color: rgba(var(--text-color), 0.02); +} +.category .icon { + transition: transform 0.3s; +} +.category:hover .icon { + transform: scale(1.3); + fill: var(--accent-color); +} +.category span { + margin-top: 0.5rem; } #query_results_list, @@ -920,6 +938,7 @@ theme-toggle { #writers_list { margin: 1.5rem 0; grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr)); + padding-bottom: 3rem; } .writer-card { @@ -985,6 +1004,15 @@ theme-toggle { } @media screen and (max-width: 40rem) { + button, +.button { + padding: 0.8rem; + } + + sm-button { + --padding: 0.8rem; + } + .writer-card .writer-profile { height: 2.5rem; width: 2.5rem; @@ -1081,14 +1109,12 @@ theme-toggle { --width: 48rem; } #edit_article_meta_popup > section { - display: grid; - gap: 1.5rem; grid-template-columns: 1fr 1.5fr; align-items: flex-start; } #user_popup { - --width: 26rem; + --width: 25rem; } } @media screen and (max-width: 64rem) { diff --git a/css/main.min.css b/css/main.min.css index b1ede68..02f6088 100644 --- a/css/main.min.css +++ b/css/main.min.css @@ -1 +1 @@ -*{padding:0;margin:0;box-sizing:border-box;font-family:"Inter",sans-serif}:root{font-size:clamp(1rem,1.2vmax,1.2rem)}html,body{height:100%;scroll-behavior:smooth}body{color:rgba(var(--text-color), 1);background:rgba(var(--background-color), 1)}body,body *{--accent-color: #256eff;--text-color: 36, 36, 36;--background-color: 248, 248, 248;--foreground-color: rgb(255, 255, 255);--danger-color: rgb(255, 75, 75);--green: #1cad59;--like-color: #e91e63;scrollbar-width:thin}body[data-theme=dark],body[data-theme=dark] *{--accent-color: #86afff;--text-color: 220, 220, 220;--background-color: 10, 10, 10;--foreground-color: rgb(24, 24, 24);--danger-color: rgb(255, 106, 106);--green: #00e676}body[data-theme=dark] sm-popup::part(popup){background-color:var(--foreground-color)}body[data-theme=dark] ::-webkit-calendar-picker-indicator{filter:invert(1)}p,strong{font-size:.9rem;max-width:70ch;line-height:1.7;color:rgba(var(--text-color), 0.8)}p:not(:last-of-type),strong:not(:last-of-type){margin-bottom:1.5rem}a{text-decoration:none}a:not([class]){color:var(--accent-color)}a:not([class]):focus-visible{box-shadow:0 0 0 .1rem rgba(var(--text-color), 1) inset}input[type=datetime-local]{width:100%;padding:.6rem .8rem;background-color:rgba(var(--text-color), 0.06);border:none;border-radius:.3rem;font-size:.9rem;color:inherit;font-family:inherit}input[type=datetime-local]:focus{outline:none;box-shadow:0 0 0 .1rem var(--accent-color)}button,.button{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;position:relative;display:inline-flex;border:none;background-color:transparent;overflow:hidden;color:inherit;cursor:pointer;-webkit-tap-highlight-color:transparent;align-items:center;font-size:.9rem;font-weight:500}.button{white-space:nowrap;padding:.5rem .8rem;border-radius:.3rem;background-color:rgba(var(--text-color), 0.06);color:rgba(var(--text-color), 0.8);justify-content:center}.button--primary{background-color:var(--accent-color);color:rgba(var(--background-color), 1)}.icon-only{padding:.5rem;border-radius:.3rem}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}sm-input,sm-textarea,tags-input{font-size:.9rem;--border-radius: 0.3rem}sm-button{--padding: 0.6rem 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.uppercase{letter-spacing:.05em}sm-button.danger{--background: var(--danger-color);color:rgba(var(--background-color), 1)}ul{list-style:none}.overflow-ellipsis{width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.breakable{overflow-wrap:break-word;word-wrap:break-word;-ms-word-break:break-all;word-break:break-word;-ms-hyphens:auto;-webkit-hyphens:auto;hyphens:auto}.full-bleed{grid-column:1/-1}.h1{font-size:1.5rem}.h2{font-size:1.2rem}.h3{font-size:1rem}.h4{font-size:.9rem}.h5{font-size:.8rem}.uppercase{text-transform:uppercase}.capitalize{text-transform:capitalize}.flex{display:flex}.grid{display:grid}.flow-column{grid-auto-flow:column}.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}.align-start{align-items:flex-start}.align-center{align-items:center}.text-center{text-align:center}.justify-start{justify-content:start}.justify-center{justify-content:center}.justify-right{margin-left:auto}.align-self-center{align-self:center}.justify-self-center{justify-self:center}.justify-self-start{justify-self:start}.justify-self-end{justify-self:end}.direction-column{flex-direction:column}.space-between{justify-content:space-between}.w-100{width:100%}.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}.interact{position:relative;overflow:hidden;cursor:pointer;-webkit-tap-highlight-color:transparent}.empty-state{display:grid;width:100%;padding:1.5rem 0}.observe-empty-state:empty{display:none}.observe-empty-state:not(:empty)+.empty-state{display:none}.bullet-point{display:flex;align-items:center;justify-content:center;margin:0 .8ch}.bullet-point::after{content:"";height:.4ch;width:.4ch;border-radius:.5em;background-color:currentColor}.icon{width:1.2rem;height:1.2rem;fill:rgba(var(--text-color), 0.8);flex-shrink:0}.button__icon{height:1.2rem;width:1.2rem}.button__icon--left{margin-right:.5rem}.button__icon--right{margin-left:.5rem}.icon-button{padding:.6rem;border-radius:.8rem;background-color:rgba(var(--text-color), 0.1);height:-webkit-max-content;height:-moz-max-content;height:max-content}.icon-button .icon{fill:var(--accent-color)}#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}#prompt_message{margin-bottom:1.5rem}.popup__header{display:grid;gap:.5rem;width:100%;padding:0 1.5rem 0 .8rem;align-items:center;grid-template-columns:auto 1fr auto}.popup__header__close{padding:.5rem;cursor:pointer}.logo{position:absolute;color:inherit;display:grid;align-items:center;grid-template-columns:auto 1fr;gap:0 .2rem;justify-self:center}.logo h4{text-transform:capitalize;font-size:.9rem;letter-spacing:.03em}.logo .main-logo{height:1.4rem;width:1.4rem;fill:rgba(var(--text-color), 1);stroke:none}details summary{display:flex;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:pointer}details[open]>summary .down-arrow{transform:rotate(180deg)}sm-select,sm-option,strip-option{font-size:.9rem}sm-select{--max-height: 12rem}strip-select{--gap: 0}strip-option{font-weight:500;--border-radius: 0.3rem;--active-option-color: var(--accent-color)}sm-menu{--background: var(--foreground-color)}menu-option{font-size:.9rem}sm-copy{font-size:.9rem;--button-border-radius: 0.2rem}.warning{background-color:khaki;color:rgba(0,0,0,.7);padding:1rem;border-radius:.5rem;line-height:1.5}.page{height:100%}.page-layout,#preview_page{display:grid;grid-template-columns:1.5rem minmax(0, 1fr) 1.5rem}.page-layout>*,#preview_page>*{grid-column:2/3}#loading{display:grid;place-content:center;text-align:center}#loader_container{position:relative;height:3rem;overflow:hidden;margin-bottom:1.5rem}#loader_container::after{content:"";position:absolute;height:100%;width:100%;left:0;background:linear-gradient(rgba(var(--foreground-color), 1), transparent 20%, transparent 80%, rgba(var(--foreground-color), 1))}#loader{height:6rem;width:6rem;-webkit-animation:scroll infinite 1s cubic-bezier(0.075, 0.82, 0.165, 1);animation:scroll infinite 1s cubic-bezier(0.075, 0.82, 0.165, 1);fill:rgba(var(--text-color), 0.2)}@-webkit-keyframes scroll{to{transform:translateY(-3rem)}}@keyframes scroll{to{transform:translateY(-3rem)}}.label{font-size:.8rem;color:rgba(var(--text-color), 0.8);margin-bottom:.2rem}.icon--success{fill:var(--green)}.icon--failure,.icon--error{fill:var(--danger-color)}main{display:grid;height:100%;grid-template-rows:auto 1fr;grid-template-columns:minmax(0, 1fr)}#main_header{display:grid;gap:.5rem;padding:1rem;align-items:center;grid-column:1/-1;grid-template-columns:auto 1fr auto auto;background-color:rgba(var(--background-color), 1);z-index:2;border-bottom:thin solid rgba(var(--text-color), 0.2)}#expanding_search{position:absolute;display:grid;gap:.5rem;align-items:center;width:calc(100% - 2rem);z-index:1;background-color:rgba(var(--background-color), 1)}#expanding_search .icon-only{margin-right:.5rem}#search_suggestions{position:absolute;top:calc(100% + .5rem);background-color:var(--foreground-color);padding:.3rem;width:100%;border-radius:.3rem;box-shadow:0 .5rem 1.5rem rgba(0,0,0,.1)}.search-suggestion{font-size:.9rem;color:inherit;padding:1rem;border-radius:.3rem}#search_articles{--border-radius: 0.5em;width:100%}theme-toggle{margin-left:auto;padding:0 .5rem}#main_page{display:grid;padding:1.5rem;gap:1.5rem;grid-template-columns:minmax(0, 1fr)}#news_categories_list{overflow-x:auto}.category{padding:.5rem;color:inherit;font-size:.9rem;white-space:nowrap;flex-shrink:0}#query_results_list,#written_article_list{margin:1rem 0;padding-bottom:2rem;gap:1.6rem}.article-card{gap:.3rem}.article-card a{color:inherit}.article-card .article-link{gap:.5rem}.article-card__title{line-height:1.4}.article-card__category{background-color:rgba(var(--text-color), 0.1);border-radius:.3rem;font-size:.8rem;padding:.3rem .6rem;font-weight:700;color:rgba(var(--text-color), 0.6) !important;justify-self:flex-start;text-transform:capitalize}.article-card .flex{font-size:.8rem}#trending_article_container{counter-reset:trending;margin-bottom:1.5rem}.trending-article{counter-increment:trending;grid-template-columns:auto 1fr;gap:.5rem 1.5rem}.trending-article::before{content:counter(trending);grid-column:1/2;grid-row:1/3;font-size:2.5em;font-weight:700;opacity:.3}#explore{padding-top:1.5rem}#writer{align-items:flex-start;align-content:flex-start;padding:1.5rem;gap:3rem}#writer sm-copy{font-size:.8rem}#writer_profile{display:flex;width:4rem;height:4rem;border-radius:2rem;background-color:var(--accent-color);justify-content:center}#writer_profile #writer_initials{align-self:center;font-weight:700;font-size:1.8rem;color:rgba(var(--background-color), 1);text-transform:uppercase}#article{gap:2rem 0;padding-bottom:6rem}.hero-section{display:grid;gap:.5rem;grid-template-columns:minmax(0, 1fr);padding-top:1.5rem}#article_contributors{flex-wrap:wrap;gap:.3rem;margin:.5rem 0 1rem 0}.contributor{color:inherit;font-size:.8rem;background-color:rgba(var(--text-color), 0.06);border-radius:.3rem;padding:.3rem .5rem}#like_panel{position:fixed;bottom:0;width:100%;padding:1.5rem;text-align:center;justify-items:flex-start}.up-vote{display:grid;grid-template-columns:auto 1fr;position:relative;padding:.8rem;border-radius:2rem;background-color:var(--foreground-color);box-shadow:0 .5rem 1rem rgba(0,0,0,.1);border:solid rgba(var(--text-color), 0.2) thin}.up-vote>*{pointer-events:none}.up-vote:active{transform:none}.up-vote:active .icon{transform:scale(0.7)}.up-vote.liked{background-color:var(--like-color);color:#fff}.up-vote.liked .icon{fill:#fff}.up-vote .expanding-heart,.up-vote .ring{grid-area:1/1}.up-vote .icon{grid-area:1/1;fill:var(--like-color);height:1.5rem;width:1.5rem;transition:transform .2s}.ring{border:.1rem solid var(--like-color);border-radius:50%;height:.5rem;width:.5rem;justify-self:center}.temp-count,#like_count{grid-area:1/2}.temp-count:not(:empty),#like_count:not(:empty){margin-left:.4rem}.floating-button{position:fixed;z-index:2;box-shadow:0 .5rem 1rem rgba(0,0,0,.2);border-radius:2rem;bottom:0;right:0;margin:1.5rem;padding:1rem}#go_to_top{background-color:var(--foreground-color)}#dashboard{height:-webkit-max-content;height:-moz-max-content;height:max-content;padding:1.5rem 0;grid-template-rows:auto 1fr}#publishing_requests,#article_analytics{margin-top:2rem;align-content:flex-start}.request-card{display:grid;gap:.5rem;border-radius:.5rem;align-items:flex-start;grid-template-columns:1fr auto}.request-card__title{grid-area:2/1}.request-card__time{font-size:.8rem}.request-card .flex{grid-row:span 2}.request-card .publish-button{text-transform:uppercase;letter-spacing:.05em;font-size:.8rem;font-weight:700}.article-row{align-items:center;gap:1rem;grid-template-columns:1fr auto auto}.article-row__published{font-size:.8rem}#preview_popup h1,#article h1{font-size:1.6rem;line-height:1.3}#preview_popup h3:not(:first-of-type),#article h3:not(:first-of-type){margin-top:2rem}#preview_popup h3,#article h3{margin-bottom:1rem}#preview_popup h3:not(:first-of-type),#article h3:not(:first-of-type){margin-top:1.5rem}#preview_popup p,#article p{font-family:"noto serif",serif;font-size:1rem;line-height:1.8}#preview_popup p>*,#article p>*{font-family:inherit}#preview_popup time,#preview_popup #reading_time,#article time,#article #reading_time{font-size:.8rem}#add_writer_button{background-color:var(--accent-color);color:rgba(var(--background-color), 1)}#add_writer_button .icon{fill:rgba(var(--background-color), 1)}#writers_list{margin:1.5rem 0;grid-template-columns:repeat(auto-fill, minmax(20rem, 1fr))}.writer-card{display:grid;gap:1rem;padding:1rem;border-radius:.5rem;background-color:var(--foreground-color)}.writer-card .writer-profile{display:flex;align-items:center;justify-content:center;height:3rem;width:3rem;border-radius:2rem;background-color:var(--accent-color);text-align:center;font-size:100%;font-weight:700;text-transform:uppercase;color:var(--foreground-color)}.writer-card sm-copy{margin-top:-0.5rem;font-size:.8rem}#user_popup{overflow:hidden}#user_popup header{overflow:hidden;width:100%;position:relative;padding:1.5rem;color:#dcdcdc}#user_popup header h2{margin-top:2rem}#user_popup header .popup__header__close{margin-left:-0.5rem;background-color:rgba(0,0,0,.2);border-radius:2rem}#user_popup header .popup__header__close .icon{fill:#fff}#user_background{position:absolute;top:-1px;left:0;right:0;z-index:-1;transform:scale(-1);border-radius:0 0 .5rem .5rem}.hide{display:none !important}@media screen and (max-width: 40rem){.writer-card .writer-profile{height:2.5rem;width:2.5rem}.hide-on-mobile{display:none}}@media screen and (min-width: 40rem){sm-popup{--width: 24rem}h1,.h1{font-size:2rem}.h2{font-size:1.8rem}.h3{font-size:1.3rem}.h4{font-size:1rem}.popup__header{grid-column:1/-1;padding:1rem 1.5rem 0 .8rem}#confirmation_popup{--width: 24rem}.page-layout{grid-template-columns:1fr 80vw 1fr}.hide-on-desktop{display:none}#main_header{padding:1rem 1.5rem}#main_page{padding:1rem 8vw;grid-template-rows:auto 1fr;grid-template-columns:2fr 1fr}#main_page__header{grid-area:1/1/2/-1}#expanding_search{margin:1rem 1.5rem;left:0;width:20rem}#writer{gap:1.5rem 6vw;padding:2rem 8vw;grid-template-columns:20rem 1fr}#writer>section:first-of-type{position:-webkit-sticky;position:sticky;top:1.5rem}#preview_popup h1,#article h1{font-size:2rem}#article{grid-template-columns:1fr 60ch 1fr}#preview_popup{--width: 60ch}#edit_article_meta_popup{--width: 48rem}#edit_article_meta_popup>section{display:grid;gap:1.5rem;grid-template-columns:1fr 1.5fr;align-items:flex-start}#user_popup{--width: 26rem}}@media screen and (max-width: 64rem){.hide-on-medium{display:none}}@media screen and (min-width: 64rem){#like_panel{margin:1.5rem;width:18vw;border-radius:.8rem;border:solid thin rgba(var(--text-color), 0.2);justify-content:flex-start;justify-items:flex-start;text-align:left}#like_panel .up-vote{box-shadow:none}}@media(any-hover: hover){::-webkit-scrollbar{width:.5rem;height:.5rem}::-webkit-scrollbar-thumb{background:rgba(var(--text-color), 0.3);border-radius:1rem}::-webkit-scrollbar-thumb:hover{background:rgba(var(--text-color), 0.5)}.interact,button:not(.button--primary){transition:background-color .3s}.interact:hover,button:not(.button--primary):hover{background-color:rgba(var(--text-color), 0.06)}.button--primary{transition:filter .3s}.button--primary:hover{filter:brightness(120%)}} \ No newline at end of file +*{padding:0;margin:0;box-sizing:border-box;font-family:"Inter",sans-serif}:root{font-size:clamp(1rem,1.2vmax,1.2rem)}html,body{height:100%;scroll-behavior:smooth}body{color:rgba(var(--text-color), 1);background:rgba(var(--background-color), 1)}body,body *{--accent-color: #256eff;--text-color: 36, 36, 36;--background-color: 248, 248, 248;--foreground-color: rgb(255, 255, 255);--danger-color: rgb(255, 75, 75);--green: #1cad59;--like-color: #e91e63;scrollbar-width:thin}body[data-theme=dark],body[data-theme=dark] *{--accent-color: #86afff;--text-color: 220, 220, 220;--background-color: 10, 10, 10;--foreground-color: rgb(24, 24, 24);--danger-color: rgb(255, 106, 106);--green: #00e676}body[data-theme=dark] sm-popup::part(popup){background-color:var(--foreground-color)}body[data-theme=dark] ::-webkit-calendar-picker-indicator{filter:invert(1)}p,strong{font-size:.9rem;max-width:70ch;line-height:1.7;color:rgba(var(--text-color), 0.8)}p:not(:last-of-type),strong:not(:last-of-type){margin-bottom:1.5rem}a{text-decoration:none}a:not([class]){color:var(--accent-color)}a:not([class]):focus-visible{box-shadow:0 0 0 .1rem rgba(var(--text-color), 1) inset}input[type=datetime-local]{width:100%;padding:.6rem .8rem;background-color:rgba(var(--text-color), 0.06);border:none;border-radius:.3rem;font-size:.9rem;color:inherit;font-family:inherit}input[type=datetime-local]:focus{outline:none;box-shadow:0 0 0 .1rem var(--accent-color)}button,.button{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;position:relative;display:inline-flex;border:none;background-color:transparent;overflow:hidden;color:inherit;cursor:pointer;-webkit-tap-highlight-color:transparent;align-items:center;font-size:.9rem;font-weight:500}.button{white-space:nowrap;padding:.6rem .8rem;border-radius:.3rem;background-color:rgba(var(--text-color), 0.06);color:rgba(var(--text-color), 0.8);justify-content:center}.button--primary{background-color:var(--accent-color);color:rgba(var(--background-color), 1)}.icon-only{padding:.5rem;border-radius:.3rem}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}sm-input,sm-textarea,tags-input{font-size:.9rem;--border-radius: 0.3rem}sm-button{--padding: 0.6rem 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.uppercase{letter-spacing:.05em}sm-button.danger{--background: var(--danger-color);color:rgba(var(--background-color), 1)}ul{list-style:none}.overflow-ellipsis{width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.breakable{overflow-wrap:break-word;word-wrap:break-word;-ms-word-break:break-all;word-break:break-word;-ms-hyphens:auto;-webkit-hyphens:auto;hyphens:auto}.full-bleed{grid-column:1/-1}.h1{font-size:1.5rem}.h2{font-size:1.2rem}.h3{font-size:1rem}.h4{font-size:.9rem}.h5{font-size:.8rem}.uppercase{text-transform:uppercase}.capitalize{text-transform:capitalize}.flex{display:flex}.grid{display:grid}.flow-column{grid-auto-flow:column}.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}.align-start{align-items:flex-start}.align-center{align-items:center}.text-center{text-align:center}.justify-start{justify-content:start}.justify-center{justify-content:center}.justify-right{margin-left:auto}.align-self-center{align-self:center}.justify-self-center{justify-self:center}.justify-self-start{justify-self:start}.justify-self-end{justify-self:end}.direction-column{flex-direction:column}.space-between{justify-content:space-between}.w-100{width:100%}.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}.interact{position:relative;overflow:hidden;cursor:pointer;-webkit-tap-highlight-color:transparent}.empty-state{display:grid;width:100%;padding:1.5rem 0}.observe-empty-state:empty{display:none}.observe-empty-state:not(:empty)+.empty-state{display:none}.bullet-point{display:flex;align-items:center;justify-content:center;margin:0 .8ch}.bullet-point::after{content:"";height:.4ch;width:.4ch;border-radius:.5em;background-color:currentColor}.icon{width:1.2rem;height:1.2rem;fill:rgba(var(--text-color), 0.8);flex-shrink:0}.button__icon{height:1.2rem;width:1.2rem}.button__icon--left{margin-right:.5rem}.button__icon--right{margin-left:.5rem}.icon-button{padding:.6rem;border-radius:.8rem;background-color:rgba(var(--text-color), 0.1);height:-webkit-max-content;height:-moz-max-content;height:max-content}.icon-button .icon{fill:var(--accent-color)}#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}#prompt_message{margin-bottom:1.5rem}.popup__header{display:grid;gap:.5rem;width:100%;padding:0 1.5rem 0 .8rem;align-items:center;grid-template-columns:auto 1fr auto}.popup__header__close{padding:.5rem;cursor:pointer}.logo{position:absolute;color:inherit;display:grid;align-items:center;grid-template-columns:auto 1fr;gap:0 .2rem;justify-self:center}.logo h4{text-transform:capitalize;font-size:.9rem;letter-spacing:.03em}.logo .main-logo{height:1.4rem;width:1.4rem;fill:rgba(var(--text-color), 1);stroke:none}details summary{display:flex;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:pointer}details[open]>summary .down-arrow{transform:rotate(180deg)}sm-select,sm-option,strip-option{font-size:.9rem}sm-select{--max-height: 12rem}strip-select{--gap: 0}strip-option{font-weight:500;--border-radius: 0.3rem;--active-option-color: var(--accent-color)}sm-menu{--background: var(--foreground-color)}menu-option{font-size:.9rem}sm-copy{font-size:.9rem;--button-border-radius: 0.2rem}.warning{background-color:khaki;color:rgba(0,0,0,.7);padding:1rem;border-radius:.5rem;line-height:1.5}.page{height:100%}.page-layout,#preview_page{display:grid;grid-template-columns:1.5rem minmax(0, 1fr) 1.5rem}.page-layout>*,#preview_page>*{grid-column:2/3}#loading{display:grid;place-content:center;text-align:center}#loader_container{position:relative;height:3rem;overflow:hidden;margin-bottom:1.5rem}#loader_container::after{content:"";position:absolute;height:100%;width:100%;left:0;background:linear-gradient(rgba(var(--foreground-color), 1), transparent 20%, transparent 80%, rgba(var(--foreground-color), 1))}#loader{height:6rem;width:6rem;-webkit-animation:scroll infinite 1s cubic-bezier(0.075, 0.82, 0.165, 1);animation:scroll infinite 1s cubic-bezier(0.075, 0.82, 0.165, 1);fill:rgba(var(--text-color), 0.2)}@-webkit-keyframes scroll{to{transform:translateY(-3rem)}}@keyframes scroll{to{transform:translateY(-3rem)}}.label{font-size:.8rem;color:rgba(var(--text-color), 0.8);margin-bottom:.2rem}.icon--success{fill:var(--green)}.icon--failure,.icon--error{fill:var(--danger-color)}main{display:grid;height:100%;grid-template-rows:auto 1fr;grid-template-columns:minmax(0, 1fr)}#main_header{display:grid;gap:.5rem;padding:1rem;align-items:center;grid-column:1/-1;grid-template-columns:auto 1fr auto auto;background-color:rgba(var(--background-color), 1);z-index:2;border-bottom:thin solid rgba(var(--text-color), 0.1)}#expanding_search{position:absolute;display:grid;gap:.5rem;align-items:center;width:calc(100% - 2rem);z-index:1;background-color:rgba(var(--background-color), 1)}#expanding_search .icon-only{margin-right:.5rem}#search_suggestions{position:absolute;top:calc(100% + .5rem);background-color:var(--foreground-color);padding:.3rem;width:100%;border-radius:.3rem;box-shadow:0 .5rem 1.5rem rgba(0,0,0,.1)}.search-suggestion{font-size:.9rem;color:inherit;padding:1rem;border-radius:.3rem}#search_articles{--border-radius: 0.5em;width:100%}theme-toggle{margin-left:auto;padding:0 .5rem}#main_page{align-content:flex-start;display:grid;padding:1.5rem;gap:1.5rem;grid-template-columns:minmax(0, 1fr)}#news_categories_list{overflow-x:auto;gap:.5rem}.category{display:flex;flex-direction:column;padding:.8rem .5rem;color:inherit;font-size:.8rem;white-space:nowrap;flex-shrink:0;align-items:center;border-radius:.5rem;min-width:4rem;background-color:rgba(var(--text-color), 0.02)}.category .icon{transition:transform .3s}.category:hover .icon{transform:scale(1.3);fill:var(--accent-color)}.category span{margin-top:.5rem}#query_results_list,#written_article_list{margin:1rem 0;padding-bottom:2rem;gap:1.6rem}.article-card{gap:.3rem}.article-card a{color:inherit}.article-card .article-link{gap:.5rem}.article-card__title{line-height:1.4}.article-card__category{background-color:rgba(var(--text-color), 0.1);border-radius:.3rem;font-size:.8rem;padding:.3rem .6rem;font-weight:700;color:rgba(var(--text-color), 0.6) !important;justify-self:flex-start;text-transform:capitalize}.article-card .flex{font-size:.8rem}#trending_article_container{counter-reset:trending;margin-bottom:1.5rem}.trending-article{counter-increment:trending;grid-template-columns:auto 1fr;gap:.5rem 1.5rem}.trending-article::before{content:counter(trending);grid-column:1/2;grid-row:1/3;font-size:2.5em;font-weight:700;opacity:.3}#explore{padding-top:1.5rem}#writer{align-items:flex-start;align-content:flex-start;padding:1.5rem;gap:3rem}#writer sm-copy{font-size:.8rem}#writer_profile{display:flex;width:4rem;height:4rem;border-radius:2rem;background-color:var(--accent-color);justify-content:center}#writer_profile #writer_initials{align-self:center;font-weight:700;font-size:1.8rem;color:rgba(var(--background-color), 1);text-transform:uppercase}#article{gap:2rem 0;padding-bottom:6rem}.hero-section{display:grid;gap:.5rem;grid-template-columns:minmax(0, 1fr);padding-top:1.5rem}#article_contributors{flex-wrap:wrap;gap:.3rem;margin:.5rem 0 1rem 0}.contributor{color:inherit;font-size:.8rem;background-color:rgba(var(--text-color), 0.06);border-radius:.3rem;padding:.3rem .5rem}#like_panel{position:fixed;bottom:0;width:100%;padding:1.5rem;text-align:center;justify-items:flex-start}.up-vote{display:grid;grid-template-columns:auto 1fr;position:relative;padding:.8rem;border-radius:2rem;background-color:var(--foreground-color);box-shadow:0 .5rem 1rem rgba(0,0,0,.1);border:solid rgba(var(--text-color), 0.2) thin}.up-vote>*{pointer-events:none}.up-vote:active{transform:none}.up-vote:active .icon{transform:scale(0.7)}.up-vote.liked{background-color:var(--like-color);color:#fff}.up-vote.liked .icon{fill:#fff}.up-vote .expanding-heart,.up-vote .ring{grid-area:1/1}.up-vote .icon{grid-area:1/1;fill:var(--like-color);height:1.5rem;width:1.5rem;transition:transform .2s}.ring{border:.1rem solid var(--like-color);border-radius:50%;height:.5rem;width:.5rem;justify-self:center}.temp-count,#like_count{grid-area:1/2}.temp-count:not(:empty),#like_count:not(:empty){margin-left:.4rem}.floating-button{position:fixed;z-index:2;box-shadow:0 .5rem 1rem rgba(0,0,0,.2);border-radius:2rem;bottom:0;right:0;margin:1.5rem;padding:1rem}#go_to_top{background-color:var(--foreground-color)}#dashboard{height:-webkit-max-content;height:-moz-max-content;height:max-content;padding:1.5rem 0;grid-template-rows:auto 1fr}#publishing_requests,#article_analytics{margin-top:2rem;align-content:flex-start}.request-card{display:grid;gap:.5rem;border-radius:.5rem;align-items:flex-start;grid-template-columns:1fr auto}.request-card__title{grid-area:2/1}.request-card__time{font-size:.8rem}.request-card .flex{grid-row:span 2}.request-card .publish-button{text-transform:uppercase;letter-spacing:.05em;font-size:.8rem;font-weight:700}.article-row{align-items:center;gap:1rem;grid-template-columns:1fr auto auto}.article-row__published{font-size:.8rem}#preview_popup h1,#article h1{font-size:1.6rem;line-height:1.3}#preview_popup h3:not(:first-of-type),#article h3:not(:first-of-type){margin-top:2rem}#preview_popup h3,#article h3{margin-bottom:1rem}#preview_popup h3:not(:first-of-type),#article h3:not(:first-of-type){margin-top:1.5rem}#preview_popup p,#article p{font-family:"noto serif",serif;font-size:1rem;line-height:1.8}#preview_popup p>*,#article p>*{font-family:inherit}#preview_popup time,#preview_popup #reading_time,#article time,#article #reading_time{font-size:.8rem}#add_writer_button{background-color:var(--accent-color);color:rgba(var(--background-color), 1)}#add_writer_button .icon{fill:rgba(var(--background-color), 1)}#writers_list{margin:1.5rem 0;grid-template-columns:repeat(auto-fill, minmax(20rem, 1fr));padding-bottom:3rem}.writer-card{display:grid;gap:1rem;padding:1rem;border-radius:.5rem;background-color:var(--foreground-color)}.writer-card .writer-profile{display:flex;align-items:center;justify-content:center;height:3rem;width:3rem;border-radius:2rem;background-color:var(--accent-color);text-align:center;font-size:100%;font-weight:700;text-transform:uppercase;color:var(--foreground-color)}.writer-card sm-copy{margin-top:-0.5rem;font-size:.8rem}#user_popup{overflow:hidden}#user_popup header{overflow:hidden;width:100%;position:relative;padding:1.5rem;color:#dcdcdc}#user_popup header h2{margin-top:2rem}#user_popup header .popup__header__close{margin-left:-0.5rem;background-color:rgba(0,0,0,.2);border-radius:2rem}#user_popup header .popup__header__close .icon{fill:#fff}#user_background{position:absolute;top:-1px;left:0;right:0;z-index:-1;transform:scale(-1);border-radius:0 0 .5rem .5rem}.hide{display:none !important}@media screen and (max-width: 40rem){button,.button{padding:.8rem}sm-button{--padding: 0.8rem}.writer-card .writer-profile{height:2.5rem;width:2.5rem}.hide-on-mobile{display:none}}@media screen and (min-width: 40rem){sm-popup{--width: 24rem}h1,.h1{font-size:2rem}.h2{font-size:1.8rem}.h3{font-size:1.3rem}.h4{font-size:1rem}.popup__header{grid-column:1/-1;padding:1rem 1.5rem 0 .8rem}#confirmation_popup{--width: 24rem}.page-layout{grid-template-columns:1fr 80vw 1fr}.hide-on-desktop{display:none}#main_header{padding:1rem 1.5rem}#main_page{padding:1rem 8vw;grid-template-rows:auto 1fr;grid-template-columns:2fr 1fr}#main_page__header{grid-area:1/1/2/-1}#expanding_search{margin:1rem 1.5rem;left:0;width:20rem}#writer{gap:1.5rem 6vw;padding:2rem 8vw;grid-template-columns:20rem 1fr}#writer>section:first-of-type{position:-webkit-sticky;position:sticky;top:1.5rem}#preview_popup h1,#article h1{font-size:2rem}#article{grid-template-columns:1fr 60ch 1fr}#preview_popup{--width: 60ch}#edit_article_meta_popup{--width: 48rem}#edit_article_meta_popup>section{grid-template-columns:1fr 1.5fr;align-items:flex-start}#user_popup{--width: 25rem}}@media screen and (max-width: 64rem){.hide-on-medium{display:none}}@media screen and (min-width: 64rem){#like_panel{margin:1.5rem;width:18vw;border-radius:.8rem;border:solid thin rgba(var(--text-color), 0.2);justify-content:flex-start;justify-items:flex-start;text-align:left}#like_panel .up-vote{box-shadow:none}}@media(any-hover: hover){::-webkit-scrollbar{width:.5rem;height:.5rem}::-webkit-scrollbar-thumb{background:rgba(var(--text-color), 0.3);border-radius:1rem}::-webkit-scrollbar-thumb:hover{background:rgba(var(--text-color), 0.5)}.interact,button:not(.button--primary){transition:background-color .3s}.interact:hover,button:not(.button--primary):hover{background-color:rgba(var(--text-color), 0.06)}.button--primary{transition:filter .3s}.button--primary:hover{filter:brightness(120%)}} \ No newline at end of file diff --git a/css/main.scss b/css/main.scss index eaca647..e4bca70 100644 --- a/css/main.scss +++ b/css/main.scss @@ -105,7 +105,7 @@ button, } .button { white-space: nowrap; - padding: 0.5rem 0.8rem; + padding: 0.6rem 0.8rem; border-radius: 0.3rem; background-color: rgba(var(--text-color), 0.06); color: rgba(var(--text-color), 0.8); @@ -550,7 +550,7 @@ main { grid-template-columns: auto 1fr auto auto; background-color: rgba(var(--background-color), 1); z-index: 2; - border-bottom: thin solid rgba(var(--text-color), 0.2); + border-bottom: thin solid rgba(var(--text-color), 0.1); } #expanding_search { position: absolute; @@ -589,6 +589,7 @@ theme-toggle { } #main_page { + align-content: flex-start; display: grid; padding: 1.5rem; gap: 1.5rem; @@ -597,13 +598,32 @@ theme-toggle { #news_categories_list { overflow-x: auto; + gap: 0.5rem; } .category { - padding: 0.5rem; + display: flex; + flex-direction: column; + padding: 0.8rem 0.5rem; color: inherit; - font-size: 0.9rem; + font-size: 0.8rem; white-space: nowrap; flex-shrink: 0; + align-items: center; + border-radius: 0.5rem; + min-width: 4rem; + background-color: rgba(var(--text-color), 0.02); + .icon { + transition: transform 0.3s; + } + &:hover { + .icon { + transform: scale(1.3); + fill: var(--accent-color); + } + } + span { + margin-top: 0.5rem; + } } #query_results_list, @@ -879,6 +899,7 @@ theme-toggle { #writers_list { margin: 1.5rem 0; grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr)); + padding-bottom: 3rem; } .writer-card { @@ -942,6 +963,13 @@ theme-toggle { } @media screen and (max-width: 40rem) { + button, + .button { + padding: 0.8rem; + } + sm-button { + --padding: 0.8rem; + } .writer-card { .writer-profile { height: 2.5rem; @@ -1030,14 +1058,12 @@ theme-toggle { #edit_article_meta_popup { --width: 48rem; & > section { - display: grid; - gap: 1.5rem; grid-template-columns: 1fr 1.5fr; align-items: flex-start; } } #user_popup { - --width: 26rem; + --width: 25rem; } } @media screen and (max-width: 64rem) { diff --git a/index.html b/index.html index c6e849a..ee77c69 100644 --- a/index.html +++ b/index.html @@ -27,7 +27,7 @@ FLO: ['https://livenet.flocha.in/', 'https://flosight.duckdns.org/'], FLO_TEST: ['https://testnet-flosight.duckdns.org/', 'https://testnet.flocha.in/'] }, - adminID: "FKAEdnPfjXLHSYwrXQu377ugN4tXU7VGdf", + adminID: "FF5pewfsJxyrCvg8a2C8VXefeyVvKvQxmF", sendAmt: 0.001, fee: 0.0005, @@ -37,7 +37,7 @@ //for cloud apps subAdmins: [], - application: "Test_RM_Times", + application: "RM_Times", appObjects: {}, generalData: {}, lastVC: {} @@ -211,7 +211,7 @@ - -

Share article preview

+

Share article

Copy link @@ -393,7 +393,7 @@ Edit -
+
Title
@@ -594,7 +594,7 @@
-
+

@@ -908,7 +908,7 @@ case 'dashboard': targetPage = 'dashboard' await Promise.all([ - floCloudAPI.requestObjectData('publishedVc'), + floCloudAPI.requestObjectData('admin'), floCloudAPI.requestGeneralData('publishing_requests', { callback: (d, e) => renderDashboard(d) }) @@ -1050,17 +1050,17 @@ }, requestCard(details) { const { message: { articleID, category, title }, time, vectorClock } = details - if (!floGlobals.appObjects.publishedVc.hasOwnProperty(vectorClock)) { + if (!floGlobals.appObjects.adminData.publishedVc.hasOwnProperty(vectorClock)) { const clone = getRef('request_template').content.cloneNode(true).firstElementChild clone.dataset.vc = vectorClock clone.querySelector('.request-card__title').textContent = title clone.querySelector('.request-card__time').textContent = getFormattedTime(time) - clone.querySelector('.publish-button').textContent = floGlobals.appObjects['articles'].hasOwnProperty(articleID) ? 'Update' : 'Publish' + clone.querySelector('.publish-button').textContent = floGlobals.appObjects.rmTimes.articles.hasOwnProperty(articleID) ? 'Update' : 'Publish' return clone } }, articleRow(articleID) { - const { category, title, published, votes } = floGlobals.appObjects.articles[articleID] + const { category, title, published, votes } = floGlobals.appObjects.rmTimes.articles[articleID] const clone = getRef('article_row_template').content.cloneNode(true).firstElementChild clone.querySelector('.article-card__title').textContent = title clone.querySelector('.article-row__published').textContent = relativeTime.from(published) @@ -1069,7 +1069,7 @@ return clone }, writerCard(writerID) { - const { name, bio } = floGlobals.appObjects.articleWriters[writerID] + const { name, bio } = floGlobals.appObjects.rmTimes.articleWriters[writerID] const clone = getRef('article_writer_template').content.cloneNode(true).firstElementChild clone.dataset.writerId = writerID clone.querySelector('.writer-profile').textContent = name[0] @@ -1082,9 +1082,8 @@ const getArticles = async () => { await Promise.all([ - floCloudAPI.requestObjectData('articles'), + floCloudAPI.requestObjectData('rmTimes'), floCloudAPI.requestObjectData('articlesContent'), - floCloudAPI.requestObjectData('articleWriters'), ]) delete floGlobals.appObjects.articlesContent showPage(window.location.hash, { firstLoad: true }) @@ -1104,15 +1103,36 @@ function renderHomepage() { const frag = document.createDocumentFragment() // Render article topics - const categories = ['Art', 'Culture', 'Politics', 'Science', 'Tech'] - categories.forEach(category => frag.append(createElement('a', { - textContent: category, - attributes: { href: `#/explore?type=category&query=${category.toLowerCase()}` }, - className: 'category interact' + const categories = [ + { + title: 'Art', + icon: `` + }, + { + title: 'Culture', + icon: `` + }, + { + title: 'Politics', + icon: `` + }, + { + title: 'Science', + icon: `` + }, + { + title: 'Tech', + icon: `` + } + ] + categories.forEach(({ title, icon }) => frag.append(createElement('a', { + attributes: { href: `#/explore?type=category&query=${title.toLowerCase()}` }, + className: 'category interact', + innerHTML: `${icon}${title}`, }))) getRef('news_categories_list').innerHTML = '' getRef('news_categories_list').append(frag) - const arrOfArticles = getArrayOfObj(floGlobals.appObjects.articles) + const arrOfArticles = getArrayOfObj(floGlobals.appObjects.rmTimes.articles) // Render trending article card let sortedByVotes = arrOfArticles.sort((a, b) => b.votes - a.votes) sortedByVotes.slice(0, 3).forEach(articleDetail => frag.append(render.trendingArticleCard(articleDetail))) @@ -1128,7 +1148,7 @@ const openedArticles = {} async function renderArticle(articleID, firstLoad = true) { const allArticles = await compactIDB.readData('appObjects', 'articlesContent') - const { title, published, readTime, contributors } = floGlobals.appObjects.articles[articleID] + const { title, published, readTime, contributors } = floGlobals.appObjects.rmTimes.articles[articleID] getRef('article_title').textContent = title getRef('published_time').textContent = getFormattedTime(published, 'date-only') getRef('reading_time').textContent = `${readTime} Min read` @@ -1136,24 +1156,24 @@ const frag = document.createDocumentFragment() contributors.forEach(id => { frag.append(createElement('a', { - textContent: floGlobals.appObjects.articleWriters.hasOwnProperty(id) ? floGlobals.appObjects.articleWriters[id].name : id, + textContent: floGlobals.appObjects.rmTimes.articleWriters.hasOwnProperty(id) ? floGlobals.appObjects.rmTimes.articleWriters[id].name : id, className: 'contributor', attributes: { 'href': `#/writer?id=${id}` } })) }) getRef('article_contributors').innerHTML = '' getRef('article_contributors').append(frag) - getRef('like_count').textContent = floGlobals.appObjects.articles[articleID].votes + getRef('like_count').textContent = floGlobals.appObjects.rmTimes.articles[articleID].votes // implement live voting if (!openedArticles.hasOwnProperty(articleID)) { floCloudAPI.requestGeneralData(`article_${articleID}_votes`, { - lowerVectorClock: floGlobals.appObjects.articles[articleID].lastCountedVC + 1, + lowerVectorClock: floGlobals.appObjects.rmTimes.articles[articleID].lastCountedVC + 1, callback: (allVotes, e) => { if (firstLoad) { for (const vote in allVotes) { - floGlobals.appObjects.articles[articleID].votes += allVotes[vote].message.voteCount || 1 + floGlobals.appObjects.rmTimes.articles[articleID].votes += allVotes[vote].message.voteCount || 1 } - getRef('like_count').textContent = floGlobals.appObjects.articles[articleID].votes + getRef('like_count').textContent = floGlobals.appObjects.rmTimes.articles[articleID].votes } else { for (const msg in allVotes) { animateLikeCount(allVotes[msg].message.voteCount, articleID) @@ -1164,14 +1184,14 @@ }) openedArticles[articleID] = true } else { - getRef('like_count').textContent = floGlobals.appObjects.articles[articleID].votes + getRef('like_count').textContent = floGlobals.appObjects.rmTimes.articles[articleID].votes } } function renderExplorePage(params) { const { type, query } = params const frag = document.createDocumentFragment() - const sortedByTime = getArrayOfObj(floGlobals.appObjects.articles).sort((a, b) => b.published - a.published) + const sortedByTime = getArrayOfObj(floGlobals.appObjects.rmTimes.articles).sort((a, b) => b.published - a.published) if (type === 'recent') { sortedByTime.forEach(articleDetail => frag.append(render.articleCard(articleDetail))) } else { @@ -1185,8 +1205,8 @@ getRef('query_results_list').append(frag) } function renderWriterPage(params) { - if (floGlobals.appObjects.articleWriters.hasOwnProperty(params.id)) { - const { name, bio } = floGlobals.appObjects.articleWriters[params.id] + if (floGlobals.appObjects.rmTimes.articleWriters.hasOwnProperty(params.id)) { + const { name, bio } = floGlobals.appObjects.rmTimes.articleWriters[params.id] getRef('writer_initials').textContent = name[0] getRef('writer_name').textContent = name getRef('writer_bio').textContent = bio @@ -1197,7 +1217,7 @@ } getRef('writer_id').value = params.id const frag = document.createDocumentFragment() - const sortedByTime = getArrayOfObj(floGlobals.appObjects.articles).sort((a, b) => b.published - a.published) + const sortedByTime = getArrayOfObj(floGlobals.appObjects.rmTimes.articles).sort((a, b) => b.published - a.published) const options = { keys: ['contributors'], threshold: 0 } const fuse = new Fuse(sortedByTime, options) const searchResult = fuse.search(params.id).map(v => v.item) @@ -1271,7 +1291,7 @@ keys: ['title', 'tags', 'category'], threshold: 0.3 } - const fuse = new Fuse(getArrayOfObj(floGlobals.appObjects.articles).sort((a, b) => b.published - a.published), options) + const fuse = new Fuse(getArrayOfObj(floGlobals.appObjects.rmTimes.articles).sort((a, b) => b.published - a.published), options) const searchResult = fuse.search(searchKey).map(v => v.item) getRef('search_suggestions').innerHTML = '' if (searchResult.length) { @@ -1420,18 +1440,18 @@ duration: 150, ease: 'easing', } - floGlobals.appObjects.articles[articleID].votes += voteCount + floGlobals.appObjects.rmTimes.articles[articleID].votes += voteCount getRef('like_count').animate(slideOutUp, animOptions) .onfinish = (e) => { e.target.cancel() } const tempCount = document.createElement('div') tempCount.classList.add('temp-count') - tempCount.textContent = floGlobals.appObjects.articles[articleID].votes + tempCount.textContent = floGlobals.appObjects.rmTimes.articles[articleID].votes getRef('like_count').after(tempCount) tempCount.animate(slideInUp, animOptions) .onfinish = () => { - getRef('like_count').textContent = floGlobals.appObjects.articles[articleID].votes + getRef('like_count').textContent = floGlobals.appObjects.rmTimes.articles[articleID].votes tempCount.remove() } } @@ -1539,18 +1559,18 @@ if (card) frag.prepend(card) } - floCloudAPI.updateObjectData('publishedVc') + floCloudAPI.updateObjectData('adminData') getRef('publishing_requests').innerHTML = '' getRef('publishing_requests').append(frag) - for (const articleKey in floGlobals.appObjects.articles) { + for (const articleKey in floGlobals.appObjects.rmTimes.articles) { const card = render.articleRow(articleKey) frag.prepend(card) } getRef('article_analytics').innerHTML = '' getRef('article_analytics').append(frag) - for (const articleKey in floGlobals.appObjects.articleWriters) { + for (const articleKey in floGlobals.appObjects.rmTimes.articleWriters) { const card = render.writerCard(articleKey) frag.prepend(card) } @@ -1560,33 +1580,32 @@ function publishArticle(vc) { const { message: { articleID, content, contributors, title, readTime }, vectorClock } = floGlobals.generalData[`publishing_requests|${floGlobals.adminID}|${floGlobals.application}`][vc]; - const isPublished = floGlobals.appObjects['articles'].hasOwnProperty(articleID) + const isPublished = floGlobals.appObjects.rmTimes.articles.hasOwnProperty(articleID) getConfirmation(`${isPublished ? 'Update' : 'Publish'} article?`).then(res => { if (res) { const { title, category, summary, published, tags, contributors } = getArticleMetaData() - floGlobals.appObjects['publishedVc'][vectorClock] = true + floGlobals.appObjects.adminData.publishedVc[vectorClock] = true floGlobals.appObjects.articlesContent[articleID] = content if (isPublished) { - floGlobals.appObjects['articles'][articleID]['updated'] = Date.now(); + floGlobals.appObjects.rmTimes.articles[articleID]['updated'] = Date.now(); } else { - floGlobals.appObjects.articles[articleID] = { + floGlobals.appObjects.rmTimes.articles[articleID] = { published: Date.now(), votes: 0, lastCountedVC: '' } - floGlobals.appObjects.articleVotes[articleID] = { votes: {} } + floGlobals.appObjects.adminData.articleVotes[articleID] = { votes: {} } } - floGlobals.appObjects['articles'][articleID].category = category - floGlobals.appObjects['articles'][articleID].contributors = contributors - floGlobals.appObjects['articles'][articleID].title = title - floGlobals.appObjects['articles'][articleID].tags = tags - floGlobals.appObjects['articles'][articleID].readTime = readTime - floGlobals.appObjects['articles'][articleID].summary = summary + floGlobals.appObjects.rmTimes.articles[articleID].category = category + floGlobals.appObjects.rmTimes.articles[articleID].contributors = contributors + floGlobals.appObjects.rmTimes.articles[articleID].title = title + floGlobals.appObjects.rmTimes.articles[articleID].tags = tags + floGlobals.appObjects.rmTimes.articles[articleID].readTime = readTime + floGlobals.appObjects.rmTimes.articles[articleID].summary = summary Promise.all([ - floCloudAPI.updateObjectData('articles'), - floCloudAPI.updateObjectData('publishedVc'), + floCloudAPI.updateObjectData('rmTimes'), + floCloudAPI.updateObjectData('adminData'), floCloudAPI.updateObjectData('articlesContent'), - floCloudAPI.updateObjectData('articleVotes'), ]).then(() => { notify(`${isPublished ? 'Updated' : 'Published'} article`, 'success') document.querySelector(`.request-card[data-vc="${vc}"]`).remove() @@ -1601,9 +1620,9 @@ const button = e.target.closest('.publish-button'); const vc = button.closest('.request-card').dataset.vc; const { message: { articleID, title, contributors } } = floGlobals.generalData[`publishing_requests|${floGlobals.adminID}|${floGlobals.application}`][vc] - const isPublished = floGlobals.appObjects['articles'].hasOwnProperty(articleID) + const isPublished = floGlobals.appObjects.rmTimes.articles.hasOwnProperty(articleID) if (isPublished) - setArticleMetaData(floGlobals.appObjects.articles[articleID]) + setArticleMetaData(floGlobals.appObjects.rmTimes.articles[articleID]) else setArticleMetaData({ title, contributors }) floGlobals.subAdminData = { @@ -1651,7 +1670,7 @@ if (e.target.closest('.edit-article')) { const button = e.target.closest('.edit-article'); const articleID = button.dataset.articleId; - setArticleMetaData(floGlobals.appObjects.articles[articleID]) + setArticleMetaData(floGlobals.appObjects.rmTimes.articles[articleID]) floGlobals.subAdminData = { actionType: 'analytics', articleID, @@ -1666,14 +1685,14 @@ getConfirmation('Update article meta data?').then(res => { if (res) { const { title, category, summary, published, tags, contributors } = getArticleMetaData() - floGlobals.appObjects['articles'][articleID].category = category - floGlobals.appObjects['articles'][articleID].title = title - floGlobals.appObjects['articles'][articleID].tags = tags - floGlobals.appObjects['articles'][articleID].summary = summary - floGlobals.appObjects['articles'][articleID].contributors = contributors + floGlobals.appObjects.rmTimes.articles[articleID].category = category + floGlobals.appObjects.rmTimes.articles[articleID].title = title + floGlobals.appObjects.rmTimes.articles[articleID].tags = tags + floGlobals.appObjects.rmTimes.articles[articleID].summary = summary + floGlobals.appObjects.rmTimes.articles[articleID].contributors = contributors Promise.all([ - floCloudAPI.updateObjectData('articles'), - floCloudAPI.updateObjectData('publishedVc'), + floCloudAPI.updateObjectData('rmTimes'), + floCloudAPI.updateObjectData('adminData'), ]).then(() => { notify(`Updated article meta data`, 'success') hidePopup() @@ -1691,14 +1710,14 @@ } async function calculateVotes() { - await floCloudAPI.requestObjectData('articleVotes') + await floCloudAPI.requestObjectData('adminData') const articlesVotesProm = [] const articleIDs = [] - for (const articleKey in floGlobals.appObjects.articles) { - if (floGlobals.appObjects.articleVotes.hasOwnProperty(articleKey) && floGlobals.appObjects.articles[articleKey].lastCountedVC !== '') { + for (const articleKey in floGlobals.appObjects.rmTimes.articles) { + if (floGlobals.appObjects.adminData.articleVotes.hasOwnProperty(articleKey) && floGlobals.appObjects.rmTimes.articles[articleKey].lastCountedVC !== '') { articlesVotesProm.push( floCloudAPI.requestGeneralData(`article_${articleKey}_votes`, { - lowerVectorClock: floGlobals.appObjects.articles[articleKey].lastCountedVC + 1 + lowerVectorClock: floGlobals.appObjects.rmTimes.articles[articleKey].lastCountedVC + 1 }) ) } else { @@ -1710,31 +1729,31 @@ } Promise.all(articlesVotesProm).then(res => { res.forEach((articleVotes, index) => { - if (!floGlobals.appObjects.articleVotes.hasOwnProperty(articleIDs[index])) { - floGlobals.appObjects.articleVotes[articleIDs[index]].votes = {} + if (!floGlobals.appObjects.adminData.articleVotes.hasOwnProperty(articleIDs[index])) { + floGlobals.appObjects.adminData.articleVotes[articleIDs[index]].votes = {} } - if (floGlobals.appObjects.articles[articleIDs[index]].lastCountedVC === '') { + if (floGlobals.appObjects.rmTimes.articles[articleIDs[index]].lastCountedVC === '') { articleVotes = floGlobals.generalData[`article_${articleIDs[index]}_votes|${floGlobals.adminID}|${floGlobals.application}`] } for (const voteKey in articleVotes) { const { senderID, message: { voteCount }, type, vectorClock, time } = articleVotes[voteKey] - const { votes } = floGlobals.appObjects.articleVotes[articleIDs[index]]; + const { votes } = floGlobals.appObjects.adminData.articleVotes[articleIDs[index]]; if (votes[senderID]) { - floGlobals.appObjects.articleVotes[articleIDs[index]].votes[senderID] += voteCount || 1 + floGlobals.appObjects.adminData.articleVotes[articleIDs[index]].votes[senderID] += voteCount || 1 } else { - floGlobals.appObjects.articleVotes[articleIDs[index]].votes[senderID] = voteCount || 1 + floGlobals.appObjects.adminData.articleVotes[articleIDs[index]].votes[senderID] = voteCount || 1 } - floGlobals.appObjects.articles[articleIDs[index]].lastCountedVC = vectorClock + floGlobals.appObjects.rmTimes.articles[articleIDs[index]].lastCountedVC = vectorClock } let totalArticleVotes = 0 - for (const voter in floGlobals.appObjects.articleVotes[articleIDs[index]].votes) { - totalArticleVotes += floGlobals.appObjects.articleVotes[articleIDs[index]].votes[voter] + for (const voter in floGlobals.appObjects.adminData.articleVotes[articleIDs[index]].votes) { + totalArticleVotes += floGlobals.appObjects.adminData.articleVotes[articleIDs[index]].votes[voter] } - floGlobals.appObjects.articles[articleIDs[index]].votes = totalArticleVotes + floGlobals.appObjects.rmTimes.articles[articleIDs[index]].votes = totalArticleVotes }) Promise.all([ - floCloudAPI.updateObjectData('articles'), - floCloudAPI.updateObjectData('articleVotes') + floCloudAPI.updateObjectData('rmTimes'), + floCloudAPI.updateObjectData('adminData') ]) .then(() => { console.log('calculated votes') @@ -1750,7 +1769,7 @@ function setWriterDetails(writerID) { console.log(writerID) - const { name, bio } = floGlobals.appObjects.articleWriters[writerID] + const { name, bio } = floGlobals.appObjects.rmTimes.articleWriters[writerID] getRef('get_writer_id').value = writerID getRef('get_writer_name').value = name getRef('get_writer_bio').value = bio @@ -1786,9 +1805,9 @@ const writerID = button.closest('.writer-card').dataset.writerId; getConfirmation('Delete this writer?').then(res => { if (res) { - delete floGlobals.appObjects.articleWriters[writerID] + delete floGlobals.appObjects.rmTimes.articleWriters[writerID] button.closest('.writer-card').remove() - floCloudAPI.updateObjectData('articleWriters').then(() => { + floCloudAPI.updateObjectData('rmTimes').then(() => { notify('Writer deleted', 'success') }).catch(error => console.error(error)) } @@ -1798,17 +1817,17 @@ function saveWriter() { const { floID, name, bio } = getWriterDetails() - if (floGlobals.appObjects.articleWriters.hasOwnProperty(floID)) { - const { name: oldName, bio: oldBio } = floGlobals.appObjects.articleWriters[floID] + if (floGlobals.appObjects.rmTimes.articleWriters.hasOwnProperty(floID)) { + const { name: oldName, bio: oldBio } = floGlobals.appObjects.rmTimes.articleWriters[floID] if (name !== oldName || bio !== oldBio) { - floGlobals.appObjects.articleWriters[floID].name = name - floGlobals.appObjects.articleWriters[floID].bio = bio + floGlobals.appObjects.rmTimes.articleWriters[floID].name = name + floGlobals.appObjects.rmTimes.articleWriters[floID].bio = bio const writerCard = getRef('writers_list').querySelector(`.writer-card[data-writer-id="${floID}"]`) if (writerCard) { writerCard.querySelector('.writer-name').textContent = name writerCard.querySelector('.writer-bio').textContent = bio } - floCloudAPI.updateObjectData('articleWriters').then(() => { + floCloudAPI.updateObjectData('rmTimes').then(() => { notify('Writer details updated', 'success') hidePopup() }).catch(error => console.error(error)) @@ -1816,8 +1835,8 @@ notify('Details are not changed', 'error') } } else { - floGlobals.appObjects.articleWriters[floID] = { name, bio } - floCloudAPI.updateObjectData('articleWriters').then(() => { + floGlobals.appObjects.rmTimes.articleWriters[floID] = { name, bio } + floCloudAPI.updateObjectData('rmTimes').then(() => { getRef('writers_list').append(render.writerCard(floID)) notify('Added writer details', 'success') hidePopup()