feat: login form or room info on index page

This commit is contained in:
efim
2023-11-18 12:18:56 +00:00
parent 0e804b21e5
commit c8f28bf0de
8 changed files with 113 additions and 93 deletions

View File

@@ -1,43 +1,34 @@
<!doctype html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8" />
<meta http-equiv="x-ua-compatible" content="ie=edge" />
<title>Untitled</title>
<meta name="description" content="" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<script
src="https://unpkg.com/htmx.org@1.9.6"
integrity="sha384-FhXw7b6AlE/jyjlZH5iHa/tTe9EpJ1Y55RjcgPbjeWMskSxZt1v9qkxLJWNJaGni"
crossorigin="anonymous"
></script>
<link
rel="stylesheet"
href="/static/out.css"
type="text/css"
media="screen"
/>
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
<!-- Place favicon.ico in the root directory -->
</head>
<body class="bg-amber-400 text-xl">
<!--[if lt IE 8]>
<p class="browserupgrade">
You are using an <strong>outdated</strong> browser. Please
<a href="http://browsehappy.com/">upgrade your browser</a> to improve
your experience.
</p>
<![endif]-->
{{ define "main-content" }}
<main>
<h1>Hello</h1>
<p>This is index</p>
<p>Your session is {{ .SessionStringToken }}</p>
<p>Some string is {{ .SomeString }}</p>
<a href="/room/{{ .SessionToken.RoomId }}"
<body>
{{ define "main-content" }}
<main
class="grid grid-cols-2 h-full"
>
{{ if not .AuthedData.IsZero }}
<section>
<h1>Hello</h1>
<p>This is index</p>
<p>Your session is {{ .AuthedData.SessionStringToken }}</p>
<p>Some string is {{ .AuthedData.SomeString }}</p>
<a
href="/room/{{ .AuthedData.Session.RoomId }}"
class="text-blue-700 underline"
>You've logged into a room {{ .SessionToken.RoomId }}</a>
</main>
{{ end }}
>You've logged into a room {{ .AuthedData.Session.RoomId }}</a
>
</section>
{{ else }}
<section class="border">
<h2>hoho, the session is missing. let's do the auth section</h2>
<div class="h-fit w-fit">
{{ template "loginSection" .LoginSectionData }}
</div>
</section>
{{ end }}
<section class="border">
<h2>Here be rules</h2>
</section>
</main>
{{ end }}
</body>
</html>