diff --git a/app/javascript/flavours/glitch/packs/login.js b/app/javascript/flavours/glitch/packs/login.js new file mode 100644 index 000000000..3738d671a --- /dev/null +++ b/app/javascript/flavours/glitch/packs/login.js @@ -0,0 +1,8 @@ +import 'packs/public-path'; +import { start } from '@rails/ujs'; +import 'flavours/glitch/styles/login.scss'; + +start(); + +// This ensures that webpack compiles our images. +require.context('../images', true); diff --git a/app/javascript/flavours/glitch/styles/login.scss b/app/javascript/flavours/glitch/styles/login.scss new file mode 100644 index 000000000..b4184febd --- /dev/null +++ b/app/javascript/flavours/glitch/styles/login.scss @@ -0,0 +1,118 @@ +@import 'variables'; +@import 'styles/fonts/roboto'; +@import 'styles/fonts/roboto-mono'; +@import 'reset'; +@import 'basics'; + +body { + height: 100vh; + + a { + color: #89caff; + } +} + +.login-container { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + height: 100%; + max-width: 30rem; + padding: 1rem; + margin: auto; + box-sizing: border-box; +} + +header { + display: flex; + justify-content: center; + margin-bottom: 1rem; +} + +.mascot { + height: 10rem; +} + +main { + display: flex; + position: relative; + flex-direction: column; + row-gap: 10px; +} + +.login { + display: flex; + position: relative; + column-gap: 10px; +} + +.instance { + background: #282c37; + border: 0; + border-radius: 4px; + box-shadow: none; + box-sizing: border-box; + color: #9baec8; + display: block; + font-family: inherit; + font-size: 16px; + line-height: 18px; + margin: 0; + outline: 0; + padding: 15px; + padding-inline-end: 30px; + width: 100%; +} + +.button { + display: flex; + column-gap: .5rem; + align-items: center; + justify-content: center; + background-color: #66befe; + border: 0 none; + border-radius: 4px; + box-sizing: border-box; + color: #2a2b2f; + cursor: pointer; + font-size: 16px; + letter-spacing: 0; + line-height: 22px; + font-family: inherit; + font-weight: 500; + padding: 7px 10px; + position: relative; + text-align: center; + text-decoration: none; + white-space: nowrap; + flex-basis: auto; + + &:hover { + background-color: #89caff; + } + + &:disabled { + background-color: #9baec8; + cursor: default; + } +} + +.content { + background-color: #444b5d; + padding: 15px; + font-size: 1rem; + line-height: 1.5rem; + border-radius: 4px; + display: flex; + flex-direction: column; + row-gap: .75rem; +} + +.link-footer { + padding: 10px; + + p, a { + color: #97A8B4; + } +} \ No newline at end of file diff --git a/app/javascript/flavours/glitch/theme.yml b/app/javascript/flavours/glitch/theme.yml index 0877e4d40..d3f8a0f5b 100644 --- a/app/javascript/flavours/glitch/theme.yml +++ b/app/javascript/flavours/glitch/theme.yml @@ -16,6 +16,9 @@ pack: - flavours/glitch/async/getting_started - flavours/glitch/async/home_timeline - flavours/glitch/async/notifications + login: + filename: packs/login.js + stylesheet: true mailer: modal: public: packs/public.jsx diff --git a/public/auth.js b/public/auth.js index 50b02c219..dd3c6489c 100644 --- a/public/auth.js +++ b/public/auth.js @@ -30,7 +30,9 @@ async function auth() { const domain = matches[2]; if (!domain) { - setMessage('Invalid instance', false); + setMessage('Invalid instance', true); + await new Promise(r => setTimeout(r, 2000)); + setMessage('Authorize', false, false); return; } localStorage.setItem('domain', domain); @@ -92,7 +94,6 @@ async function getToken(code, domain) { formData.append('scope', 'read write follow push'); formData.append('redirect_uri', document.location.origin + document.location.pathname); - // eslint-disable-next-line promise/catch-or-return return fetch(tokenUrl, { method: 'POST', @@ -108,7 +109,14 @@ async function getToken(code, domain) { }); } -function setMessage(message, disabled = true) { +function setMessage(message, error = false, disabled = true) { + document.getElementById('message').setAttribute('role', 'status'); document.getElementById('message').textContent = message; document.getElementById('btn').disabled = disabled; + + if (!error) return; + + const instance = document.getElementById('instance'); + instance.setAttribute('aria-invalid', true); + instance.setAttribute('aria-describedby', 'message'); } diff --git a/public/login.html b/public/login.html index 5f07ba8b8..eb3a14e80 100644 --- a/public/login.html +++ b/public/login.html @@ -1,13 +1,50 @@ + Login | Masto-FE (🦥 flavour) + + + + - - - +
+
+ +
+
+ +
+

+ This is a standalone version of the Mastodon front-end that offers compatibility with GoToSocial instances. It is based + on Iceshrimp's Masto-FE Standalone, + which is itself a fork of Mastodon Glitch Edition, + which in turn forks Mastodon. Phew! +

+

+ The application is completely client-side, meaning everything happens in the browser on your machine. It does not store + information anywhere else than your browser's local storage. +

+
+
+ +
+ \ No newline at end of file