Refactor: (login) -> (entry)

This commit is contained in:
Donatas Kirda 2024-05-16 20:52:29 +03:00
parent 8db2858e75
commit 573a28a36a
Signed by: bloodwiing
GPG Key ID: 63020D8D3F4A164F
10 changed files with 53 additions and 30 deletions

View File

@ -0,0 +1,16 @@
import { writable } from "svelte/store";
/**
* @typedef {{
* x: number,
* y: number,
* scale: number,
* }} data;
*/
/** @type {import("svelte/store").Writable<data>} */
export default writable({
x: 0.5,
y: 0.5,
scale: 1.0,
});

View File

@ -1,4 +1,5 @@
<script> <script>
import { page } from "$app/stores";
import { onMount } from "svelte"; import { onMount } from "svelte";
/** @type {Element} */ /** @type {Element} */
@ -7,6 +8,11 @@
/** @type {Element} */ /** @type {Element} */
let background; let background;
/** @type {any} */
export let data;
console.log(data);
/** @typedef {{x: number, y: number, size: number}} glowAnimState */ /** @typedef {{x: number, y: number, size: number}} glowAnimState */
/** @type {glowAnimState} */ /** @type {glowAnimState} */
let current = {x: 0, y: 0, size: 100}; let current = {x: 0, y: 0, size: 100};
@ -89,6 +95,7 @@
--color-2: #caad77; --color-2: #caad77;
--color-3: #f3404f; --color-3: #f3404f;
background: radial-gradient(circle at center, #220415 0%, var(--color-bg) 100%);
background: var(--color-bg); background: var(--color-bg);
overflow: hidden; overflow: hidden;

View File

@ -0,0 +1,6 @@
/** @type {import("@sveltejs/kit").ServerLoad} */
export async function load() {
return {
hi: "nice"
};
}

View File

@ -0,0 +1,19 @@
<script>
</script>
<style>
h1 {
font-size: 2.5rem;
}
.center {
display: flex;
flex-flow: column nowrap;
align-items: center;
}
</style>
<div class="center">
<h1 class="typeDisplay"><span class="typeContent">Welcome to </span>Echo</h1>
<p>Currently suppored link: <a href="/posts">/posts</a></p>
</div>

View File

@ -1,6 +1,7 @@
import { createUserSession } from "$lib/server/db/user"; import { createUserSession } from "$lib/server/db/user";
import { redirect } from "@sveltejs/kit"; import { redirect } from "@sveltejs/kit";
/** @type {import("@sveltejs/kit").ServerLoad} */
export async function load({ cookies }) { export async function load({ cookies }) {
if (cookies.get('token')) { if (cookies.get('token')) {
redirect(302, '/'); redirect(302, '/');

View File

@ -1,13 +1,14 @@
import { createUser } from '$lib/server/db/user'; import { createUser } from '$lib/server/db/user';
import { redirect } from '@sveltejs/kit'; import { redirect } from '@sveltejs/kit';
/** @type {import('@sveltejs/kit').ServerLoad} */
export async function load({ cookies }) { export async function load({ cookies }) {
if (cookies.get('token')) { if (cookies.get('token')) {
redirect(302, '/'); redirect(302, '/');
} }
} }
/** @type {import('./$types').Action} */ /** @type {import('@sveltejs/kit').Action} */
async function POST({ request }) { async function POST({ request }) {
if (request.method !== 'POST') { if (request.method !== 'POST') {
return; return;
@ -26,7 +27,7 @@ async function POST({ request }) {
console.log(result); console.log(result);
} }
/** @type {import('./$types').Actions} */ /** @type {import('@sveltejs/kit').Actions} */
export const actions = { export const actions = {
default: POST default: POST
}; };

View File

@ -1,27 +0,0 @@
<style>
h1 {
font-size: 2.5rem;
}
.center {
position: absolute;
top: 0px;
width: 100%;
height: 100dvh;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
--accent-1: rgb(131, 4, 53);
--accent-2: rgb(0, 18, 36);
background: radial-gradient(circle at top, var(--accent-1), transparent),
radial-gradient(circle at bottom, var(--accent-2), transparent),
#111;
}
</style>
<div class="center">
<h1 class="typeDisplay"><span class="typeContent">Welcome to </span>Echo</h1>
<p>Currently suppored link: <a href="/posts">/posts</a></p>
</div>