Skip to content

Commit

Permalink
fix: setup default user to me
Browse files Browse the repository at this point in the history
  • Loading branch information
believer committed Apr 24, 2024
1 parent c11fda7 commit ab754ce
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 63 deletions.
3 changes: 3 additions & 0 deletions app/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ func SetupAndRunApp() error {
} else {
fmt.Println(err)
}
} else {
// Set me as default
c.Locals("UserId", "1")
}

return c.Next()
Expand Down
2 changes: 1 addition & 1 deletion public/styles.css

Large diffs are not rendered by default.

28 changes: 18 additions & 10 deletions views/feed.templ
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,11 @@ templ Feed(isAdmin bool, movies types.Movies, nextPage int) {
@Layout("", "") {
<div class="mx-auto flex max-w-xl flex-col gap-12 px-5 pt-8">
<nav class="flex items-center gap-5">
if isAdmin {
<div class="left-8 top-10 md:absolute">
@components.Link("/stats", "") {
Stats
}
</div>
}
<div class="left-8 top-10 md:absolute">
@components.Link("/stats", "") {
Stats
}
</div>
<input
class="w-full rounded-full border border-neutral-300 bg-transparent px-4 py-2 ring-offset-2 ring-offset-white placeholder:text-neutral-400 focus:outline-none focus:ring-2 focus:ring-neutral-400 dark:border-neutral-700 dark:ring-offset-neutral-900 dark:placeholder:text-neutral-600 dark:focus:ring-neutral-500"
type="search"
Expand All @@ -29,7 +27,7 @@ templ Feed(isAdmin bool, movies types.Movies, nextPage int) {
hx-target="ol"
/>
if isAdmin {
<div class="md:absolute right-8 top-10 flex gap-4">
<div class="md:absolute right-8 top-10 flex gap-4 items-center">
<a
class="fixed bottom-8 right-8 z-10 bg-neutral-700 w-14 h-14 shadow-md flex justify-center items-center rounded-full sm:bg-transparent sm:bottom-0 sm:right-0 sm:w-auto sm:h-auto sm:relative focus:outline-none focus-visible:outline-dashed focus-visible:outline-offset-8 focus-visible:outline-neutral-400 dark:focus-visible:outline-neutral-600"
href="/movies/new"
Expand All @@ -49,7 +47,17 @@ templ Feed(isAdmin bool, movies types.Movies, nextPage int) {
></path>
</svg>
</a>
<a href="/logout" hx-post="/logout">Logout</a>
<a
class="truncate border-b border-dashed border-neutral-500 focus:outline-none focus-visible:rounded-sm focus-visible:outline-dashed focus-visible:outline-offset-2 focus-visible:outline-neutral-400 dark:border-neutral-400 dark:focus-visible:outline-neutral-600"
href="/logout"
hx-post="/logout"
>Logout</a>
</div>
} else {
<div class="md:absolute right-8 top-10 flex gap-4">
@components.Link("/login", "") {
Login
}
</div>
}
</nav>
Expand Down Expand Up @@ -105,7 +113,7 @@ templ Feed(isAdmin bool, movies types.Movies, nextPage int) {
</ol>
} else {
<div class="rounded border border-dashed border-neutral-300 px-5 py-8 text-center text-neutral-500 dark:border-neutral-700 dark:text-neutral-400">
No movies seen. Need to <a class="truncate border-b border-dashed border-neutral-500 focus:outline-none focus-visible:rounded-sm focus-visible:outline-dashed focus-visible:outline-offset-2 focus-visible:outline-neutral-400 dark:border-neutral-400 dark:focus-visible:outline-neutral-600" href="/login">login</a>?
No movies seen.
</div>
}
</div>
Expand Down
105 changes: 53 additions & 52 deletions views/feed_templ.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ab754ce

Please sign in to comment.