Added sign in/up

This commit is contained in:
sairaj mote 2022-01-23 16:26:24 +05:30
parent 1b059b5c24
commit 434e7cf86b
4 changed files with 258 additions and 128 deletions

View File

@ -166,7 +166,7 @@ ul {
list-style: none;
}
.hide-completely {
.hide {
display: none !important;
}
@ -810,6 +810,18 @@ theme-toggle {
margin-left: 0.4rem;
}
#go_to_top {
position: fixed;
z-index: 2;
box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.2);
border-radius: 2rem;
bottom: 0;
right: 0;
margin: 1.5rem;
padding: 0.8rem;
background-color: var(--foreground-color);
}
footer {
padding: 3rem 1.5rem;
justify-items: center;
@ -864,7 +876,6 @@ footer {
#preview_popup h1,
#article h1 {
font-size: 1.4rem;
margin-bottom: 1rem;
}
#preview_popup h3:not(:first-of-type),
#article h3:not(:first-of-type) {

2
css/main.min.css vendored

File diff suppressed because one or more lines are too long

View File

@ -159,7 +159,7 @@ ul {
list-style: none;
}
.hide-completely {
.hide {
display: none !important;
}
@ -782,6 +782,18 @@ theme-toggle {
margin-left: 0.4rem;
}
#go_to_top {
position: fixed;
z-index: 2;
box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.2);
border-radius: 2rem;
bottom: 0;
right: 0;
margin: 1.5rem;
padding: 0.8rem;
background-color: var(--foreground-color);
}
footer {
padding: 3rem 1.5rem;
justify-items: center;
@ -834,7 +846,6 @@ footer {
#article {
h1 {
font-size: 1.4rem;
margin-bottom: 1rem;
}
h3:not(:first-of-type) {

View File

@ -59,89 +59,6 @@
<sm-button variant="no-outline" class="submit-btn">OK</sm-button>
</div>
</sm-popup>
<article id="landing" class="page page-layout hide-completely">
<header class="flex space-between">
<div class="logo">
<svg class="main-logo" viewBox="0 0 27.25 32">
<title>RanchiMall</title>
<path
d="M27.14,30.86c-.74-2.48-3-4.36-8.25-6.94a20,20,0,0,1-4.2-2.49,6,6,0,0,1-1.25-1.67,4,4,0,0,1,0-2.26c.37-1.08.79-1.57,3.89-4.55a11.66,11.66,0,0,0,3.34-4.67,6.54,6.54,0,0,0,.05-2.82C20,3.6,18.58,2,16.16.49c-.89-.56-1.29-.64-1.3-.24a3,3,0,0,1-.3.72l-.3.55L13.42.94C13,.62,12.4.26,12.19.15c-.4-.2-.73-.18-.72.05a9.39,9.39,0,0,1-.61,1.33s-.14,0-.27-.13C8.76.09,8-.27,8,.23A11.73,11.73,0,0,1,6.76,2.6C4.81,5.87,2.83,7.49.77,7.49c-.89,0-.88,0-.61,1,.22.85.33.92,1.09.69A5.29,5.29,0,0,0,3,8.33c.23-.17.45-.29.49-.26a2,2,0,0,1,.22.63A1.31,1.31,0,0,0,4,9.34a5.62,5.62,0,0,0,2.27-.87L7,8l.13.55c.19.74.32.82,1,.65a7.06,7.06,0,0,0,3.46-2.47l.6-.71-.06.64c-.17,1.63-1.3,3.42-3.39,5.42L6.73,14c-3.21,3.06-3,5.59.6,8a46.77,46.77,0,0,0,4.6,2.41c.28.13,1,.52,1.59.87,3.31,2,4.95,3.92,4.95,5.93a2.49,2.49,0,0,0,.07.77h0c.09.09,0,.1.9-.14a2.61,2.61,0,0,0,.83-.32,3.69,3.69,0,0,0-.55-1.83A11.14,11.14,0,0,0,17,26.81a35.7,35.7,0,0,0-5.1-2.91C9.37,22.64,8.38,22,7.52,21.17a3.53,3.53,0,0,1-1.18-2.48c0-1.38.71-2.58,2.5-4.23,2.84-2.6,3.92-3.91,4.67-5.65a3.64,3.64,0,0,0,.42-2A3.37,3.37,0,0,0,13.61,5l-.32-.74.29-.48c.17-.27.37-.63.46-.8l.15-.3.44.64a5.92,5.92,0,0,1,1,2.81,5.86,5.86,0,0,1-.42,1.94c0,.12-.12.3-.15.4a9.49,9.49,0,0,1-.67,1.1,28,28,0,0,1-4,4.29C8.62,15.49,8.05,16.44,8,17.78a3.28,3.28,0,0,0,1.11,2.76c.95,1,2.07,1.74,5.25,3.32,3.64,1.82,5.22,2.9,6.41,4.38A4.78,4.78,0,0,1,21.94,31a3.21,3.21,0,0,0,.14.92,1.06,1.06,0,0,0,.43-.05l.83-.22.46-.12-.06-.46c-.21-1.53-1.62-3.25-3.94-4.8a37.57,37.57,0,0,0-5.22-2.82A13.36,13.36,0,0,1,11,21.19a3.36,3.36,0,0,1-.8-4.19c.41-.85.83-1.31,3.77-4.15,2.39-2.31,3.43-4.13,3.43-6a5.85,5.85,0,0,0-2.08-4.29c-.23-.21-.44-.43-.65-.65A2.5,2.5,0,0,1,15.27.69a10.6,10.6,0,0,1,2.91,2.78A4.16,4.16,0,0,1,19,6.16a4.91,4.91,0,0,1-.87,3c-.71,1.22-1.26,1.82-4.27,4.67a9.47,9.47,0,0,0-2.07,2.6,2.76,2.76,0,0,0-.33,1.54,2.76,2.76,0,0,0,.29,1.47c.57,1.21,2.23,2.55,4.65,3.73a32.41,32.41,0,0,1,5.82,3.24c2.16,1.6,3.2,3.16,3.2,4.8a1.94,1.94,0,0,0,.09.76,4.54,4.54,0,0,0,1.66-.4C27.29,31.42,27.29,31.37,27.14,30.86ZM6.1,7h0a3.77,3.77,0,0,1-1.46.45L4,7.51l.68-.83a25.09,25.09,0,0,0,3-4.82A12,12,0,0,1,8.28.76c.11-.12.77.32,1.53,1l.63.58-.57.84A10.34,10.34,0,0,1,6.1,7Zm5.71-1.78A9.77,9.77,0,0,1,9.24,7.18h0a5.25,5.25,0,0,1-1.17.28l-.58,0,.65-.78a21.29,21.29,0,0,0,2.1-3.12c.22-.41.42-.76.44-.79s.5.43.9,1.24L12,5ZM13.41,3a2.84,2.84,0,0,1-.45.64,11,11,0,0,1-.9-.91l-.84-.9.19-.45c.34-.79.39-.8,1-.31A9.4,9.4,0,0,1,13.8,2.33q-.18.34-.39.69Z" />
</svg>
<div class="grid">
<h4>RM Times</h4>
</div>
</div>
<div class="flex gap-0-5">
<a href="#/sign_up" class="button">Sign up</a>
<a href="#/sign_in" class="button button--primary">Sign in</a>
</div>
</header>
<section class="grid justify-center">
<div class="grid gap-0-5">
<h1 class="h1">Create. Collaborate. <br>Publish.</h1>
<p>Write something great... <strong>Together</strong>.</p>
</div>
</section>
</article>
<article id="sign_in" class="page page-layout hide-completely">
<header>
<div class="logo">
<svg class="main-logo" viewBox="0 0 27.25 32">
<title>RanchiMall</title>
<path
d="M27.14,30.86c-.74-2.48-3-4.36-8.25-6.94a20,20,0,0,1-4.2-2.49,6,6,0,0,1-1.25-1.67,4,4,0,0,1,0-2.26c.37-1.08.79-1.57,3.89-4.55a11.66,11.66,0,0,0,3.34-4.67,6.54,6.54,0,0,0,.05-2.82C20,3.6,18.58,2,16.16.49c-.89-.56-1.29-.64-1.3-.24a3,3,0,0,1-.3.72l-.3.55L13.42.94C13,.62,12.4.26,12.19.15c-.4-.2-.73-.18-.72.05a9.39,9.39,0,0,1-.61,1.33s-.14,0-.27-.13C8.76.09,8-.27,8,.23A11.73,11.73,0,0,1,6.76,2.6C4.81,5.87,2.83,7.49.77,7.49c-.89,0-.88,0-.61,1,.22.85.33.92,1.09.69A5.29,5.29,0,0,0,3,8.33c.23-.17.45-.29.49-.26a2,2,0,0,1,.22.63A1.31,1.31,0,0,0,4,9.34a5.62,5.62,0,0,0,2.27-.87L7,8l.13.55c.19.74.32.82,1,.65a7.06,7.06,0,0,0,3.46-2.47l.6-.71-.06.64c-.17,1.63-1.3,3.42-3.39,5.42L6.73,14c-3.21,3.06-3,5.59.6,8a46.77,46.77,0,0,0,4.6,2.41c.28.13,1,.52,1.59.87,3.31,2,4.95,3.92,4.95,5.93a2.49,2.49,0,0,0,.07.77h0c.09.09,0,.1.9-.14a2.61,2.61,0,0,0,.83-.32,3.69,3.69,0,0,0-.55-1.83A11.14,11.14,0,0,0,17,26.81a35.7,35.7,0,0,0-5.1-2.91C9.37,22.64,8.38,22,7.52,21.17a3.53,3.53,0,0,1-1.18-2.48c0-1.38.71-2.58,2.5-4.23,2.84-2.6,3.92-3.91,4.67-5.65a3.64,3.64,0,0,0,.42-2A3.37,3.37,0,0,0,13.61,5l-.32-.74.29-.48c.17-.27.37-.63.46-.8l.15-.3.44.64a5.92,5.92,0,0,1,1,2.81,5.86,5.86,0,0,1-.42,1.94c0,.12-.12.3-.15.4a9.49,9.49,0,0,1-.67,1.1,28,28,0,0,1-4,4.29C8.62,15.49,8.05,16.44,8,17.78a3.28,3.28,0,0,0,1.11,2.76c.95,1,2.07,1.74,5.25,3.32,3.64,1.82,5.22,2.9,6.41,4.38A4.78,4.78,0,0,1,21.94,31a3.21,3.21,0,0,0,.14.92,1.06,1.06,0,0,0,.43-.05l.83-.22.46-.12-.06-.46c-.21-1.53-1.62-3.25-3.94-4.8a37.57,37.57,0,0,0-5.22-2.82A13.36,13.36,0,0,1,11,21.19a3.36,3.36,0,0,1-.8-4.19c.41-.85.83-1.31,3.77-4.15,2.39-2.31,3.43-4.13,3.43-6a5.85,5.85,0,0,0-2.08-4.29c-.23-.21-.44-.43-.65-.65A2.5,2.5,0,0,1,15.27.69a10.6,10.6,0,0,1,2.91,2.78A4.16,4.16,0,0,1,19,6.16a4.91,4.91,0,0,1-.87,3c-.71,1.22-1.26,1.82-4.27,4.67a9.47,9.47,0,0,0-2.07,2.6,2.76,2.76,0,0,0-.33,1.54,2.76,2.76,0,0,0,.29,1.47c.57,1.21,2.23,2.55,4.65,3.73a32.41,32.41,0,0,1,5.82,3.24c2.16,1.6,3.2,3.16,3.2,4.8a1.94,1.94,0,0,0,.09.76,4.54,4.54,0,0,0,1.66-.4C27.29,31.42,27.29,31.37,27.14,30.86ZM6.1,7h0a3.77,3.77,0,0,1-1.46.45L4,7.51l.68-.83a25.09,25.09,0,0,0,3-4.82A12,12,0,0,1,8.28.76c.11-.12.77.32,1.53,1l.63.58-.57.84A10.34,10.34,0,0,1,6.1,7Zm5.71-1.78A9.77,9.77,0,0,1,9.24,7.18h0a5.25,5.25,0,0,1-1.17.28l-.58,0,.65-.78a21.29,21.29,0,0,0,2.1-3.12c.22-.41.42-.76.44-.79s.5.43.9,1.24L12,5ZM13.41,3a2.84,2.84,0,0,1-.45.64,11,11,0,0,1-.9-.91l-.84-.9.19-.45c.34-.79.39-.8,1-.31A9.4,9.4,0,0,1,13.8,2.33q-.18.34-.39.69Z" />
</svg>
<div class="grid">
<h4>RM Times</h4>
</div>
</div>
</header>
<section>
<h1 class="h2">Sign In</h1>
<p>Welcome back, glad to see you again</p>
<sm-form>
<sm-input id="private_key_field" type="password" placeholder="FLO private key"
error-text="Private key is invalid" data-private-key required></sm-input>
<sm-button id="sign_in_button" variant="primary" disabled>Sign In</sm-button>
</sm-form>
<p>
New here? <a href="#/sign_up">get your FLO login credentials</a>
</p>
</section>
</article>
<article id="sign_up" class="page page-layout hide-completely">
<header>
<div class="logo">
<svg class="main-logo" viewBox="0 0 27.25 32">
<title>RanchiMall</title>
<path
d="M27.14,30.86c-.74-2.48-3-4.36-8.25-6.94a20,20,0,0,1-4.2-2.49,6,6,0,0,1-1.25-1.67,4,4,0,0,1,0-2.26c.37-1.08.79-1.57,3.89-4.55a11.66,11.66,0,0,0,3.34-4.67,6.54,6.54,0,0,0,.05-2.82C20,3.6,18.58,2,16.16.49c-.89-.56-1.29-.64-1.3-.24a3,3,0,0,1-.3.72l-.3.55L13.42.94C13,.62,12.4.26,12.19.15c-.4-.2-.73-.18-.72.05a9.39,9.39,0,0,1-.61,1.33s-.14,0-.27-.13C8.76.09,8-.27,8,.23A11.73,11.73,0,0,1,6.76,2.6C4.81,5.87,2.83,7.49.77,7.49c-.89,0-.88,0-.61,1,.22.85.33.92,1.09.69A5.29,5.29,0,0,0,3,8.33c.23-.17.45-.29.49-.26a2,2,0,0,1,.22.63A1.31,1.31,0,0,0,4,9.34a5.62,5.62,0,0,0,2.27-.87L7,8l.13.55c.19.74.32.82,1,.65a7.06,7.06,0,0,0,3.46-2.47l.6-.71-.06.64c-.17,1.63-1.3,3.42-3.39,5.42L6.73,14c-3.21,3.06-3,5.59.6,8a46.77,46.77,0,0,0,4.6,2.41c.28.13,1,.52,1.59.87,3.31,2,4.95,3.92,4.95,5.93a2.49,2.49,0,0,0,.07.77h0c.09.09,0,.1.9-.14a2.61,2.61,0,0,0,.83-.32,3.69,3.69,0,0,0-.55-1.83A11.14,11.14,0,0,0,17,26.81a35.7,35.7,0,0,0-5.1-2.91C9.37,22.64,8.38,22,7.52,21.17a3.53,3.53,0,0,1-1.18-2.48c0-1.38.71-2.58,2.5-4.23,2.84-2.6,3.92-3.91,4.67-5.65a3.64,3.64,0,0,0,.42-2A3.37,3.37,0,0,0,13.61,5l-.32-.74.29-.48c.17-.27.37-.63.46-.8l.15-.3.44.64a5.92,5.92,0,0,1,1,2.81,5.86,5.86,0,0,1-.42,1.94c0,.12-.12.3-.15.4a9.49,9.49,0,0,1-.67,1.1,28,28,0,0,1-4,4.29C8.62,15.49,8.05,16.44,8,17.78a3.28,3.28,0,0,0,1.11,2.76c.95,1,2.07,1.74,5.25,3.32,3.64,1.82,5.22,2.9,6.41,4.38A4.78,4.78,0,0,1,21.94,31a3.21,3.21,0,0,0,.14.92,1.06,1.06,0,0,0,.43-.05l.83-.22.46-.12-.06-.46c-.21-1.53-1.62-3.25-3.94-4.8a37.57,37.57,0,0,0-5.22-2.82A13.36,13.36,0,0,1,11,21.19a3.36,3.36,0,0,1-.8-4.19c.41-.85.83-1.31,3.77-4.15,2.39-2.31,3.43-4.13,3.43-6a5.85,5.85,0,0,0-2.08-4.29c-.23-.21-.44-.43-.65-.65A2.5,2.5,0,0,1,15.27.69a10.6,10.6,0,0,1,2.91,2.78A4.16,4.16,0,0,1,19,6.16a4.91,4.91,0,0,1-.87,3c-.71,1.22-1.26,1.82-4.27,4.67a9.47,9.47,0,0,0-2.07,2.6,2.76,2.76,0,0,0-.33,1.54,2.76,2.76,0,0,0,.29,1.47c.57,1.21,2.23,2.55,4.65,3.73a32.41,32.41,0,0,1,5.82,3.24c2.16,1.6,3.2,3.16,3.2,4.8a1.94,1.94,0,0,0,.09.76,4.54,4.54,0,0,0,1.66-.4C27.29,31.42,27.29,31.37,27.14,30.86ZM6.1,7h0a3.77,3.77,0,0,1-1.46.45L4,7.51l.68-.83a25.09,25.09,0,0,0,3-4.82A12,12,0,0,1,8.28.76c.11-.12.77.32,1.53,1l.63.58-.57.84A10.34,10.34,0,0,1,6.1,7Zm5.71-1.78A9.77,9.77,0,0,1,9.24,7.18h0a5.25,5.25,0,0,1-1.17.28l-.58,0,.65-.78a21.29,21.29,0,0,0,2.1-3.12c.22-.41.42-.76.44-.79s.5.43.9,1.24L12,5ZM13.41,3a2.84,2.84,0,0,1-.45.64,11,11,0,0,1-.9-.91l-.84-.9.19-.45c.34-.79.39-.8,1-.31A9.4,9.4,0,0,1,13.8,2.33q-.18.34-.39.69Z" />
</svg>
<div class="grid">
<h4>RM Times</h4>
</div>
</div>
</header>
<section class="grid">
<h1 class="h2">FLO credentials</h1>
<p>Get your FLO credentials to use RanchiMall CC and all RanchiMall FLO apps. </p>
<div class="grid gap-1-5 card">
<div class="grid gap-0-5">
<h5>FLO ID</h5>
<sm-copy id="generated_flo_id"></sm-copy>
</div>
<div class="grid gap-0-5">
<h5>Private key</h5>
<sm-copy id="generated_private_key"></sm-copy>
</div>
</div>
<sm-button id="sign_up_button" variant="primary">Sign in with these credentials</sm-button>
<strong class="warning">
Keep your private key secure and don't share with anyone.
Once lost there is no way to recover private key.
</strong>
</section>
</article>
<article id="loading" class="page page-layout">
<div id="loader_container">
<svg id="loader" viewBox="0 0 112 256" xmlns="http://www.w3.org/2000/svg">
@ -183,7 +100,7 @@
d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z" />
</svg>
</button>
<div id="expanding_search" class="hide-completely">
<div id="expanding_search" class="hide">
<div class="flex align-center">
<button class="icon-only" onclick="toggleSearch()">
<svg class="icon" xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24"
@ -203,7 +120,7 @@
</sm-input>
</div>
</div>
<div id="search_suggestions" class="flex direction-column hide-completely"></div>
<div id="search_suggestions" class="flex direction-column hide"></div>
</div>
<a href="#/home" class="logo">
<svg class="main-logo" viewBox="0 0 27.25 32">
@ -214,7 +131,10 @@
<h4>RM TIMES</h4>
</a>
<theme-toggle></theme-toggle>
<button class="icon-only" onclick="showPopup('user_popup')" aria-label="User profile">
<button id="show_sign_in_button" onclick="showPopup('sign_in_popup')" class="button button--primary">Sign
In</button>
<button id="user_profile_button" class="icon-only hide" onclick="showPopup('user_popup')"
aria-label="User profile">
<svg xmlns="http://www.w3.org/2000/svg" class="icon" height="24px" viewBox="0 0 24 24" width="24px"
fill="#000000">
<path d="M0 0h24v24H0V0z" fill="none" />
@ -223,7 +143,7 @@
</svg>
</button>
</header>
<article id="main_page" class="page hide-completely">
<article id="main_page" class="page hide">
<section id="main_page__header" class="flex align-center">
<div id="news_categories_list" class="flex"></div>
</section>
@ -239,15 +159,16 @@
<ul id="latest_articles_list" class="grid"></ul>
</section>
</article>
<article id="explore" class="page page-layout hide-completely">
<article id="explore" class="page page-layout hide">
<section class="flex direction-column">
<h1 id="explore_heading">Explore</h1>
<div id="query_results_list" class="grid observe-empty-state"></div>
<p class="empty-state">No related articles</p>
</section>
</article>
<article id="article" class="page page-layout hide-completely">
<article id="article" class="page page-layout hide">
<section class="hero-section">
<h1 id="article_title"></h1>
<div class="flex space-between align-center">
<div class="flex align-center">
<time id="published_time"></time><span class="bullet-point"></span><span
@ -266,7 +187,6 @@
</svg>
</button>
</div>
<h1 id="article_title"></h1>
</section>
<section id="article_body" class="grid"></section>
<section>
@ -274,6 +194,13 @@
<div id="article_contributors" class="flex"></div>
<span>created with RanchiMall Content collaboration app</span>
</section>
<button id="go_to_top" class="hide" onclick="goToTop()">
<svg class="icon" xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px"
fill="#000000">
<path d="M0 0h24v24H0V0z" fill="none" />
<path d="M12 8l-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14l-6-6z" />
</svg>
</button>
<footer class="grid gap-1-5">
<h4>Loved the article? Don't forget leave a like.</h4>
<button id="upvote_button" class="button up-vote">
@ -287,7 +214,7 @@
</button>
</footer>
</article>
<article id="dashboard" class="page page-layout hide-completely">
<article id="dashboard" class="page page-layout hide">
<div class="flex justify-center align-center">
<strip-select id="section_selector">
<strip-option value="analytic" selected>Analytics</strip-option>
@ -298,12 +225,74 @@
<ul id="article_analytics" class="grid gap-1-5 observe-empty-state"></ul>
<p class="empty-state">No articles</p>
</section>
<section id="request_section" class="admin-section hide-completely">
<section id="request_section" class="admin-section hide">
<ul id="publishing_requests" class="grid gap-1-5 observe-empty-state"></ul>
<p class="empty-state">No requests</p>
</section>
</article>
</main>
<sm-popup id="sign_in_popup">
<header slot="header" class="popup__header">
<button class="popup__header__close" onclick="hidePopup()">
<svg class="icon" xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px"
fill="#000000">
<path d="M0 0h24v24H0V0z" fill="none" />
<path
d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z" />
</svg>
</button>
</header>
<section id="sign_in" class="">
<div class="grid gap-0-5">
<h3>Sign in</h3>
<p>Liking an article supports and encourages the creators.</p>
</div>
<sm-form>
<sm-input id="private_key_field" type="password" placeholder="FLO private key"
error-text="Private key is invalid" data-private-key required></sm-input>
<sm-button id="sign_in_button" variant="primary" disabled>Sign In</sm-button>
</sm-form>
<div class="grid gap-0-5">
<p>New here? Generate your FLO credentials below to continue</p>
<button class="button" onclick="generateCredentials()">
Get FLO credentials
<svg class="icon" xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px"
fill="#000000">
<path d="M0 0h24v24H0z" fill="none" />
<path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z" />
</svg>
</button>
</div>
</section>
<section id="sign_up" class="grid gap-1-5 hide">
<button class="justify-self-start" onclick="goToSignIn()">
<svg class="icon" xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px"
fill="#000000">
<path d="M0 0h24v24H0z" fill="none" />
<path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" />
</svg>
</button>
<div class="grid gap-0-5">
<h3>FLO credentials</h3>
<p>You can use FLO credentials with RanchiMall Times and all RanchiMall FLO apps. </p>
</div>
<div class="grid gap-1-5 card">
<div class="grid gap-0-5">
<h5>FLO ID</h5>
<sm-copy id="generated_flo_id"></sm-copy>
</div>
<div class="grid gap-0-5">
<h5>Private key</h5>
<sm-copy id="generated_private_key"></sm-copy>
</div>
</div>
<sm-button id="sign_up_button" variant="primary">Sign in with these credentials</sm-button>
<strong class="warning">
Keep your private key secure and don't share with anyone.
Once lost there is no way to recover private key.
</strong>
</section>
</sm-popup>
<sm-popup id="share_popup">
<header slot="header" class="popup__header">
<div class="flex align-center">
@ -660,7 +649,7 @@
window.addEventListener('hashchange', e => showPage(window.location.hash))
window.addEventListener("load", () => {
document.body.classList.remove('hide-completely')
document.body.classList.remove('hide')
document.querySelectorAll('sm-input[data-private-key]').forEach(input => input.customValidation = floCrypto.getPubKeyHex)
document.addEventListener('keyup', (e) => {
if (e.code === 'Escape') {
@ -733,26 +722,15 @@
pageId = targetPage
}
}
if (pageId === 'dashboard' && !floGlobals.isSubAdmin) {
pageId = 'home'
history.replaceState(null, null, '#/home')
}
if (searchParams) {
const urlSearchParams = new URLSearchParams('?' + searchParams);
params = Object.fromEntries(urlSearchParams.entries());
}
switch (pageId) {
case 'landing':
targetPage = 'landing'
break;
case 'sign_in':
setTimeout(() => {
getRef('private_key_field').focusIn()
}, 0);
targetPage = 'sign_in'
break;
case 'sign_up':
const { floID, privKey } = floCrypto.generateNewID()
getRef('generated_flo_id').value = floID
getRef('generated_private_key').value = privKey
targetPage = 'sign_up'
break;
case 'home':
case 'main_page':
targetPage = 'main_page'
@ -776,8 +754,15 @@
])
break;
}
document.querySelectorAll('.page').forEach(page => page.classList.add('hide-completely'))
getRef(targetPage).classList.remove('hide-completely')
if (pagesData.lastPage !== targetPage) {
if (targetPage === 'article') {
articleTitleObserver.observe(getRef('article_title'))
} else {
articleTitleObserver.disconnect()
}
}
document.querySelectorAll('.page').forEach(page => page.classList.add('hide'))
getRef(targetPage).classList.remove('hide')
if (pagesData.lastPage !== pageId) {
pagesData.lastPage = pageId
if (!pagesData.openedPages.includes(pageId)) {
@ -1028,7 +1013,7 @@
fill: 'forwards'
}
if (!isSearchOn) {
getRef('expanding_search').classList.remove('hide-completely')
getRef('expanding_search').classList.remove('hide')
getRef('search_articles').focusIn()
animateTo(getRef('expanding_search').children[0].children[0], [
{ opacity: 0 },
@ -1073,7 +1058,7 @@
duration: 100
})
.onfinish = () => {
getRef('expanding_search').classList.add('hide-completely');
getRef('expanding_search').classList.add('hide');
getRef('search_articles').value = ''
isSearchOn = false
}
@ -1091,7 +1076,7 @@
getRef('search_suggestions').innerHTML = ''
if (searchResult.length) {
const frag = document.createDocumentFragment()
searchResult.slice(0, 5).forEach((result) => {
searchResult.slice(0, 4).forEach((result) => {
const { uid, title } = result
console.log(result)
frag.append(createElement('a', {
@ -1101,7 +1086,7 @@
}))
})
getRef('search_suggestions').append(frag)
if (searchResult.length > 5) {
if (searchResult.length > 4) {
getRef('search_suggestions').append(createElement('a', {
textContent: 'See all results',
attributes: { href: `#/explore?type=search&query=${searchKey}` },
@ -1113,9 +1098,9 @@
innerHTML: `No articles related to <strong>${searchKey}</strong>`
}))
}
getRef('search_suggestions').classList.remove('hide-completely')
getRef('search_suggestions').classList.remove('hide')
} else {
getRef('search_suggestions').classList.add('hide-completely')
getRef('search_suggestions').classList.add('hide')
}
}, 100))
@ -1126,6 +1111,56 @@
toggleSearch()
}
})
const slideInLeft = [
{
opacity: 0,
transform: 'translateX(1rem)'
},
{
opacity: 1,
transform: 'translateX(0)'
}
]
const slideOutLeft = [
{
opacity: 1,
transform: 'translateX(0)'
},
{
opacity: 0,
transform: 'translateX(-1rem)'
},
]
const slideInRight = [
{
opacity: 0,
transform: 'translateX(-1rem)'
},
{
opacity: 1,
transform: 'translateX(0)'
}
]
const slideOutRight = [
{
opacity: 1,
transform: 'translateX(0)'
},
{
opacity: 0,
transform: 'translateX(1rem)'
},
]
const slideInDown = [
{
opacity: 0,
transform: 'translateY(-1rem)'
},
{
opacity: 1,
transform: 'translateY(0)'
},
]
const slideInUp = [
{
opacity: 0,
@ -1149,7 +1184,7 @@
let tempVoteCount = 0
getRef('upvote_button').addEventListener('mouseup', function () {
if (myFloID) {
if (typeof myFloID !== 'undefined') {
tempVoteCount++;
const animOptions = {
fill: 'forwards',
@ -1195,13 +1230,12 @@
}
}
getRef('upvote_button').addEventListener('click', debounce(() => {
if (myFloID) {
if (typeof myFloID !== 'undefined') {
floCloudAPI.sendGeneralData({
voteCount: tempVoteCount,
}, `article_${pagesData.params.articleID}_votes`)
.then(res => {
tempVoteCount = 0
console.log('up voted')
})
.catch(err => console.log(err))
} else {
@ -1221,6 +1255,76 @@
}
}
const articleTitleObserver = new IntersectionObserver(entries => {
const animOptions = {
easing: 'ease',
duration: 150
}
entries.forEach(entry => {
if (entry.isIntersecting) {
animateTo(getRef('go_to_top'), [
{
transform: 'none',
opacity: 1
},
{
transform: 'translateY(1rem)',
opacity: 0
},
], animOptions).onfinish = () => {
getRef('go_to_top').classList.add('hide')
}
} else {
getRef('go_to_top').classList.remove('hide')
animateTo(getRef('go_to_top'), [
{
transform: 'translateY(1rem)',
opacity: 0
},
{
opacity: 1,
transform: 'none',
},
], animOptions)
}
})
}, {
threshold: 0.8
})
function goToTop() {
window.scrollTo(0, 0)
}
function generateCredentials() {
const animOptions = {
fill: 'forwards',
duration: 150,
ease: 'easing',
}
const { floID, privKey } = floCrypto.generateNewID()
getRef('generated_flo_id').value = floID
getRef('generated_private_key').value = privKey
animateTo(getRef('sign_in'), slideOutLeft, animOptions).onfinish = () => {
getRef('sign_in').classList.add('hide')
getRef('sign_up').classList.remove('hide')
animateTo(getRef('sign_up'), slideInLeft, animOptions)
}
}
function goToSignIn() {
const animOptions = {
fill: 'forwards',
duration: 150,
ease: 'easing',
}
animateTo(getRef('sign_up'), slideOutRight, animOptions).onfinish = () => {
getRef('sign_in').classList.remove('hide')
animateTo(getRef('sign_in'), slideInRight, animOptions)
getRef('sign_up').classList.add('hide')
}
}
async function renderDashboard() {
const requests = floGlobals.generalData[`publishing_requests|${floGlobals.adminID}|${floGlobals.application}`]
const frag = document.createDocumentFragment()
@ -1424,8 +1528,8 @@
}
getRef('section_selector').addEventListener('change', e => {
document.querySelectorAll('.admin-section').forEach(section => section.classList.add('hide-completely'))
getRef(`${e.target.value}_section`).classList.remove('hide-completely')
document.querySelectorAll('.admin-section').forEach(section => section.classList.add('hide'))
getRef(`${e.target.value}_section`).classList.remove('hide')
})
@ -1434,10 +1538,12 @@
getRef('sign_in_button').onclick = () => {
resolve(getRef('private_key_field').value.trim())
getRef('private_key_field').value = ''
hidePopup()
}
getRef('sign_up_button').onclick = () => {
resolve(getRef('generated_private_key').value.trim())
getRef('generated_private_key').value = ''
hidePopup()
}
})
}
@ -1460,18 +1566,20 @@
floDapps.setCustomPrivKeyInput(getSignedIn)
floDapps.setMidStartup(getArticles)
floDapps.launchStartUp().then(async result => {
getRef('show_sign_in_button').classList.add('hide')
getRef('user_profile_button').classList.remove('hide')
getRef('user_flo_id').value = myFloID
floGlobals.isSubAdmin = floGlobals.subAdmins.includes(myFloID)
if (floGlobals.isSubAdmin) {
floGlobals.subAdminData = {}
getRef('publishing_requests').addEventListener('click', handleRequestClick);
getRef('article_analytics').addEventListener('click', handleAnalyticsClick);
document.querySelectorAll('.admin-option').forEach(elem => elem.classList.remove('hide-completely'));
document.querySelectorAll('.admin-option').forEach(elem => elem.classList.remove('hide'));
calculateVotes()
} else {
getRef('publishing_requests').removeEventListener('click', handleRequestClick)
getRef('article_analytics').removeEventListener('click', handleAnalyticsClick);
document.querySelectorAll('.admin-option').forEach(elem => elem.classList.add('hide-completely'))
document.querySelectorAll('.admin-option').forEach(elem => elem.classList.add('hide'))
}
if (location.hash.includes('sign_in') || location.hash.includes('sign_up'))
location.hash = floGlobals.isSubAdmin ? '#/dashboard' : '#/home'