Auth UI
This commit is contained in:
@@ -1,18 +1,35 @@
|
|||||||
<script>
|
<script>
|
||||||
|
import { afterUpdate } from 'svelte';
|
||||||
export let label;
|
export let label;
|
||||||
export let placeholder;
|
export let placeholder;
|
||||||
export let value;
|
export let value;
|
||||||
export let onKeyDown;
|
export let onKeyDown;
|
||||||
export let className = "";
|
export let className = '';
|
||||||
|
export let inputClassName = '';
|
||||||
|
export let type = 'text';
|
||||||
|
export let autoFocus = false;
|
||||||
|
|
||||||
|
let ref = null;
|
||||||
|
|
||||||
|
function typeAction(node) {
|
||||||
|
node.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
afterUpdate(() => {
|
||||||
|
if (autoFocus) {
|
||||||
|
ref.focus();
|
||||||
|
}
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<label class="block {className}">
|
<label class="block {className}">
|
||||||
{#if label}<h4 class="m-0">{label}</h4>{/if}
|
{#if label}<label class="m-0">{label}</label>{/if}
|
||||||
<input
|
<input
|
||||||
class="form-input p-2 mt-1 block w-full bg-gray-100 border-t-0 border-l-0 border-r-0 border-b-1"
|
use:typeAction
|
||||||
type="text"
|
class="form-input {inputClassName} p-2 mt-1 block w-full bg-white border border-gray-300"
|
||||||
on:keydown={onKeyDown}
|
on:keydown={onKeyDown}
|
||||||
{placeholder}
|
{placeholder}
|
||||||
bind:value
|
bind:value
|
||||||
|
bind:this={ref}
|
||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
|
|||||||
@@ -23,15 +23,6 @@
|
|||||||
/></a
|
/></a
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
<li>
|
|
||||||
<a
|
|
||||||
class="block"
|
|
||||||
aria-current={segment === undefined || segment === 'discussion'
|
|
||||||
? 'page'
|
|
||||||
: undefined}
|
|
||||||
href="."><Forum32 class="carbon-icon" /><span>Discussion</span></a
|
|
||||||
>
|
|
||||||
</li>
|
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a
|
||||||
class="block"
|
class="block"
|
||||||
@@ -44,13 +35,22 @@
|
|||||||
<li>
|
<li>
|
||||||
<a
|
<a
|
||||||
class="block"
|
class="block"
|
||||||
aria-current={segment === 'profile' ? 'page' : undefined}
|
aria-current={segment === undefined || segment === 'discussion'
|
||||||
href="profile"
|
? 'page'
|
||||||
><UserAvatar32 class="carbon-icon" />
|
: undefined}
|
||||||
<span>Профиль</span></a
|
href="."><Forum32 class="carbon-icon" /><span>Discussion</span></a
|
||||||
>
|
>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
|
<a
|
||||||
|
class="block"
|
||||||
|
aria-current={segment === 'profile' ? 'page' : undefined}
|
||||||
|
href="profile"
|
||||||
|
><UserAvatar32 class="carbon-icon" />
|
||||||
|
<span>People</span></a
|
||||||
|
>
|
||||||
|
</li>
|
||||||
|
<li class="hidden">
|
||||||
<a
|
<a
|
||||||
class="flex items-center"
|
class="flex items-center"
|
||||||
href="https://t.me/classroomio"
|
href="https://t.me/classroomio"
|
||||||
|
|||||||
@@ -65,7 +65,7 @@
|
|||||||
<div class="ml-4">
|
<div class="ml-4">
|
||||||
{#each options as option}
|
{#each options as option}
|
||||||
<button
|
<button
|
||||||
class="cursor-pointer text-left my-2 border-2 border-gray-300 rounded-md cursor-pointer hover:bg-gray-200 w-full {getValidationClassName(
|
class="cursor-pointer text-left my-2 border-2 border-gray-300 rounded-md hover:bg-gray-200 w-full {getValidationClassName(
|
||||||
option
|
option
|
||||||
)}"
|
)}"
|
||||||
type="button"
|
type="button"
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
<script>
|
<script>
|
||||||
import { stores } from "@sapper/app";
|
import { stores } from '@sapper/app';
|
||||||
import Tailwindcss from "../components/Tailwindcss.svelte";
|
import Tailwindcss from '../components/Tailwindcss.svelte';
|
||||||
// import Nav from "../components/Nav.svelte";
|
// import Nav from "../components/Nav.svelte";
|
||||||
import LeftNav from "../components/LeftNav/index.svelte";
|
import LeftNav from '../components/LeftNav/index.svelte';
|
||||||
// import SideBar from "../components/SideBar/index.svelte";
|
// import SideBar from "../components/SideBar/index.svelte";
|
||||||
import Footer from "../components/Footer/index.svelte";
|
import Footer from '../components/Footer/index.svelte';
|
||||||
import Apps from "../components/Apps/index.svelte";
|
import Apps from '../components/Apps/index.svelte';
|
||||||
|
|
||||||
export let segment;
|
export let segment;
|
||||||
|
|
||||||
@@ -17,9 +17,11 @@
|
|||||||
<!-- <Nav {segment} /> -->
|
<!-- <Nav {segment} /> -->
|
||||||
|
|
||||||
<main class="flex">
|
<main class="flex">
|
||||||
<LeftNav {segment} />
|
{#if !['login', 'signup'].includes($page.path.replace('/', ''))}
|
||||||
|
<LeftNav {segment} />
|
||||||
|
{/if}
|
||||||
<slot />
|
<slot />
|
||||||
{#if $page.path.includes("courses")}
|
{#if $page.path.includes('courses')}
|
||||||
<Apps />
|
<Apps />
|
||||||
{/if}
|
{/if}
|
||||||
</main>
|
</main>
|
||||||
|
|||||||
+49
-20
@@ -1,15 +1,11 @@
|
|||||||
<script>
|
<script>
|
||||||
function onTelegramAuth(user) {
|
import TextField from '../components/Form/TextField.svelte';
|
||||||
alert(
|
import PrimaryButton from '../components/PrimaryButton/index.svelte';
|
||||||
"Logged in as " +
|
|
||||||
user.first_name +
|
let email;
|
||||||
" " +
|
|
||||||
user.last_name +
|
function handleSubmit() {
|
||||||
" (" +
|
console.log(`email`, email);
|
||||||
user.id +
|
|
||||||
(user.username ? ", @" + user.username : "") +
|
|
||||||
")"
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -17,13 +13,46 @@
|
|||||||
<title>Join ClassroomIO</title>
|
<title>Join ClassroomIO</title>
|
||||||
</svelte:head>
|
</svelte:head>
|
||||||
|
|
||||||
<div class="lg:w-3/5 mx-auto md:mx-10 lg:mb-20">
|
<div class="w-full h-screen flex items-center justify-center ">
|
||||||
<p>Login/Sign up into ClassroomIO</p>
|
<div class="container border border-gray-300 rounded-md p-12">
|
||||||
<script
|
<form
|
||||||
async
|
on:submit|preventDefault={handleSubmit}
|
||||||
src="https://telegram.org/js/telegram-widget.js?14"
|
class="flex items-center flex-col w-full"
|
||||||
data-telegram-login="classroomio_bot"
|
>
|
||||||
data-size="large"
|
<img
|
||||||
data-auth-url="login-redirect"
|
src="/logo-192.png"
|
||||||
data-request-access="write"></script>
|
alt="ClassroomIO logo"
|
||||||
|
height="70"
|
||||||
|
width="70"
|
||||||
|
data-atf="1"
|
||||||
|
/>
|
||||||
|
<h4 class="text-lg m-0 mt-3">Login</h4>
|
||||||
|
<p class="text-sm">into ClassroomIO</p>
|
||||||
|
|
||||||
|
<div class="my-4 w-full">
|
||||||
|
<TextField
|
||||||
|
bind:value={email}
|
||||||
|
type="email"
|
||||||
|
autoFocus={true}
|
||||||
|
placeholder="Enter your email"
|
||||||
|
onKeyDown={handleSubmit}
|
||||||
|
inputClassName="rounded-md w-full px-2 py-4"
|
||||||
|
/>
|
||||||
|
<p class="py-3 text-sm">
|
||||||
|
A magic link will be sent to your email, please open the link
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="my-4 w-full flex justify-between items-center">
|
||||||
|
<a href="/signup" class="text-blue-700 text-sm">Create an account</a>
|
||||||
|
<PrimaryButton label="Next" type="submit" className="py-2 px-4" />
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.container {
|
||||||
|
width: 450px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@@ -0,0 +1,85 @@
|
|||||||
|
<script>
|
||||||
|
import TextField from '../components/Form/TextField.svelte';
|
||||||
|
import Select from '../components/Form/Select.svelte';
|
||||||
|
import PrimaryButton from '../components/PrimaryButton/index.svelte';
|
||||||
|
|
||||||
|
let email;
|
||||||
|
let userType = 0;
|
||||||
|
|
||||||
|
const userTypes = [
|
||||||
|
{
|
||||||
|
text: '--Select an option--',
|
||||||
|
value: 0,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: 'Student',
|
||||||
|
value: 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: 'Organization/Teacher',
|
||||||
|
value: 2,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
function handleSubmit() {
|
||||||
|
console.log(`email`, email);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<svelte:head>
|
||||||
|
<title>Join ClassroomIO</title>
|
||||||
|
</svelte:head>
|
||||||
|
|
||||||
|
<div class="w-full h-screen flex items-center justify-center ">
|
||||||
|
<div class="container border border-gray-300 rounded-md p-12">
|
||||||
|
<form
|
||||||
|
on:submit|preventDefault={handleSubmit}
|
||||||
|
class="flex items-center flex-col w-full"
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
src="/logo-192.png"
|
||||||
|
alt="ClassroomIO logo"
|
||||||
|
height="70"
|
||||||
|
width="70"
|
||||||
|
data-atf="1"
|
||||||
|
/>
|
||||||
|
<h4 class="text-lg m-0 mt-3">Signup</h4>
|
||||||
|
<p class="text-sm">for ClassroomIO</p>
|
||||||
|
|
||||||
|
<div class="my-4 w-full">
|
||||||
|
<Select
|
||||||
|
label="Who are you?"
|
||||||
|
bind:value={userType}
|
||||||
|
options={userTypes}
|
||||||
|
valueKey="value"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="my-4 w-full">
|
||||||
|
<TextField
|
||||||
|
bind:value={email}
|
||||||
|
autofocus={true}
|
||||||
|
label="Email"
|
||||||
|
type="email"
|
||||||
|
placeholder="Enter your email"
|
||||||
|
onKeyDown={handleSubmit}
|
||||||
|
inputClassName="rounded-md w-full px-2 py-4"
|
||||||
|
/>
|
||||||
|
<p class="py-3 text-sm">
|
||||||
|
A magic link will be sent to your email, please open the link
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="my-4 w-full flex justify-between items-center">
|
||||||
|
<a href="/login" class="text-blue-700 text-sm">I have an account</a>
|
||||||
|
<PrimaryButton label="Next" type="submit" className="py-2 px-4" />
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.container {
|
||||||
|
width: 450px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
Reference in New Issue
Block a user