forked from tangled.org/core
Monorepo for Tangled — https://tangled.org

add banner for unlogged-in users

Changed files
+99 -65
appview
pages
templates
+1 -1
appview/pages/templates/layouts/topbar.html
···
{{ didOrHandle .Did .Handle }}
</summary>
<div
-
class="absolute flex flex-col right-0 mt-4 p-4 rounded w-48 bg-white border border-gray-200 z-50"
+
class="absolute flex flex-col right-0 mt-4 p-4 rounded w-48 bg-white border border-gray-200 z-999"
>
<a
href="/{{ didOrHandle .Did .Handle }}"
+42 -36
appview/pages/templates/repo/new.html
···
{{ define "title" }}new repo{{ end }}
{{ define "content" }}
-
<h1>new repo</h1>
-
<form hx-post="/repo/new" class="mt-6 space-y-6" hx-swap="none">
-
<div class="space-y-2">
-
<label for="name" class="block">repo name</label>
+
<div class="p-6">
+
<p class="text-xl font-bold">Create a new repository</p>
+
</div>
+
<div class="p-6 bg-white drop-shadow-sm rounded">
+
<form hx-post="/repo/new" class="space-y-12" hx-swap="none">
+
<div class="space-y-2">
+
<label for="name" class="block uppercase font-bold text-sm">Repository name</label>
+
<input
+
type="text"
+
id="name"
+
name="name"
+
required
+
class="w-full max-w-md"
+
/>
+
<p class="text-sm text-gray-500">All repositories are publicly visible.</p>
+
</div>
+
+
<fieldset class="space-y-3">
+
<legend class="uppercase font-bold text-sm">Select a knot</legend>
+
<div class="space-y-2">
+
{{ range .Knots }}
+
<div>
+
<label class="inline-flex items-center">
<input
-
type="text"
-
id="name"
-
name="name"
-
required
-
class="w-full max-w-md"
-
/>
+
type="radio"
+
name="domain"
+
value="{{ . }}"
+
class="mr-2"
+
/>
+
<span>{{ . }}</span>
+
</label>
</div>
+
{{ else }}
+
<p>No knots available.</p>
+
{{ end }}
+
</div>
+
<p class="text-sm text-gray-500">A knot hosts repository data. <a href="/knots" class="underline">Learn how to register your own knot.</a></p>
+
</fieldset>
-
<fieldset class="space-y-3">
-
<legend class="font-medium">select a knot</legend>
-
<div class="space-y-2">
-
{{ range .Knots }}
-
<div>
-
<label class="inline-flex items-center">
-
<input
-
type="radio"
-
name="domain"
-
value="{{ . }}"
-
class="mr-2"
-
/>
-
<span>{{ . }}</span>
-
</label>
-
</div>
-
{{ else }}
-
<p>No knots available</p>
-
{{ end }}
-
</div>
-
</fieldset>
-
-
<div class="space-y-2">
-
<button type="submit" class="btn">create repo</button>
-
<div id="repo" class="error"></div>
-
</div>
-
</form>
+
<div class="space-y-2">
+
<button type="submit" class="btn">create repo</button>
+
<div id="repo" class="error"></div>
+
</div>
+
</form>
+
</div>
{{ end }}
+56 -28
appview/pages/templates/timeline.html
···
{{ define "title" }}timeline{{ end }}
+
{{ define "topbar" }}
+
{{ with .LoggedInUser }}
+
{{ template "layouts/topbar" $ }}
+
{{ else }}
+
{{ end }}
+
{{ end }}
+
{{ define "content" }}
-
<div class="p-6">
-
<p class="text-xl font-bold">Timeline</p>
+
{{ with .LoggedInUser }}
+
{{ block "timeline" $ }} {{ end }}
+
{{ else }}
+
{{ block "hero" $ }} {{ end }}
+
{{ block "timeline" $ }} {{ end }}
+
{{ end }}
+
{{ end }}
+
+
{{ define "hero" }}
+
<div class="flex flex-col items-center justify-center text-center rounded drop-shadow bg-white text-black py-4 px-10">
+
<div class="font-bold text-4xl mb-4">
+
tangled
+
</div>
+
<div class="italic text-lg">
+
tightly-knit social coding, <a href="/login" class="underline inline-flex gap-1 items-center">join now <i data-lucide="arrow-right" class="w-4 h-4"></i></a>
+
</div>
</div>
+
{{ end }}
-
<div class="flex flex-col gap-3 relative">
-
<div class="absolute left-8 top-0 bottom-0 w-px bg-gray-300"></div>
-
{{ range .Timeline }}
-
<div class="px-6 py-2 bg-white rounded drop-shadow-sm w-fit">
-
{{ if .Repo }}
-
{{ $userHandle := index $.DidHandleMap .Repo.Did }}
-
<div class="flex items-center">
-
<p class="text-gray-600">
-
<a href="/{{ $userHandle }}" class="no-underline hover:underline">{{ $userHandle }}</a>
-
created
-
<a href="/{{ $userHandle }}/{{ .Repo.Name }}" class="no-underline hover:underline">{{ .Repo.Name }}</a>
-
<time class="text-gray-700">{{ .Repo.Created | timeFmt }}</time>
-
</p>
-
</div>
-
{{ else if .Follow }}
-
{{ $userHandle := index $.DidHandleMap .Follow.UserDid }}
-
{{ $subjectHandle := index $.DidHandleMap .Follow.SubjectDid }}
-
<div class="flex items-center">
-
<p class="text-gray-600">
-
<a href="/{{ $userHandle }}" class="no-underline hover:underline">{{ $userHandle }}</a>
-
followed
-
<a href="/{{ $subjectHandle }}" class="no-underline hover:underline">{{ $subjectHandle }}</a>
-
<time class="text-gray-700">{{ .Follow.FollowedAt | timeFmt }}</time>
-
</p>
+
{{ define "timeline" }}
+
<div>
+
<div class="p-6">
+
<p class="text-xl font-bold">Timeline</p>
+
</div>
+
+
<div class="flex flex-col gap-3 relative">
+
<div class="absolute left-8 top-0 bottom-0 w-px bg-gray-300"></div>
+
{{ range .Timeline }}
+
<div class="px-6 py-2 bg-white rounded drop-shadow-sm w-fit">
+
{{ if .Repo }}
+
{{ $userHandle := index $.DidHandleMap .Repo.Did }}
+
<div class="flex items-center">
+
<p class="text-gray-600">
+
<a href="/{{ $userHandle }}" class="no-underline hover:underline">{{ $userHandle }}</a>
+
created
+
<a href="/{{ $userHandle }}/{{ .Repo.Name }}" class="no-underline hover:underline">{{ .Repo.Name }}</a>
+
<time class="text-gray-700">{{ .Repo.Created | timeFmt }}</time>
+
</p>
+
</div>
+
{{ else if .Follow }}
+
{{ $userHandle := index $.DidHandleMap .Follow.UserDid }}
+
{{ $subjectHandle := index $.DidHandleMap .Follow.SubjectDid }}
+
<div class="flex items-center">
+
<p class="text-gray-600">
+
<a href="/{{ $userHandle }}" class="no-underline hover:underline">{{ $userHandle }}</a>
+
followed
+
<a href="/{{ $subjectHandle }}" class="no-underline hover:underline">{{ $subjectHandle }}</a>
+
<time class="text-gray-700">{{ .Follow.FollowedAt | timeFmt }}</time>
+
</p>
+
</div>
+
{{ end }}
</div>
{{ end }}
</div>
-
{{ end }}
</div>
-
{{ end }}