From 33578dfaa50ed79b6a96f0b568e85812221e0563 Mon Sep 17 00:00:00 2001 From: hitlerrip Date: Wed, 30 Jul 2025 09:44:30 +0200 Subject: login redesign - made login section a component - redesigned login section - other minor changes --- frontend/hitler-clicker/src/lib/index.ts | 0 frontend/hitler-clicker/src/routes/+page.svelte | 126 ++----------------- .../hitler-clicker/src/routes/lib/login.svelte | 139 +++++++++++++++++++++ 3 files changed, 149 insertions(+), 116 deletions(-) create mode 100644 frontend/hitler-clicker/src/lib/index.ts create mode 100644 frontend/hitler-clicker/src/routes/lib/login.svelte (limited to 'frontend') diff --git a/frontend/hitler-clicker/src/lib/index.ts b/frontend/hitler-clicker/src/lib/index.ts new file mode 100644 index 0000000..e69de29 diff --git a/frontend/hitler-clicker/src/routes/+page.svelte b/frontend/hitler-clicker/src/routes/+page.svelte index d088973..7dba86c 100644 --- a/frontend/hitler-clicker/src/routes/+page.svelte +++ b/frontend/hitler-clicker/src/routes/+page.svelte @@ -9,9 +9,7 @@ import { page } from '$app/state'; - let name = $state(""); - let password = $state(""); - let team = $state("axis"); + import Login from './lib/login.svelte'; // why is $lib broken? let axis = $state(0); let allies = $state(0); @@ -32,53 +30,6 @@ getstats(); } getstats(); - - function login() { - fetch("http://localhost:8000/auth.php", { - method: "POST", - headers: { - "Accept": "application/json", - "Content-Type": "application/json", - }, - body: JSON.stringify({ - "name": name, - "password": password - }) - }).then((response) => { - return response.json().then((data) => { - if (data.token) { - //console.log(data.token); - console.log("logged in!"); - window.location.href = `${page.url.origin}/main/`; - } else { - alert((data.status) ? `ERROR: ${data.status}` : `ERROR: something went wrong.`); - } - }) - }) - } - - function join() { - fetch("http://localhost:8000/join.php", { - method: "POST", - headers: { - "Accept": "application/json", - "Content-Type": "application/json", - }, - body: JSON.stringify({ - "name": name, - "password": password, - "team": team - }) - }).then((response) => { - return response.json().then((data) => { - if (data.status === "success") { - login(); - } else { - alert((data.status) ? `ERROR: ${data.status}` : `ERROR: something went wrong.`); - } - }) - }) - }
Welcome to Hitler Clicker! -

a stupid game where you have to click in order to score points for your team.

+

a stupid game where you have to click in order to score points for your team

࿕ Axis ࿕

{axis}

@@ -100,69 +51,12 @@
-
- -

Play with an Account:

- -
- -
- -
- - - -
- -

Create an Account:

- -
- -
- -
- -
- - - -
- - -

Play Anonymously:

- -

(not implemented on backend yet.)

+ -
+ diff --git a/frontend/hitler-clicker/src/routes/lib/login.svelte b/frontend/hitler-clicker/src/routes/lib/login.svelte new file mode 100644 index 0000000..cded203 --- /dev/null +++ b/frontend/hitler-clicker/src/routes/lib/login.svelte @@ -0,0 +1,139 @@ + + +
+ +
+ +

Account:

+ +
+ +
+ +
+
+ + + +
+ +
+ +
+ +

Register:

+ +
+ +
+ +
+ + + +
+ +
+ +
+ +
+ +

Play Anonymously:

+ +

(not implemented on backend yet.)

+ +
-- cgit v1.2.3