Forráskód Böngészése

Continuing work on login view, still a ways off from completion.

Daniel Scalzi 7 éve
szülő
commit
1284c54525
4 módosított fájl, 315 hozzáadás és 4 törlés
  1. 2 2
      README.md
  2. 1 1
      app/app.ejs
  3. 267 1
      app/assets/css/launcher.css
  4. 45 0
      app/login.ejs

+ 2 - 2
README.md

@@ -75,10 +75,10 @@ You can find more information [here](http://code.matsu.io/1).
 
 ### Notes on DevTools Window ###
 
-Once you run the program, you can open the DevTools window by typing the following keys in sequence on the main window.
+Once you run the program, you can open the DevTools window by using the following keybind.
 
 ```shell
-wcdev
+ctrl + shift + i
 ```
 
 Please note that if you are debugging the application with VS Code and have launched the program using the **Debug Renderer Process** configuration you cannot open the DevTools window. If you attempt to do so, the program will crash. Remote debugging cannot be  done with multiple DevTools clients.

+ 1 - 1
app/app.ejs

@@ -11,7 +11,7 @@
             background-size: cover;
         }
         #main {
-            background: linear-gradient(to top, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0) 50%);
+            background: linear-gradient(to top, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0) 100%);
         }
     </style>
 </head>

+ 267 - 1
app/assets/css/launcher.css

@@ -14,6 +14,11 @@
     src: url('../fonts/Avenir-Medium.ttf');
 }
 
+@font-face {
+    font-family: 'Ringbearer';
+    src: url('../fonts/Ringbearer.ttf');
+}
+
 /*******************************************************************************
  *                                                                             *
  * Element Styles                                                              *
@@ -130,6 +135,7 @@ p {
 
 /* Main login container. */
 #loginContainer {
+    position: relative;
     display: flex;
     justify-content: center;
     align-items: center;
@@ -191,6 +197,20 @@ p {
     letter-spacing: 1px;
 }
 
+/* Div to display any login errors. */
+#loginError {
+    font-family: 'Avenir Book';
+    color: #fff;
+    font-size: 12px;
+    background: #9b1313;
+    border: 0.5px solid white;
+    padding: 2px 0px;
+    width: 100%;
+    text-align: center;
+    font-weight: bold;
+    margin: 8px 0px;
+}
+
 /* SVG icons on the login view. */
 .loginSVG {
     fill: #fff;
@@ -205,7 +225,7 @@ p {
     border-width: 1.5px 0px 0px 0px;
     border-style: solid;
     width: 250px;
-    margin-bottom: 20px;
+    /*margin-bottom: 20px;*/
     border-color: #fff;
     color: rgba(255, 255, 255, 0.75);
     font-weight: bold;
@@ -234,6 +254,16 @@ p {
     margin-bottom: 13px;
 }
 
+.loginErrorSpan {
+    font-family: 'Avenir Medium';
+    font-weight: bold;
+    font-size: 8px;
+    color: red;
+    width: 100%;
+    text-align: right;
+    margin-bottom: 15px;
+}
+
 /* Container which contains the forgot and remember options. */
 #loginOptions {
     display: flex;
@@ -262,6 +292,10 @@ p {
     right: -20px;
     transition: 0.5s ease;
 }
+#loginButton:disabled {
+    color: rgba(255, 255, 255, 0.75);
+    pointer-events: none;
+}
 #loginButton:hover,
 #loginButton:focus {
     text-shadow: 0px 0px 20px #fff;
@@ -296,6 +330,112 @@ p {
     align-items: center;
 }
 
+#loginButton .circle-loader,
+#loginButton:disabled #loginSVG {
+    display: none;
+}
+#loginButton:disabled .circle-loader,
+#loginButton #loginSVG {
+    display: initial;
+}
+
+
+.circle-loader {
+    margin-left: 20px;
+    border: 2px solid rgba(255, 255, 255, 0.5);
+    border-left-color: #ffffff;
+    animation-name: loader-spin;
+    animation-duration: 1s;
+    animation-iteration-count: infinite;
+    animation-timing-function: linear;
+    position: relative;
+    display: inline-block;
+    vertical-align: top;
+    border-radius: 50%;
+    width: 16px;
+    height: 16px;
+}
+.load-complete {
+    animation: none;
+    border-color: #ffffff;
+    transition: border 500ms ease-out;
+}
+.checkmark {
+    display: none;
+}
+.checkmark.draw:after {
+    animation-duration: 800ms;
+    animation-timing-function: ease;
+    animation-name: checkmark;
+    transform: scaleX(-1) rotate(135deg);
+}
+.checkmark:after {
+    opacity: 1;
+    height: 8px;
+    width: 4px;
+    transform-origin: left top;
+    border-right: 2px solid #ffffff;
+    border-top: 2px solid #ffffff;
+    content: '';
+    left: 2px;
+    top: 8px;
+    position: absolute;
+}
+@keyframes loader-spin {
+    0% {
+        transform: rotate(0deg);
+    }
+    100% {
+        transform: rotate(360deg);
+    }
+}
+@keyframes checkmark {
+    0% {
+        height: 0;
+        width: 0;
+        opacity: 1;
+    }
+    20% {
+        height: 0;
+        width: 4px;
+        opacity: 1;
+    }
+    40% {
+        height: 8px;
+        width: 4px;
+        opacity: 1;
+    }
+    100% {
+        height: 8px;
+        width: 4px;
+        opacity: 1;
+    }
+}
+
+
+
+/*.spinningCircle {
+    margin-left: 20px;
+    height: 16px;
+    width: 16px;
+    border-radius: 50%;
+    border: 2px solid rgba(255,255,255,0);
+    border-top-color: #ffffff;
+    border-right-color: #ffffff;
+    border-left-color: rgba(255, 255, 255, 0.50);
+    border-bottom-color: rgba(255, 255, 255, 0.50);
+    animation: single2 4s infinite linear;
+}
+
+@keyframes single2 {
+    0% {
+        transform: rotate(0deg);
+    }
+    100% {
+        transform: rotate(720deg);
+    }
+}*/
+
 /* Disclaimer container. */
 #loginDisclaimer {
     display: flex;
@@ -361,6 +501,9 @@ p {
     color: #8d8d8d;
     border-color: #8d8d8d;
 }
+#checkmarkContainer[disabled] {
+    pointer-events: none;
+}
 /* For checked -> #checkmarkContainer input:checked ~ * */
 /* Create the checkmark/indicator (hidden when not checked). */
 .loginCheckmark:after {
@@ -383,6 +526,129 @@ p {
     transform: rotate(45deg);
 }
 
+/* * *
+* Login View | Error Overlay
+* * */
+
+#loginErrorContainer {
+    position: absolute;
+    display: none;
+    align-items: center;
+    justify-content: center;
+    width: 100%;
+    height: 100%;
+    background: rgba(0, 0, 0, 0.50);
+}
+
+#loginContainer[error] > #loginErrorContainer {
+    display: flex;
+}
+
+#loginContainer[error] > div:not(#loginErrorContainer) {
+    filter: blur(3px) contrast(0.9) brightness(1.0);
+}
+
+#loginErrorContent {
+    position: relative;
+    display: flex;
+    flex-direction: column;
+    align-items: center;
+    justify-content: space-between;
+    width: 300px;
+    height: 35%;
+    box-sizing: border-box;
+    padding: 15px 0px;
+    /* background-color: #424242; */
+    text-align: center;
+}
+
+#loginErrorTitle {
+    font-family: 'Avenir Medium';
+    font-size: 20px;
+    color: #fff;
+    font-weight: bold;
+    letter-spacing: 1px;
+}
+
+#loginErrorDesc {
+    font-family: 'Avenir Book';
+    font-size: 12px;
+    color: #fff;
+    font-weight: bold;
+}
+
+#loginErrorAcknowledge {
+    background: none;
+    border: 1px solid #ffffff;
+    color: white;
+    font-family: 'Avenir Medium';
+    font-weight: bold;
+    border-radius: 2px;
+    width: 75px;
+    cursor: pointer;
+}
+
+/* * *
+* Login View | Loader
+* * */
+/* Will reuse this elsewhere down the line.
+#loginLoading {
+    position: absolute;
+    display: flex;
+    align-items: center;
+    justify-content: center;
+    width: 100%;
+    height: 100%;
+    background: rgba(0, 0, 0, 0.80);
+}
+
+#loginLoadingContent {
+    position: relative;
+    display: flex;
+    flex-direction: column;
+    align-items: center;
+    justify-content: center;
+}
+
+#loadSpinnerContainer {
+    position: relative;
+    display: flex;
+    align-items: center;
+    justify-content: center;
+}
+
+#loadCenterImage {
+    position: absolute;
+    width: 200px;
+    height: auto;
+}
+
+#loadSpinnerImage {
+    width: 280px;
+    height: auto;
+}
+
+#loadDescText {
+    color: #f1eada;
+    font-family: 'Avenir Medium';
+    font-weight: bold;
+    letter-spacing: 1px;
+    font-size: 16px;
+}
+
+@keyframes rotating {
+    from {
+        transform: rotate(0deg);
+    }
+    to {
+        transform: rotate(360deg);
+    }
+}
+
+.rotating {
+    animation: rotating 10s linear infinite;
+}*/
+
 /*
 #login_filter {
     height: calc(100% - 22px);

+ 45 - 0
app/login.ejs

@@ -9,12 +9,14 @@
                 </g>
             </svg>
             <input id="loginUsername" class="loginField" type="text" placeholder="EMAIL"/>
+            <span class="loginErrorSpan">* Invalid Username</span>
             <svg id="lockSVG" class="loginSVG" viewBox="40 32 60.36 70.43">
                 <g>
                     <path d="M86.16,54a16.38,16.38,0,1,0-32,0H44V102.7H96V54Zm-25.9-3.39a9.89,9.89,0,1,1,19.77,0A9.78,9.78,0,0,1,79.39,54H60.89A9.78,9.78,0,0,1,60.26,50.59ZM70,96.2a6.5,6.5,0,0,1-6.5-6.5,6.39,6.39,0,0,1,3.1-5.4V67h6.5V84.11a6.42,6.42,0,0,1,3.39,5.6A6.5,6.5,0,0,1,70,96.2Z"/>
                 </g>
             </svg>
             <input id="loginPassword" class="loginField" type="password" placeholder="PASSWORD"/>
+            <span class="loginErrorSpan">* Required</span>
             <div id="loginOptions">
                 <span class="loginSpanDim">
                     <a href="https://help.mojang.com/customer/en/portal/articles/329524-change-or-forgot-password">forgot password?</a>
@@ -34,6 +36,10 @@
                         </defs>
                         <polyline class="arrowLine" points="0.71 13.26 12.56 1.41 24.16 13.02"/>
                     </svg>
+                    <div class="circle-loader">
+                        <div class="checkmark draw"></div>
+                    </div>
+                    <!--<div class="spinningCircle" id="loginSpinner"></div>-->
                 </div>
             </button>
             <div id="loginDisclaimer">
@@ -45,4 +51,43 @@
             </div>
         </div>
     </div>
+    <script type="text/javascript">
+        //const validEmail = /^(([^<>()\[\]\.,;:\s@\"]+(\.[^<>()\[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i
+        const loginUsername = document.getElementById('loginUsername')
+        const loginPassword = document.getElementById('loginPassword')
+        const checkmarkContainer = document.getElementById('checkmarkContainer')
+        const loginRememberOption = document.getElementById('loginRememberOption')
+        const loginButton = document.getElementById('loginButton')
+        loginButton.addEventListener('click', () => {
+            loginButton.disabled = true
+            loginUsername.disabled = true
+            loginPassword.disabled = true
+            checkmarkContainer.setAttribute('disabled', true)
+            loginRememberOption.disabled = true
+            loginButton.innerHTML = loginButton.innerHTML.replace('LOGIN', 'LOGGING IN')
+            setTimeout(() => {
+                loginButton.innerHTML = loginButton.innerHTML.replace('LOGGING IN', 'SUCCESS')
+                loginButton.style.color = '#ffffff'
+                $('.circle-loader').toggleClass('load-complete');
+                $('.checkmark').toggle();
+            }, 2500)
+        })
+    </script>
+    <div id="loginErrorContainer">
+        <div id="loginErrorContent">
+            <span id="loginErrorTitle">LOGIN FAILED:<br>INVALID CREDENTIALS</span>
+            <span id="loginErrorDesc">Either the email or password you supplied is invalid. Please ensure everything is correct and try again.</span>
+            <button id="loginErrorAcknowledge">Try Again</button>
+        </div>
+    </div>
+    <!-- Will reuse this down the line, then it will be removed from this file. -->
+    <!--<div id="loginLoading">
+        <div id="loginLoadingContent">
+            <div id="loadSpinnerContainer">
+                <img id="loadCenterImage" src="assets/images/westeroscraftlogo1.png">
+                <img id="loadSpinnerImage" class="rotating" src="assets/images/westeroscraftlogo2.png">
+            </div>
+            <span id="loadDescText">LOGGING IN</span>
+        </div>
+    </div>-->
 </div>