Added username to navbar when logged in
This commit is contained in:
@@ -4,8 +4,9 @@ import (
|
|||||||
"database/sql"
|
"database/sql"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
_ "github.com/mattn/go-sqlite3"
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
|
||||||
|
_ "github.com/mattn/go-sqlite3"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Returns a database connection handle for the Turso DB
|
// Returns a database connection handle for the Turso DB
|
||||||
|
|||||||
@@ -1,23 +1,36 @@
|
|||||||
package nav
|
package nav
|
||||||
|
|
||||||
|
import "projectreshoot/contexts"
|
||||||
|
|
||||||
// Returns the right portion of the navbar
|
// Returns the right portion of the navbar
|
||||||
templ navRight() {
|
templ navRight() {
|
||||||
|
{{ user := contexts.GetUser(ctx) }}
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex items-center gap-2">
|
||||||
<div class="sm:flex sm:gap-2">
|
<div class="sm:flex sm:gap-2">
|
||||||
<a
|
if user != nil {
|
||||||
class="hidden rounded-lg px-4 py-2 sm:block
|
<a
|
||||||
|
class="hidden rounded-lg px-4 py-2 sm:block
|
||||||
|
bg-sapphire hover:bg-sapphire/75 text-mantle transition"
|
||||||
|
href="#"
|
||||||
|
>
|
||||||
|
{ user.Username }
|
||||||
|
</a>
|
||||||
|
} else {
|
||||||
|
<a
|
||||||
|
class="hidden rounded-lg px-4 py-2 sm:block
|
||||||
bg-green hover:bg-green/75 text-mantle transition"
|
bg-green hover:bg-green/75 text-mantle transition"
|
||||||
href="/login"
|
href="/login"
|
||||||
>
|
>
|
||||||
Login
|
Login
|
||||||
</a>
|
</a>
|
||||||
<a
|
<a
|
||||||
class="hidden rounded-lg px-4 py-2 sm:block
|
class="hidden rounded-lg px-4 py-2 sm:block
|
||||||
bg-blue text-mantle hover:bg-blue/75 transition"
|
bg-blue text-mantle hover:bg-blue/75 transition"
|
||||||
href="/register"
|
href="/register"
|
||||||
>
|
>
|
||||||
Register
|
Register
|
||||||
</a>
|
</a>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
<button
|
<button
|
||||||
@click="open = !open"
|
@click="open = !open"
|
||||||
|
|||||||
Reference in New Issue
Block a user