Skip to content

Commit

Permalink
Merge dev into main
Browse files Browse the repository at this point in the history
  • Loading branch information
mbaraa committed May 26, 2024
2 parents 33c4edf + 89d9e24 commit 73d01e1
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 29 deletions.
5 changes: 1 addition & 4 deletions handlers/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ func (a *Handler) OptionalAuthPage(h http.HandlerFunc) http.HandlerFunc {
return
}
ctx := context.WithValue(r.Context(), ProfileIdKey, profile.Id)
ctx = context.WithValue(ctx, FullNameKey, profile.Name)
h(w, r.WithContext(ctx))
})
}
Expand All @@ -51,7 +50,6 @@ func (a *Handler) AuthPage(h http.HandlerFunc) http.HandlerFunc {
profile, err := a.authenticate(r)
authed := err == nil
ctx := context.WithValue(r.Context(), ProfileIdKey, profile.Id)
ctx = context.WithValue(ctx, FullNameKey, profile.Name)

switch {
case authed && slices.Contains(noAuthPaths, r.URL.Path):
Expand Down Expand Up @@ -87,7 +85,6 @@ func (a *Handler) OptionalAuthApi(h http.HandlerFunc) http.HandlerFunc {
return
}
ctx := context.WithValue(r.Context(), ProfileIdKey, profile.Id)
ctx = context.WithValue(ctx, FullNameKey, profile.Name)
h(w, r.WithContext(ctx))
}
}
Expand Down Expand Up @@ -132,7 +129,7 @@ func (a *Handler) authenticate(r *http.Request) (entities.Profile, error) {
profileRepo.
GetDB().
Model(&profile).
Select("id", "name").
Select("id").
Where("username = ?", username).
First(&profile).
Error
Expand Down
1 change: 0 additions & 1 deletion handlers/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,5 @@ const (
ProfileIdKey = "profile-id"
ThemeKey = "theme-name"
IsMobileKey = "is-mobile"
FullNameKey = "full-name"
PlaylistPermission = "playlist-permission"
)
36 changes: 14 additions & 22 deletions views/components/header/header.templ
Original file line number Diff line number Diff line change
Expand Up @@ -21,36 +21,28 @@ templ homeLinkContainer() {
}

templ mobileHeader() {
<div class={ "md:hidden" }>
<div class={ "md:hidden", "flex", "flex-col", "justify-between", "gap-y-5" }>
<div class={ "w-full", "flex", "justify-between", "items-center" }>
@navlink.LinkContainer("/about", "About", icons.About())
@themeswitch.ThemeSwitch()
</div>
<div class={ "flex", "flex-col", "justify-between", "gap-y-3" }>
<div class={ "flex", "justify-center", "items-center", "flex-col", "md:flex-row", "gap-1", "h-min", "text-secondary" }>
<div
class={
"flex", "justify-center", "items-center", "flex-row",
"gap-3", "h-min", "text-secondary",
}
>
<img
width="55"
height="55"
width="50"
height="50"
src="/static/images/logo.webp"
alt="DankMuzikk Logo"
class={ "w-[55px]", "rounded-md" }
class={ "w-[50px]", "rounded-md" }
/>
<h1 class={ "text-3xl", }>DankMuzikk</h1>
</div>
<div>
<p class={ "text-secondary", "font-Ubuntu", "text-xl" }>
if fullName, ok := ctx.Value("full-name").(string); ok {
Hi { fullName } 👋
} else {
Hiyo 👋
}
<br/>
Wanna play something?
</p>
</div>
<div>
@search.Search()
</div>
@themeswitch.ThemeSwitch()
</div>
<div>
@search.Search()
</div>
</div>
}
Expand Down
2 changes: 1 addition & 1 deletion views/components/popover/popover.templ
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ templ Popover(id, title string, button, child templ.Component) {
<div
id={ fmt.Sprintf("popover-%s", id) }
class={
"hidden", "absolute", "z-30", "top-[45px]", "right-[0px]",
"hidden", "absolute", "z-50", "top-[45px]", "right-[0px]",
"shadow-md", "min-w-[150px]",
}
>
Expand Down
2 changes: 1 addition & 1 deletion views/components/search/search.templ
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ templ Search() {
</div>
</form>
<div
class={ "absolute", "top-[275px]", "md:top-[70px]", "z-50", "w-[92vw]", "md:w-[300px]", "xl:w-[500px]" }
class={ "absolute", "top-[135px]", "md:top-[70px]", "z-30", "w-[92vw]", "md:w-[300px]", "xl:w-[500px]" }
id="search-suggestions-container"
></div>
</div>
Expand Down

0 comments on commit 73d01e1

Please sign in to comment.