refactor: changed file structure

This commit is contained in:
2025-03-05 20:18:28 +11:00
parent 5c1089e0ce
commit 1d9af44d0a
137 changed files with 4986 additions and 581 deletions

View File

@@ -0,0 +1,117 @@
package account
import "projectreshoot/pkg/contexts"
templ ChangeBio(err string, bio string) {
{{
user := contexts.GetUser(ctx)
if bio == "" {
bio = user.Bio
}
}}
<form
hx-post="/change-bio"
hx-swap="outerHTML"
class="w-[90%] mx-auto mt-5"
x-data={ templ.JSFuncCall("bioComponent", bio, user.Bio, err).CallInline }
>
<script>
function bioComponent(newBio, oldBio, err) {
return {
bio: newBio,
initialBio: oldBio,
err: err,
bioLenText: '',
updateTextArea() {
this.$nextTick(() => {
if (this.$refs.bio) {
this.$refs.bio.style.height = 'auto';
this.$refs.bio.style.height = `
${this.$refs.bio.scrollHeight+20}px`;
};
this.bioLenText = `${this.bio.length}/128`;
});
},
resetBio() {
this.bio = this.initialBio;
this.err = "",
this.updateTextArea();
},
init() {
this.$nextTick(() => {
// this timeout makes sure the textarea resizes on
// page render correctly. seems 20ms is the sweet
// spot between a noticable delay and not working
setTimeout(() => {
this.updateTextArea();
}, 20);
});
}
};
}
</script>
<div
class="flex flex-col"
>
<div
class="flex flex-col sm:flex-row sm:items-center relative"
>
<label
for="bio"
class="text-lg w-20"
>Bio</label>
<div
class="relative sm:ml-5 ml-0 w-fit"
>
<textarea
type="text"
id="bio"
name="bio"
class="py-1 px-4 rounded-lg text-md
bg-surface0 border border-surface2 w-60
disabled:opacity-50 disabled:pointer-events-none"
required
aria-describedby="bio-error"
x-model="bio"
x-ref="bio"
@input="updateTextArea()"
maxlength="128"
></textarea>
<span
class="absolute right-0 pr-2 bottom-0 pb-2 text-overlay2"
x-text="bioLenText"
></span>
</div>
</div>
<div class="mt-2 sm:ml-25">
<button
class="rounded-lg bg-blue py-1 px-2 text-mantle
hover:cursor-pointer hover:bg-blue/75 transition"
x-cloak
x-show="bio !== initialBio"
x-transition.opacity.duration.500ms
>
Update
</button>
<button
class="rounded-lg bg-overlay0 py-1 px-2 text-mantle
hover:cursor-pointer hover:bg-surface2 transition"
type="button"
href="#"
x-cloak
x-show="bio !== initialBio"
x-transition.opacity.duration.500ms
@click="resetBio()"
>
Cancel
</button>
</div>
</div>
<p
class="block text-red sm:ml-26 mt-1 transition"
x-cloak
x-show="err"
x-text="err"
></p>
</form>
}

View File

@@ -0,0 +1,60 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.3.833
package account
//lint:file-ignore SA4006 This context is only used if a nested component is present.
import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
import "projectreshoot/pkg/contexts"
func ChangeBio(err string, bio string) templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
if templ_7745c5c3_Var1 == nil {
templ_7745c5c3_Var1 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
user := contexts.GetUser(ctx)
if bio == "" {
bio = user.Bio
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<form hx-post=\"/change-bio\" hx-swap=\"outerHTML\" class=\"w-[90%] mx-auto mt-5\" x-data=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var2 string
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(templ.JSFuncCall("bioComponent", bio, user.Bio, err).CallInline)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/component/account/changebio.templ`, Line: 16, Col: 74}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "\"><script>\n function bioComponent(newBio, oldBio, err) {\n return {\n bio: newBio,\n initialBio: oldBio, \n err: err,\n bioLenText: '', \n updateTextArea() {\n this.$nextTick(() => {\n if (this.$refs.bio) {\n this.$refs.bio.style.height = 'auto';\n this.$refs.bio.style.height = `\n ${this.$refs.bio.scrollHeight+20}px`;\n };\n this.bioLenText = `${this.bio.length}/128`;\n });\n },\n resetBio() {\n this.bio = this.initialBio;\n this.err = \"\",\n this.updateTextArea();\n },\n init() {\n this.$nextTick(() => {\n // this timeout makes sure the textarea resizes on \n // page render correctly. seems 20ms is the sweet\n // spot between a noticable delay and not working\n setTimeout(() => {\n this.updateTextArea();\n }, 20);\n });\n }\n };\n }\n </script><div class=\"flex flex-col\"><div class=\"flex flex-col sm:flex-row sm:items-center relative\"><label for=\"bio\" class=\"text-lg w-20\">Bio</label><div class=\"relative sm:ml-5 ml-0 w-fit\"><textarea type=\"text\" id=\"bio\" name=\"bio\" class=\"py-1 px-4 rounded-lg text-md\n bg-surface0 border border-surface2 w-60\n disabled:opacity-50 disabled:pointer-events-none\" required aria-describedby=\"bio-error\" x-model=\"bio\" x-ref=\"bio\" @input=\"updateTextArea()\" maxlength=\"128\"></textarea> <span class=\"absolute right-0 pr-2 bottom-0 pb-2 text-overlay2\" x-text=\"bioLenText\"></span></div></div><div class=\"mt-2 sm:ml-25\"><button class=\"rounded-lg bg-blue py-1 px-2 text-mantle \n hover:cursor-pointer hover:bg-blue/75 transition\" x-cloak x-show=\"bio !== initialBio\" x-transition.opacity.duration.500ms>Update</button> <button class=\"rounded-lg bg-overlay0 py-1 px-2 text-mantle\n hover:cursor-pointer hover:bg-surface2 transition\" type=\"button\" href=\"#\" x-cloak x-show=\"bio !== initialBio\" x-transition.opacity.duration.500ms @click=\"resetBio()\">Cancel</button></div></div><p class=\"block text-red sm:ml-26 mt-1 transition\" x-cloak x-show=\"err\" x-text=\"err\"></p></form>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
}
var _ = templruntime.GeneratedTemplate

View File

@@ -0,0 +1,141 @@
package account
templ ChangePassword(err string) {
<form
hx-post="/change-password"
hx-swap="outerHTML"
class="w-[90%] mx-auto mt-5"
x-data={ templ.JSFuncCall(
"passwordComponent", err,
).CallInline }
>
<script>
function passwordComponent(err) {
return {
password: "",
confirmPassword: "",
err: err,
reset() {
this.err = "";
this.password = "";
this.confirmPassword = "";
},
};
}
</script>
<div
class="flex flex-col"
>
<div
class="flex flex-col sm:flex-row sm:items-center relative w-fit"
>
<label
for="password"
class="text-lg w-40"
>New Password</label>
<input
type="password"
id="password"
name="password"
class="py-1 px-4 rounded-lg text-md
bg-surface0 border border-surface2 w-50 sm:ml-5
disabled:opacity-50 ml-0 disabled:pointer-events-none"
required
aria-describedby="password-error"
x-model="password"
/>
<div
class="absolute inset-y-0 end-0 pt-9
pointer-events-none sm:pt-2 pe-2"
x-show="err"
x-cloak
>
<svg
class="size-5 text-red"
width="16"
height="16"
fill="currentColor"
viewBox="0 0 16 16"
aria-hidden="true"
>
<path
d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM8
4a.905.905 0 0 0-.9.995l.35 3.507a.552.552 0 0
0 1.1 0l.35-3.507A.905.905 0 0 0 8 4zm.002 6a1
1 0 1 0 0 2 1 1 0 0 0 0-2z"
></path>
</svg>
</div>
</div>
<div
class="flex flex-col sm:flex-row sm:items-center relative mt-2 w-fit"
>
<label
for="confirm-password"
class="text-lg w-40"
>Confirm Password</label>
<input
type="password"
id="confirm-password"
name="confirm-password"
class="py-1 px-4 rounded-lg text-md
bg-surface0 border border-surface2 w-50 sm:ml-5
disabled:opacity-50 ml-0 disabled:pointer-events-none"
required
aria-describedby="password-error"
x-model="confirmPassword"
/>
<div
class="absolute inset-y-0 pe-2 end-0 pt-9
pointer-events-none sm:pt-2"
x-show="err"
x-cloak
>
<svg
class="size-5 text-red"
width="16"
height="16"
fill="currentColor"
viewBox="0 0 16 16"
aria-hidden="true"
>
<path
d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM8
4a.905.905 0 0 0-.9.995l.35 3.507a.552.552 0 0
0 1.1 0l.35-3.507A.905.905 0 0 0 8 4zm.002 6a1
1 0 1 0 0 2 1 1 0 0 0 0-2z"
></path>
</svg>
</div>
</div>
<div class="mt-2 sm:ml-43">
<button
class="rounded-lg bg-blue py-1 px-2 text-mantle sm:ml-2
hover:cursor-pointer hover:bg-blue/75 transition"
x-cloak
x-show="password !== '' || confirmPassword !== ''"
x-transition.opacity.duration.500ms
>
Update
</button>
<button
class="rounded-lg bg-overlay0 py-1 px-2 text-mantle
hover:cursor-pointer hover:bg-surface2 transition"
type="button"
x-cloak
x-show="password !== '' || confirmPassword !== ''"
x-transition.opacity.duration.500ms
@click="reset()"
>
Cancel
</button>
</div>
</div>
<p
class="block text-red sm:ml-45 mt-1 transition"
x-cloak
x-show="err"
x-text="err"
></p>
</form>
}

View File

@@ -0,0 +1,55 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.3.833
package account
//lint:file-ignore SA4006 This context is only used if a nested component is present.
import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
func ChangePassword(err string) templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
if templ_7745c5c3_Var1 == nil {
templ_7745c5c3_Var1 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<form hx-post=\"/change-password\" hx-swap=\"outerHTML\" class=\"w-[90%] mx-auto mt-5\" x-data=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var2 string
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(templ.JSFuncCall(
"passwordComponent", err,
).CallInline)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/component/account/changepassword.templ`, Line: 10, Col: 32}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "\"><script>\n function passwordComponent(err) {\n return {\n password: \"\",\n confirmPassword: \"\",\n err: err,\n reset() {\n this.err = \"\";\n this.password = \"\";\n this.confirmPassword = \"\";\n },\n };\n }\n </script><div class=\"flex flex-col\"><div class=\"flex flex-col sm:flex-row sm:items-center relative w-fit\"><label for=\"password\" class=\"text-lg w-40\">New Password</label> <input type=\"password\" id=\"password\" name=\"password\" class=\"py-1 px-4 rounded-lg text-md\n bg-surface0 border border-surface2 w-50 sm:ml-5\n disabled:opacity-50 ml-0 disabled:pointer-events-none\" required aria-describedby=\"password-error\" x-model=\"password\"><div class=\"absolute inset-y-0 end-0 pt-9\n pointer-events-none sm:pt-2 pe-2\" x-show=\"err\" x-cloak><svg class=\"size-5 text-red\" width=\"16\" height=\"16\" fill=\"currentColor\" viewBox=\"0 0 16 16\" aria-hidden=\"true\"><path d=\"M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM8 \n 4a.905.905 0 0 0-.9.995l.35 3.507a.552.552 0 0 \n 0 1.1 0l.35-3.507A.905.905 0 0 0 8 4zm.002 6a1 \n 1 0 1 0 0 2 1 1 0 0 0 0-2z\"></path></svg></div></div><div class=\"flex flex-col sm:flex-row sm:items-center relative mt-2 w-fit\"><label for=\"confirm-password\" class=\"text-lg w-40\">Confirm Password</label> <input type=\"password\" id=\"confirm-password\" name=\"confirm-password\" class=\"py-1 px-4 rounded-lg text-md\n bg-surface0 border border-surface2 w-50 sm:ml-5\n disabled:opacity-50 ml-0 disabled:pointer-events-none\" required aria-describedby=\"password-error\" x-model=\"confirmPassword\"><div class=\"absolute inset-y-0 pe-2 end-0 pt-9\n pointer-events-none sm:pt-2\" x-show=\"err\" x-cloak><svg class=\"size-5 text-red\" width=\"16\" height=\"16\" fill=\"currentColor\" viewBox=\"0 0 16 16\" aria-hidden=\"true\"><path d=\"M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM8 \n 4a.905.905 0 0 0-.9.995l.35 3.507a.552.552 0 0 \n 0 1.1 0l.35-3.507A.905.905 0 0 0 8 4zm.002 6a1 \n 1 0 1 0 0 2 1 1 0 0 0 0-2z\"></path></svg></div></div><div class=\"mt-2 sm:ml-43\"><button class=\"rounded-lg bg-blue py-1 px-2 text-mantle sm:ml-2\n hover:cursor-pointer hover:bg-blue/75 transition\" x-cloak x-show=\"password !== &#39;&#39; || confirmPassword !== &#39;&#39;\" x-transition.opacity.duration.500ms>Update</button> <button class=\"rounded-lg bg-overlay0 py-1 px-2 text-mantle\n hover:cursor-pointer hover:bg-surface2 transition\" type=\"button\" x-cloak x-show=\"password !== &#39;&#39; || confirmPassword !== &#39;&#39;\" x-transition.opacity.duration.500ms @click=\"reset()\">Cancel</button></div></div><p class=\"block text-red sm:ml-45 mt-1 transition\" x-cloak x-show=\"err\" x-text=\"err\"></p></form>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
}
var _ = templruntime.GeneratedTemplate

View File

@@ -0,0 +1,108 @@
package account
import "projectreshoot/pkg/contexts"
templ ChangeUsername(err string, username string) {
{{
user := contexts.GetUser(ctx)
if username == "" {
username = user.Username
}
}}
<form
hx-post="/change-username"
hx-swap="outerHTML"
class="w-[90%] mx-auto mt-5"
x-data={ templ.JSFuncCall(
"usernameComponent", username, user.Username, err,
).CallInline }
>
<script>
function usernameComponent(newUsername, oldUsername, err) {
return {
username: newUsername,
initialUsername: oldUsername,
err: err,
resetUsername() {
this.username = this.initialUsername;
this.err = "";
},
};
}
</script>
<div
class="flex flex-col sm:flex-row"
>
<div
class="flex flex-col sm:flex-row sm:items-center relative"
>
<label
for="username"
class="text-lg w-20"
>Username</label>
<input
type="text"
id="username"
name="username"
class="py-1 px-4 rounded-lg text-md
bg-surface0 border border-surface2 w-50 sm:ml-5
disabled:opacity-50 ml-0 disabled:pointer-events-none"
required
aria-describedby="username-error"
x-model="username"
/>
<div
class="absolute inset-y-0 sm:start-68 start-43 pt-9
pointer-events-none sm:pt-2"
x-show="err"
x-cloak
>
<svg
class="size-5 text-red"
width="16"
height="16"
fill="currentColor"
viewBox="0 0 16 16"
aria-hidden="true"
>
<path
d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM8
4a.905.905 0 0 0-.9.995l.35 3.507a.552.552 0 0
0 1.1 0l.35-3.507A.905.905 0 0 0 8 4zm.002 6a1
1 0 1 0 0 2 1 1 0 0 0 0-2z"
></path>
</svg>
</div>
</div>
<div class="mt-2 sm:mt-0">
<button
class="rounded-lg bg-blue py-1 px-2 text-mantle sm:ml-2
hover:cursor-pointer hover:bg-blue/75 transition"
x-cloak
x-show="username !== initialUsername"
x-transition.opacity.duration.500ms
>
Update
</button>
<button
class="rounded-lg bg-overlay0 py-1 px-2 text-mantle
hover:cursor-pointer hover:bg-surface2 transition"
type="button"
href="#"
x-cloak
x-show="username !== initialUsername"
x-transition.opacity.duration.500ms
@click="resetUsername()"
>
Cancel
</button>
</div>
</div>
<p
class="block text-red sm:ml-26 mt-1 transition"
x-cloak
x-show="err"
x-text="err"
></p>
</form>
}

View File

@@ -0,0 +1,62 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.3.833
package account
//lint:file-ignore SA4006 This context is only used if a nested component is present.
import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
import "projectreshoot/pkg/contexts"
func ChangeUsername(err string, username string) templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
if templ_7745c5c3_Var1 == nil {
templ_7745c5c3_Var1 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
user := contexts.GetUser(ctx)
if username == "" {
username = user.Username
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<form hx-post=\"/change-username\" hx-swap=\"outerHTML\" class=\"w-[90%] mx-auto mt-5\" x-data=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var2 string
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(templ.JSFuncCall(
"usernameComponent", username, user.Username, err,
).CallInline)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/component/account/changeusername.templ`, Line: 18, Col: 32}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "\"><script>\n function usernameComponent(newUsername, oldUsername, err) {\n return {\n username: newUsername,\n initialUsername: oldUsername, \n err: err,\n resetUsername() {\n this.username = this.initialUsername;\n this.err = \"\";\n },\n };\n }\n </script><div class=\"flex flex-col sm:flex-row\"><div class=\"flex flex-col sm:flex-row sm:items-center relative\"><label for=\"username\" class=\"text-lg w-20\">Username</label> <input type=\"text\" id=\"username\" name=\"username\" class=\"py-1 px-4 rounded-lg text-md\n bg-surface0 border border-surface2 w-50 sm:ml-5\n disabled:opacity-50 ml-0 disabled:pointer-events-none\" required aria-describedby=\"username-error\" x-model=\"username\"><div class=\"absolute inset-y-0 sm:start-68 start-43 pt-9\n pointer-events-none sm:pt-2\" x-show=\"err\" x-cloak><svg class=\"size-5 text-red\" width=\"16\" height=\"16\" fill=\"currentColor\" viewBox=\"0 0 16 16\" aria-hidden=\"true\"><path d=\"M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM8 \n 4a.905.905 0 0 0-.9.995l.35 3.507a.552.552 0 0 \n 0 1.1 0l.35-3.507A.905.905 0 0 0 8 4zm.002 6a1 \n 1 0 1 0 0 2 1 1 0 0 0 0-2z\"></path></svg></div></div><div class=\"mt-2 sm:mt-0\"><button class=\"rounded-lg bg-blue py-1 px-2 text-mantle sm:ml-2\n hover:cursor-pointer hover:bg-blue/75 transition\" x-cloak x-show=\"username !== initialUsername\" x-transition.opacity.duration.500ms>Update</button> <button class=\"rounded-lg bg-overlay0 py-1 px-2 text-mantle\n hover:cursor-pointer hover:bg-surface2 transition\" type=\"button\" href=\"#\" x-cloak x-show=\"username !== initialUsername\" x-transition.opacity.duration.500ms @click=\"resetUsername()\">Cancel</button></div></div><p class=\"block text-red sm:ml-26 mt-1 transition\" x-cloak x-show=\"err\" x-text=\"err\"></p></form>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
}
var _ = templruntime.GeneratedTemplate

View File

@@ -0,0 +1,26 @@
package account
templ AccountContainer(subpage string) {
<div
id="account-container"
class="flex max-w-200 min-h-100 mx-5 md:mx-auto bg-mantle mt-5 rounded-xl"
x-data="{big:window.innerWidth >=768, open:false}"
@resize.window="big = window.innerWidth >= 768"
>
@SelectMenu(subpage)
<div class="mt-5 w-full md:ml-[200px] ml-[40px] transition-all duration-300">
<div
class="pl-5 text-2xl text-subtext1 border-b
border-overlay0 w-[90%] mx-auto"
>
{ subpage }
</div>
switch subpage {
case "General":
@AccountGeneral()
case "Security":
@AccountSecurity()
}
</div>
</div>
}

View File

@@ -0,0 +1,77 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.3.833
package account
//lint:file-ignore SA4006 This context is only used if a nested component is present.
import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
func AccountContainer(subpage string) templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
if templ_7745c5c3_Var1 == nil {
templ_7745c5c3_Var1 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<div id=\"account-container\" class=\"flex max-w-200 min-h-100 mx-5 md:mx-auto bg-mantle mt-5 rounded-xl\" x-data=\"{big:window.innerWidth &gt;=768, open:false}\" @resize.window=\"big = window.innerWidth &gt;= 768\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = SelectMenu(subpage).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "<div class=\"mt-5 w-full md:ml-[200px] ml-[40px] transition-all duration-300\"><div class=\"pl-5 text-2xl text-subtext1 border-b \n border-overlay0 w-[90%] mx-auto\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var2 string
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(subpage)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/component/account/container.templ`, Line: 16, Col: 13}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "</div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
switch subpage {
case "General":
templ_7745c5c3_Err = AccountGeneral().Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
case "Security":
templ_7745c5c3_Err = AccountSecurity().Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "</div></div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
}
var _ = templruntime.GeneratedTemplate

View File

@@ -0,0 +1,8 @@
package account
templ AccountGeneral() {
<div>
@ChangeUsername("", "")
@ChangeBio("", "")
</div>
}

View File

@@ -0,0 +1,52 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.3.833
package account
//lint:file-ignore SA4006 This context is only used if a nested component is present.
import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
func AccountGeneral() templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
if templ_7745c5c3_Var1 == nil {
templ_7745c5c3_Var1 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = ChangeUsername("", "").Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = ChangeBio("", "").Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "</div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
}
var _ = templruntime.GeneratedTemplate

View File

@@ -0,0 +1,7 @@
package account
templ AccountSecurity() {
<div>
@ChangePassword("")
</div>
}

View File

@@ -0,0 +1,48 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.3.833
package account
//lint:file-ignore SA4006 This context is only used if a nested component is present.
import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
func AccountSecurity() templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
if templ_7745c5c3_Var1 == nil {
templ_7745c5c3_Var1 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = ChangePassword("").Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "</div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
}
var _ = templruntime.GeneratedTemplate

View File

@@ -0,0 +1,91 @@
package account
import "fmt"
type MenuItem struct {
name string
href string
}
func getMenuItems() []MenuItem {
return []MenuItem{
{
name: "General",
href: "general",
},
{
name: "Security",
href: "security",
},
{
name: "Preferences",
href: "preferences",
},
}
}
templ SelectMenu(activePage string) {
{{
menuItems := getMenuItems()
page := fmt.Sprintf("{page:'%s'}", activePage)
}}
<form
hx-post="/account-select-page"
hx-target="#account-container"
hx-swap="outerHTML"
class="relative"
>
<div
class="bg-surface0 border-e border-overlay0 ease-in-out
absolute top-0 left-0 z-1
rounded-l-xl h-full overflow-hidden transition-all duration-300"
x-bind:style="(open || big) ? 'width: 200px;' : 'width: 40px;'"
>
<div x-show="!big">
<button
type="button"
@click="open = !open"
class="block rounded-lg p-2.5 md:hidden transition
bg-surface0 text-subtext0 hover:text-overlay2/75"
>
<span class="sr-only">Toggle menu</span>
<svg
xmlns="http://www.w3.org/2000/svg"
class="size-5"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor"
stroke-width="2"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
d="M4 6h16M4 12h16M4 18h16"
></path>
</svg>
</button>
</div>
<div class="px-4 py-6" x-show="(open || big)">
<ul class="mt-6 space-y-1" x-data={ page }>
for _, item := range menuItems {
{{
activebind := fmt.Sprintf("page === '%s' && 'bg-mantle'", item.name)
}}
<li>
<button
type="submit"
name="subpage"
value={ item.name }
class="block rounded-lg px-4 py-2 text-md
hover:bg-mantle hover:cursor-pointer"
:class={ activebind }
>
{ item.name }
</button>
</li>
}
</ul>
</div>
</div>
</form>
}

View File

@@ -0,0 +1,131 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.3.833
package account
//lint:file-ignore SA4006 This context is only used if a nested component is present.
import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
import "fmt"
type MenuItem struct {
name string
href string
}
func getMenuItems() []MenuItem {
return []MenuItem{
{
name: "General",
href: "general",
},
{
name: "Security",
href: "security",
},
{
name: "Preferences",
href: "preferences",
},
}
}
func SelectMenu(activePage string) templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
if templ_7745c5c3_Var1 == nil {
templ_7745c5c3_Var1 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
menuItems := getMenuItems()
page := fmt.Sprintf("{page:'%s'}", activePage)
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<form hx-post=\"/account-select-page\" hx-target=\"#account-container\" hx-swap=\"outerHTML\" class=\"relative\"><div class=\"bg-surface0 border-e border-overlay0 ease-in-out\n absolute top-0 left-0 z-1\n rounded-l-xl h-full overflow-hidden transition-all duration-300\" x-bind:style=\"(open || big) ? &#39;width: 200px;&#39; : &#39;width: 40px;&#39;\"><div x-show=\"!big\"><button type=\"button\" @click=\"open = !open\" class=\"block rounded-lg p-2.5 md:hidden transition\n bg-surface0 text-subtext0 hover:text-overlay2/75\"><span class=\"sr-only\">Toggle menu</span> <svg xmlns=\"http://www.w3.org/2000/svg\" class=\"size-5\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4 6h16M4 12h16M4 18h16\"></path></svg></button></div><div class=\"px-4 py-6\" x-show=\"(open || big)\"><ul class=\"mt-6 space-y-1\" x-data=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var2 string
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(page)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/component/account/selectmenu.templ`, Line: 69, Col: 44}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
for _, item := range menuItems {
activebind := fmt.Sprintf("page === '%s' && 'bg-mantle'", item.name)
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "<li><button type=\"submit\" name=\"subpage\" value=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var3 string
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(item.name)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/component/account/selectmenu.templ`, Line: 78, Col: 25}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "\" class=\"block rounded-lg px-4 py-2 text-md\n hover:bg-mantle hover:cursor-pointer\" :class=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var4 string
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(activebind)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/component/account/selectmenu.templ`, Line: 81, Col: 27}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var5 string
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(item.name)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/component/account/selectmenu.templ`, Line: 83, Col: 19}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "</button></li>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "</ul></div></div></form>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
}
var _ = templruntime.GeneratedTemplate

View File

@@ -0,0 +1,125 @@
package footer
type FooterItem struct {
name string
href string
}
// Specify the links to show in the footer
func getFooterItems() []FooterItem {
return []FooterItem{
{
name: "About",
href: "/about",
},
{
name: "Github",
href: "https://github.com/haelnorr/projectreshoot",
},
}
}
// Returns the template fragment for the Footer
templ Footer() {
<footer class="bg-mantle mt-10">
<div
class="relative mx-auto max-w-screen-xl px-4 py-8 sm:px-6 lg:px-8"
>
<div class="absolute end-4 top-4 sm:end-6 lg:end-8">
<a
class="inline-block rounded-full bg-teal p-2 text-crust
shadow-sm transition hover:bg-teal/75"
href="#main-content"
>
<span class="sr-only">Back to top</span>
<svg
xmlns="http://www.w3.org/2000/svg"
class="size-5"
viewBox="0 0 20 20"
fill="currentColor"
>
<path
fill-rule="evenodd"
d="M14.707 12.707a1 1 0 01-1.414 0L10 9.414l-3.293
3.293a1 1 0 01-1.414-1.414l4-4a1 1 0 011.414 0l4
4a1 1 0 010 1.414z"
clip-rule="evenodd"
></path>
</svg>
</a>
</div>
<div class="lg:flex lg:items-end lg:justify-between">
<div>
<div class="flex justify-center text-text lg:justify-start">
// TODO: logo/branding here
<span class="text-2xl">Project Reshoot</span>
</div>
<p
class="mx-auto max-w-md text-center leading-relaxed
text-subtext0"
>A better way to discover and rate films</p>
</div>
<ul
class="mt-12 flex flex-wrap justify-center gap-6 md:gap-8
lg:mt-0 lg:justify-end lg:gap-12"
>
for _, item := range getFooterItems() {
<li>
<a
class="transition hover:text-subtext1"
href={ templ.SafeURL(item.href) }
>{ item.name }</a>
</li>
}
</ul>
</div>
<div class="lg:flex lg:items-end lg:justify-between">
<div>
<p class="mt-4 text-center text-sm text-overlay0">
by Haelnorr |
<a href="#">Film data</a> from
<a
href="https://www.themoviedb.org/"
class="underline hover:text-subtext0 transition"
>TMDB</a>
</p>
</div>
<div>
<div class="mt-2 text-center">
<label
for="theme-select"
class="hidden lg:inline"
>Theme</label>
<select
name="ThemeSelect"
id="theme-select"
class="mt-1.5 inline rounded-lg bg-surface0 p-2 w-fit"
x-model="theme"
>
<template
x-for="themeopt in [
'dark',
'light',
'system',
]"
>
<option
x-text="displayThemeName(themeopt)"
:value="themeopt"
:selected="theme === themeopt"
></option>
</template>
</select>
<script>
const displayThemeName = (value) => {
if (value === "dark") return "Dark (Mocha)";
if (value === "light") return "Light (Latte)";
if (value === "system") return "System";
}
</script>
</div>
</div>
</div>
</div>
</footer>
}

View File

@@ -0,0 +1,92 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.3.833
package footer
//lint:file-ignore SA4006 This context is only used if a nested component is present.
import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
type FooterItem struct {
name string
href string
}
// Specify the links to show in the footer
func getFooterItems() []FooterItem {
return []FooterItem{
{
name: "About",
href: "/about",
},
{
name: "Github",
href: "https://github.com/haelnorr/projectreshoot",
},
}
}
// Returns the template fragment for the Footer
func Footer() templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
if templ_7745c5c3_Var1 == nil {
templ_7745c5c3_Var1 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<footer class=\"bg-mantle mt-10\"><div class=\"relative mx-auto max-w-screen-xl px-4 py-8 sm:px-6 lg:px-8\"><div class=\"absolute end-4 top-4 sm:end-6 lg:end-8\"><a class=\"inline-block rounded-full bg-teal p-2 text-crust\n shadow-sm transition hover:bg-teal/75\" href=\"#main-content\"><span class=\"sr-only\">Back to top</span> <svg xmlns=\"http://www.w3.org/2000/svg\" class=\"size-5\" viewBox=\"0 0 20 20\" fill=\"currentColor\"><path fill-rule=\"evenodd\" d=\"M14.707 12.707a1 1 0 01-1.414 0L10 9.414l-3.293 \n 3.293a1 1 0 01-1.414-1.414l4-4a1 1 0 011.414 0l4 \n 4a1 1 0 010 1.414z\" clip-rule=\"evenodd\"></path></svg></a></div><div class=\"lg:flex lg:items-end lg:justify-between\"><div><div class=\"flex justify-center text-text lg:justify-start\"><span class=\"text-2xl\">Project Reshoot</span></div><p class=\"mx-auto max-w-md text-center leading-relaxed\n text-subtext0\">A better way to discover and rate films</p></div><ul class=\"mt-12 flex flex-wrap justify-center gap-6 md:gap-8\n lg:mt-0 lg:justify-end lg:gap-12\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
for _, item := range getFooterItems() {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "<li><a class=\"transition hover:text-subtext1\" href=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var2 templ.SafeURL = templ.SafeURL(item.href)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var2)))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var3 string
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(item.name)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/component/footer/footer.templ`, Line: 71, Col: 19}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "</a></li>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "</ul></div><div class=\"lg:flex lg:items-end lg:justify-between\"><div><p class=\"mt-4 text-center text-sm text-overlay0\">by Haelnorr | <a href=\"#\">Film data</a> from <a href=\"https://www.themoviedb.org/\" class=\"underline hover:text-subtext0 transition\">TMDB</a></p></div><div><div class=\"mt-2 text-center\"><label for=\"theme-select\" class=\"hidden lg:inline\">Theme</label> <select name=\"ThemeSelect\" id=\"theme-select\" class=\"mt-1.5 inline rounded-lg bg-surface0 p-2 w-fit\" x-model=\"theme\"><template x-for=\"themeopt in [\n &#39;dark&#39;,\n &#39;light&#39;,\n &#39;system&#39;,\n ]\"><option x-text=\"displayThemeName(themeopt)\" :value=\"themeopt\" :selected=\"theme === themeopt\"></option></template></select><script>\n const displayThemeName = (value) => {\n if (value === \"dark\") return \"Dark (Mocha)\";\n if (value === \"light\") return \"Light (Latte)\";\n if (value === \"system\") return \"System\";\n }\n </script></div></div></div></div></footer>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
}
var _ = templruntime.GeneratedTemplate

View File

@@ -0,0 +1,90 @@
package form
templ ConfirmPassword(err string) {
<form
hx-post="/reauthenticate"
x-data={ templ.JSFuncCall(
"confirmPassData", err,
).CallInline }
x-on:htmx:xhr:loadstart="submitted=true;buttontext='Loading...'"
>
<script>
function confirmPassData(err) {
return {
submitted: false,
buttontext: 'Confirm',
errMsg: err,
reset() {
this.err = "";
},
};
}
</script>
<div
class="grid gap-y-4"
>
<div class="mt-5">
<div class="relative">
<input
type="password"
id="password"
name="password"
class="py-3 px-4 block w-full rounded-lg text-sm
focus:border-blue focus:ring-blue bg-base
disabled:opacity-50 disabled:pointer-events-none"
placeholder="Confirm password"
required
aria-describedby="password-error"
@input="reset()"
/>
<div
class="absolute inset-y-0 end-0
pointer-events-none pe-3 pt-3"
x-show="errMsg"
x-cloak
>
<svg
class="size-5 text-red"
width="16"
height="16"
fill="currentColor"
viewBox="0 0 16 16"
aria-hidden="true"
>
<path
d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM8
4a.905.905 0 0 0-.9.995l.35 3.507a.552.552 0 0
0 1.1 0l.35-3.507A.905.905 0 0 0 8 4zm.002 6a1
1 0 1 0 0 2 1 1 0 0 0 0-2z"
></path>
</svg>
</div>
</div>
<p
class="text-center text-xs text-red mt-2"
id="password-error"
x-show="errMsg"
x-cloak
x-text="errMsg"
></p>
</div>
<button
x-bind:disabled="submitted"
x-text="buttontext"
type="submit"
class="w-full py-3 px-4 inline-flex justify-center items-center
gap-x-2 rounded-lg border border-transparent transition
bg-blue hover:bg-blue/75 text-mantle hover:cursor-pointer
disabled:bg-blue/60 disabled:cursor-default"
></button>
<button
type="button"
class="w-full py-3 px-4 inline-flex justify-center items-center
gap-x-2 rounded-lg border border-transparent transition
bg-surface2 hover:bg-surface1 hover:cursor-pointer
disabled:cursor-default"
@click="showConfirmPasswordModal=false"
>Cancel</button>
</div>
</form>
}

View File

@@ -0,0 +1,55 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.3.833
package form
//lint:file-ignore SA4006 This context is only used if a nested component is present.
import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
func ConfirmPassword(err string) templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
if templ_7745c5c3_Var1 == nil {
templ_7745c5c3_Var1 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<form hx-post=\"/reauthenticate\" x-data=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var2 string
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(templ.JSFuncCall(
"confirmPassData", err,
).CallInline)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/component/form/confirmpass.templ`, Line: 8, Col: 28}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "\" x-on:htmx:xhr:loadstart=\"submitted=true;buttontext=&#39;Loading...&#39;\"><script>\n function confirmPassData(err) {\n return {\n submitted: false,\n buttontext: 'Confirm', \n errMsg: err,\n reset() {\n this.err = \"\";\n },\n };\n }\n </script><div class=\"grid gap-y-4\"><div class=\"mt-5\"><div class=\"relative\"><input type=\"password\" id=\"password\" name=\"password\" class=\"py-3 px-4 block w-full rounded-lg text-sm\n focus:border-blue focus:ring-blue bg-base\n disabled:opacity-50 disabled:pointer-events-none\" placeholder=\"Confirm password\" required aria-describedby=\"password-error\" @input=\"reset()\"><div class=\"absolute inset-y-0 end-0 \n pointer-events-none pe-3 pt-3\" x-show=\"errMsg\" x-cloak><svg class=\"size-5 text-red\" width=\"16\" height=\"16\" fill=\"currentColor\" viewBox=\"0 0 16 16\" aria-hidden=\"true\"><path d=\"M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM8 \n 4a.905.905 0 0 0-.9.995l.35 3.507a.552.552 0 0\n 0 1.1 0l.35-3.507A.905.905 0 0 0 8 4zm.002 6a1\n 1 0 1 0 0 2 1 1 0 0 0 0-2z\"></path></svg></div></div><p class=\"text-center text-xs text-red mt-2\" id=\"password-error\" x-show=\"errMsg\" x-cloak x-text=\"errMsg\"></p></div><button x-bind:disabled=\"submitted\" x-text=\"buttontext\" type=\"submit\" class=\"w-full py-3 px-4 inline-flex justify-center items-center \n gap-x-2 rounded-lg border border-transparent transition\n bg-blue hover:bg-blue/75 text-mantle hover:cursor-pointer\n disabled:bg-blue/60 disabled:cursor-default\"></button> <button type=\"button\" class=\"w-full py-3 px-4 inline-flex justify-center items-center \n gap-x-2 rounded-lg border border-transparent transition\n bg-surface2 hover:bg-surface1 hover:cursor-pointer\n disabled:cursor-default\" @click=\"showConfirmPasswordModal=false\">Cancel</button></div></form>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
}
var _ = templruntime.GeneratedTemplate

View File

@@ -0,0 +1,161 @@
package form
// Login Form. If loginError is not an empty string, it will display the
// contents of loginError to the user.
// If loginError is "Username or password incorrect" it will also show
// error icons on the username and password field
templ LoginForm(loginError string) {
{{ credErr := "Username or password incorrect" }}
<form
hx-post="/login"
x-data={ templ.JSFuncCall(
"loginFormData", loginError, credErr,
).CallInline }
x-on:htmx:xhr:loadstart="submitted=true;buttontext='Loading...'"
>
<script>
function loginFormData(err, credError) {
return {
submitted: false,
buttontext: 'Login',
errorMessage: err,
credentialError: err === credError ? true : false,
resetErr() {
this.errorMessage = "";
this.credentialError = false;
},
};
}
</script>
<div
class="grid gap-y-4"
>
<!-- Form Group -->
<div>
<label
for="username"
class="block text-sm mb-2"
>Username</label>
<div class="relative">
<input
type="text"
idnutanix="username"
name="username"
class="py-3 px-4 block w-full rounded-lg text-sm
focus:border-blue focus:ring-blue bg-base
disabled:opacity-50
disabled:pointer-events-none"
required
aria-describedby="username-error"
@input="resetErr()"
/>
<div
class="absolute inset-y-0 end-0
pointer-events-none pe-3 pt-3"
x-show="credentialError"
x-cloak
>
<svg
class="size-5 text-red"
width="16"
height="16"
fill="currentColor"
viewBox="0 0 16 16"
aria-hidden="true"
>
<path
d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM8
4a.905.905 0 0 0-.9.995l.35 3.507a.552.552 0 0
0 1.1 0l.35-3.507A.905.905 0 0 0 8 4zm.002 6a1
1 0 1 0 0 2 1 1 0 0 0 0-2z"
></path>
</svg>
</div>
</div>
</div>
<div>
<div class="flex justify-between items-center">
<label
for="password"
class="block text-sm mb-2"
>Password</label>
<a
class="inline-flex items-center gap-x-1 text-sm
text-blue decoration-2 hover:underline
focus:outline-none focus:underline font-medium"
href="/recover-account"
tabindex="-1"
>Forgot password?</a>
</div>
<div class="relative">
<input
type="password"
id="password"
name="password"
class="py-3 px-4 block w-full rounded-lg text-sm
focus:border-blue focus:ring-blue bg-base
disabled:opacity-50 disabled:pointer-events-none"
required
aria-describedby="password-error"
@input="resetErr()"
/>
<div
class="absolute inset-y-0 end-0
pointer-events-none pe-3 pt-3"
x-show="credentialError"
x-cloak
>
<svg
class="size-5 text-red"
width="16"
height="16"
fill="currentColor"
viewBox="0 0 16 16"
aria-hidden="true"
>
<path
d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM8
4a.905.905 0 0 0-.9.995l.35 3.507a.552.552 0 0
0 1.1 0l.35-3.507A.905.905 0 0 0 8 4zm.002 6a1
1 0 1 0 0 2 1 1 0 0 0 0-2z"
></path>
</svg>
</div>
</div>
<p
class="text-center text-xs text-red mt-2"
id="password-error"
x-show="errorMessage"
x-cloak
x-text="errorMessage"
></p>
</div>
<div class="flex items-center">
<div class="flex">
<input
id="remember-me"
name="remember-me"
type="checkbox"
class="shrink-0 mt-0.5 border-gray-200 rounded
text-blue focus:ring-blue-500"
/>
</div>
<div class="ms-3">
<label
for="remember-me"
class="text-sm"
>Remember me</label>
</div>
</div>
<button
x-bind:disabled="submitted"
x-text="buttontext"
type="submit"
class="w-full py-3 px-4 inline-flex justify-center items-center
gap-x-2 rounded-lg border border-transparent transition
bg-green hover:bg-green/75 text-mantle hover:cursor-pointer
disabled:bg-green/60 disabled:cursor-default"
></button>
</div>
</form>
}

View File

@@ -0,0 +1,60 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.3.833
package form
//lint:file-ignore SA4006 This context is only used if a nested component is present.
import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
// Login Form. If loginError is not an empty string, it will display the
// contents of loginError to the user.
// If loginError is "Username or password incorrect" it will also show
// error icons on the username and password field
func LoginForm(loginError string) templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
if templ_7745c5c3_Var1 == nil {
templ_7745c5c3_Var1 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
credErr := "Username or password incorrect"
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<form hx-post=\"/login\" x-data=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var2 string
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(templ.JSFuncCall(
"loginFormData", loginError, credErr,
).CallInline)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/component/form/loginform.templ`, Line: 13, Col: 28}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "\" x-on:htmx:xhr:loadstart=\"submitted=true;buttontext=&#39;Loading...&#39;\"><script>\n function loginFormData(err, credError) {\n return {\n submitted: false,\n buttontext: 'Login',\n errorMessage: err, \n credentialError: err === credError ? true : false,\n resetErr() {\n this.errorMessage = \"\";\n this.credentialError = false;\n },\n };\n }\n </script><div class=\"grid gap-y-4\"><!-- Form Group --><div><label for=\"username\" class=\"block text-sm mb-2\">Username</label><div class=\"relative\"><input type=\"text\" idnutanix=\"username\" name=\"username\" class=\"py-3 px-4 block w-full rounded-lg text-sm\n focus:border-blue focus:ring-blue bg-base\n disabled:opacity-50 \n disabled:pointer-events-none\" required aria-describedby=\"username-error\" @input=\"resetErr()\"><div class=\"absolute inset-y-0 end-0 \n pointer-events-none pe-3 pt-3\" x-show=\"credentialError\" x-cloak><svg class=\"size-5 text-red\" width=\"16\" height=\"16\" fill=\"currentColor\" viewBox=\"0 0 16 16\" aria-hidden=\"true\"><path d=\"M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM8 \n 4a.905.905 0 0 0-.9.995l.35 3.507a.552.552 0 0 \n 0 1.1 0l.35-3.507A.905.905 0 0 0 8 4zm.002 6a1 \n 1 0 1 0 0 2 1 1 0 0 0 0-2z\"></path></svg></div></div></div><div><div class=\"flex justify-between items-center\"><label for=\"password\" class=\"block text-sm mb-2\">Password</label> <a class=\"inline-flex items-center gap-x-1 text-sm \n text-blue decoration-2 hover:underline \n focus:outline-none focus:underline font-medium\" href=\"/recover-account\" tabindex=\"-1\">Forgot password?</a></div><div class=\"relative\"><input type=\"password\" id=\"password\" name=\"password\" class=\"py-3 px-4 block w-full rounded-lg text-sm\n focus:border-blue focus:ring-blue bg-base\n disabled:opacity-50 disabled:pointer-events-none\" required aria-describedby=\"password-error\" @input=\"resetErr()\"><div class=\"absolute inset-y-0 end-0 \n pointer-events-none pe-3 pt-3\" x-show=\"credentialError\" x-cloak><svg class=\"size-5 text-red\" width=\"16\" height=\"16\" fill=\"currentColor\" viewBox=\"0 0 16 16\" aria-hidden=\"true\"><path d=\"M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM8 \n 4a.905.905 0 0 0-.9.995l.35 3.507a.552.552 0 0\n 0 1.1 0l.35-3.507A.905.905 0 0 0 8 4zm.002 6a1\n 1 0 1 0 0 2 1 1 0 0 0 0-2z\"></path></svg></div></div><p class=\"text-center text-xs text-red mt-2\" id=\"password-error\" x-show=\"errorMessage\" x-cloak x-text=\"errorMessage\"></p></div><div class=\"flex items-center\"><div class=\"flex\"><input id=\"remember-me\" name=\"remember-me\" type=\"checkbox\" class=\"shrink-0 mt-0.5 border-gray-200 rounded\n text-blue focus:ring-blue-500\"></div><div class=\"ms-3\"><label for=\"remember-me\" class=\"text-sm\">Remember me</label></div></div><button x-bind:disabled=\"submitted\" x-text=\"buttontext\" type=\"submit\" class=\"w-full py-3 px-4 inline-flex justify-center items-center \n gap-x-2 rounded-lg border border-transparent transition\n bg-green hover:bg-green/75 text-mantle hover:cursor-pointer\n disabled:bg-green/60 disabled:cursor-default\"></button></div></form>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
}
var _ = templruntime.GeneratedTemplate

View File

@@ -0,0 +1,209 @@
package form
// Login Form. If loginError is not an empty string, it will display the
// contents of loginError to the user.
templ RegisterForm(registerError string) {
{{
usernameErr := "Username is taken"
passErrs := []string{
"Password exceeds maximum length of 72 bytes",
"Passwords do not match",
}
}}
<form
hx-post="/register"
x-data={ templ.JSFuncCall(
"registerFormData", registerError, usernameErr, passErrs,
).CallInline }
x-on:htmx:xhr:loadstart="submitted=true;buttontext='Loading...'"
>
<script>
function registerFormData(err, usernameErr, passErrs) {
return {
submitted: false,
buttontext: 'Register',
errorMessage: err,
errUsername: err === usernameErr ? true : false,
errPasswords: passErrs.includes(err) ? true : false,
resetErr() {
this.errorMessage = "";
this.errUsername = false;
this.errPasswords = false;
},
};
}
</script>
<div
class="grid gap-y-4"
>
<div>
<label
for="username"
class="block text-sm mb-2"
>Username</label>
<div class="relative">
<input
type="text"
id="username"
name="username"
class="py-3 px-4 block w-full rounded-lg text-sm
focus:border-blue focus:ring-blue bg-base
disabled:opacity-50
disabled:pointer-events-none"
required
aria-describedby="username-error"
@input="resetErr()"
/>
<div
class="absolute inset-y-0 end-0
pointer-events-none pe-3 pt-3"
x-show="errUsername"
x-cloak
>
<svg
class="size-5 text-red"
width="16"
height="16"
fill="currentColor"
viewBox="0 0 16 16"
aria-hidden="true"
>
<path
d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM8
4a.905.905 0 0 0-.9.995l.35 3.507a.552.552 0 0
0 1.1 0l.35-3.507A.905.905 0 0 0 8 4zm.002 6a1
1 0 1 0 0 2 1 1 0 0 0 0-2z"
></path>
</svg>
</div>
<p
class="text-center text-xs text-red mt-2"
id="username-error"
x-show="errUsername"
x-cloak
x-text="if (errUsername) return errorMessage;"
></p>
</div>
</div>
<div>
<div class="flex justify-between items-center">
<label
for="password"
class="block text-sm mb-2"
>Password</label>
</div>
<div class="relative">
<input
type="password"
id="password"
name="password"
class="py-3 px-4 block w-full rounded-lg text-sm
focus:border-blue focus:ring-blue bg-base
disabled:opacity-50 disabled:pointer-events-none"
required
aria-describedby="password-error"
@input="resetErr()"
/>
<div
class="absolute inset-y-0 end-0
pointer-events-none pe-3 pt-3"
x-show="errPasswords"
x-cloak
>
<svg
class="size-5 text-red"
width="16"
height="16"
fill="currentColor"
viewBox="0 0 16 16"
aria-hidden="true"
>
<path
d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM8
4a.905.905 0 0 0-.9.995l.35 3.507a.552.552 0 0
0 1.1 0l.35-3.507A.905.905 0 0 0 8 4zm.002 6a1
1 0 1 0 0 2 1 1 0 0 0 0-2z"
></path>
</svg>
</div>
</div>
</div>
<div>
<div class="flex justify-between items-center">
<label
for="confirm-password"
class="block text-sm mb-2"
>Confirm Password</label>
</div>
<div class="relative">
<input
type="password"
id="confirm-password"
name="confirm-password"
class="py-3 px-4 block w-full rounded-lg text-sm
focus:border-blue focus:ring-blue bg-base
disabled:opacity-50 disabled:pointer-events-none"
required
aria-describedby="confirm-password-error"
@input="resetErr()"
/>
<div
class="absolute inset-y-0 end-0
pointer-events-none pe-3 pt-3"
x-show="errPasswords"
x-cloak
>
<svg
class="size-5 text-red"
width="16"
height="16"
fill="currentColor"
viewBox="0 0 16 16"
aria-hidden="true"
>
<path
d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM8
4a.905.905 0 0 0-.9.995l.35 3.507a.552.552 0 0
0 1.1 0l.35-3.507A.905.905 0 0 0 8 4zm.002 6a1
1 0 1 0 0 2 1 1 0 0 0 0-2z"
></path>
</svg>
</div>
</div>
<p
class="text-center text-xs text-red mt-2"
id="password-error"
x-show="errPasswords"
x-cloak
x-text="if (errPasswords) return errorMessage;"
></p>
</div>
<div class="flex items-center">
<div class="flex">
<input
id="remember-me"
name="remember-me"
type="checkbox"
class="shrink-0 mt-0.5 border-gray-200 rounded
text-blue focus:ring-blue-500"
/>
</div>
<div class="ms-3">
<label
for="remember-me"
class="text-sm"
>Remember me</label>
</div>
</div>
<button
x-bind:disabled="submitted"
x-text="buttontext"
type="submit"
class="w-full py-3 px-4 inline-flex justify-center items-center
gap-x-2 rounded-lg border border-transparent transition
bg-green hover:bg-green/75 text-mantle hover:cursor-pointer
disabled:bg-green/60 disabled:cursor-default"
></button>
</div>
</form>
}

View File

@@ -0,0 +1,63 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.3.833
package form
//lint:file-ignore SA4006 This context is only used if a nested component is present.
import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
// Login Form. If loginError is not an empty string, it will display the
// contents of loginError to the user.
func RegisterForm(registerError string) templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
if templ_7745c5c3_Var1 == nil {
templ_7745c5c3_Var1 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
usernameErr := "Username is taken"
passErrs := []string{
"Password exceeds maximum length of 72 bytes",
"Passwords do not match",
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<form hx-post=\"/register\" x-data=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var2 string
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(templ.JSFuncCall(
"registerFormData", registerError, usernameErr, passErrs,
).CallInline)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/component/form/registerform.templ`, Line: 17, Col: 28}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "\" x-on:htmx:xhr:loadstart=\"submitted=true;buttontext=&#39;Loading...&#39;\"><script>\n function registerFormData(err, usernameErr, passErrs) {\n return {\n submitted: false,\n buttontext: 'Register',\n errorMessage: err, \n errUsername: err === usernameErr ? true : false, \n errPasswords: passErrs.includes(err) ? true : false,\n resetErr() {\n this.errorMessage = \"\";\n this.errUsername = false;\n this.errPasswords = false;\n },\n };\n }\n </script><div class=\"grid gap-y-4\"><div><label for=\"username\" class=\"block text-sm mb-2\">Username</label><div class=\"relative\"><input type=\"text\" id=\"username\" name=\"username\" class=\"py-3 px-4 block w-full rounded-lg text-sm\n focus:border-blue focus:ring-blue bg-base\n disabled:opacity-50 \n disabled:pointer-events-none\" required aria-describedby=\"username-error\" @input=\"resetErr()\"><div class=\"absolute inset-y-0 end-0 \n pointer-events-none pe-3 pt-3\" x-show=\"errUsername\" x-cloak><svg class=\"size-5 text-red\" width=\"16\" height=\"16\" fill=\"currentColor\" viewBox=\"0 0 16 16\" aria-hidden=\"true\"><path d=\"M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM8 \n 4a.905.905 0 0 0-.9.995l.35 3.507a.552.552 0 0 \n 0 1.1 0l.35-3.507A.905.905 0 0 0 8 4zm.002 6a1 \n 1 0 1 0 0 2 1 1 0 0 0 0-2z\"></path></svg></div><p class=\"text-center text-xs text-red mt-2\" id=\"username-error\" x-show=\"errUsername\" x-cloak x-text=\"if (errUsername) return errorMessage;\"></p></div></div><div><div class=\"flex justify-between items-center\"><label for=\"password\" class=\"block text-sm mb-2\">Password</label></div><div class=\"relative\"><input type=\"password\" id=\"password\" name=\"password\" class=\"py-3 px-4 block w-full rounded-lg text-sm\n focus:border-blue focus:ring-blue bg-base\n disabled:opacity-50 disabled:pointer-events-none\" required aria-describedby=\"password-error\" @input=\"resetErr()\"><div class=\"absolute inset-y-0 end-0 \n pointer-events-none pe-3 pt-3\" x-show=\"errPasswords\" x-cloak><svg class=\"size-5 text-red\" width=\"16\" height=\"16\" fill=\"currentColor\" viewBox=\"0 0 16 16\" aria-hidden=\"true\"><path d=\"M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM8 \n 4a.905.905 0 0 0-.9.995l.35 3.507a.552.552 0 0\n 0 1.1 0l.35-3.507A.905.905 0 0 0 8 4zm.002 6a1\n 1 0 1 0 0 2 1 1 0 0 0 0-2z\"></path></svg></div></div></div><div><div class=\"flex justify-between items-center\"><label for=\"confirm-password\" class=\"block text-sm mb-2\">Confirm Password</label></div><div class=\"relative\"><input type=\"password\" id=\"confirm-password\" name=\"confirm-password\" class=\"py-3 px-4 block w-full rounded-lg text-sm\n focus:border-blue focus:ring-blue bg-base\n disabled:opacity-50 disabled:pointer-events-none\" required aria-describedby=\"confirm-password-error\" @input=\"resetErr()\"><div class=\"absolute inset-y-0 end-0 \n pointer-events-none pe-3 pt-3\" x-show=\"errPasswords\" x-cloak><svg class=\"size-5 text-red\" width=\"16\" height=\"16\" fill=\"currentColor\" viewBox=\"0 0 16 16\" aria-hidden=\"true\"><path d=\"M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM8 \n 4a.905.905 0 0 0-.9.995l.35 3.507a.552.552 0 0\n 0 1.1 0l.35-3.507A.905.905 0 0 0 8 4zm.002 6a1\n 1 0 1 0 0 2 1 1 0 0 0 0-2z\"></path></svg></div></div><p class=\"text-center text-xs text-red mt-2\" id=\"password-error\" x-show=\"errPasswords\" x-cloak x-text=\"if (errPasswords) return errorMessage;\"></p></div><div class=\"flex items-center\"><div class=\"flex\"><input id=\"remember-me\" name=\"remember-me\" type=\"checkbox\" class=\"shrink-0 mt-0.5 border-gray-200 rounded\n text-blue focus:ring-blue-500\"></div><div class=\"ms-3\"><label for=\"remember-me\" class=\"text-sm\">Remember me</label></div></div><button x-bind:disabled=\"submitted\" x-text=\"buttontext\" type=\"submit\" class=\"w-full py-3 px-4 inline-flex justify-center items-center \n gap-x-2 rounded-lg border border-transparent transition\n bg-green hover:bg-green/75 text-mantle hover:cursor-pointer\n disabled:bg-green/60 disabled:cursor-default\"></button></div></form>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
}
var _ = templruntime.GeneratedTemplate

View File

@@ -0,0 +1,41 @@
package nav
type NavItem struct {
name string // Label to display
href string // Link reference
}
// Return the list of navbar links
func getNavItems() []NavItem {
return []NavItem{
{
name: "Movies",
href: "/movies",
},
}
}
// Returns the navbar template fragment
templ Navbar() {
{{ navItems := getNavItems() }}
<div x-data="{ open: false }">
<header class="bg-crust">
<div
class="mx-auto flex h-16 max-w-screen-xl items-center gap-8
px-4 sm:px-6 lg:px-8"
>
<a class="block" href="/">
<!-- logo here -->
<span class="text-3xl font-bold transition hover:text-green">
<span class="hidden sm:inline">Project</span> Reshoot
</span>
</a>
<div class="flex flex-1 items-center justify-end sm:justify-between">
@navLeft(navItems)
@navRight()
</div>
</div>
</header>
@sideNav(navItems)
</div>
}

View File

@@ -0,0 +1,77 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.3.833
package nav
//lint:file-ignore SA4006 This context is only used if a nested component is present.
import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
type NavItem struct {
name string // Label to display
href string // Link reference
}
// Return the list of navbar links
func getNavItems() []NavItem {
return []NavItem{
{
name: "Movies",
href: "/movies",
},
}
}
// Returns the navbar template fragment
func Navbar() templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
if templ_7745c5c3_Var1 == nil {
templ_7745c5c3_Var1 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
navItems := getNavItems()
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<div x-data=\"{ open: false }\"><header class=\"bg-crust\"><div class=\"mx-auto flex h-16 max-w-screen-xl items-center gap-8\n px-4 sm:px-6 lg:px-8\"><a class=\"block\" href=\"/\"><!-- logo here --><span class=\"text-3xl font-bold transition hover:text-green\"><span class=\"hidden sm:inline\">Project</span> Reshoot</span></a><div class=\"flex flex-1 items-center justify-end sm:justify-between\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = navLeft(navItems).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = navRight().Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "</div></div></header>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = sideNav(navItems).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "</div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
}
var _ = templruntime.GeneratedTemplate

View File

@@ -0,0 +1,19 @@
package nav
// Returns the left portion of the navbar
templ navLeft(navItems []NavItem) {
<nav aria-label="Global" class="hidden sm:block">
<ul class="flex items-center gap-6 text-xl">
for _, item := range navItems {
<li>
<a
class="text-subtext1 hover:text-green transition"
href={ templ.SafeURL(item.href) }
>
{ item.name }
</a>
</li>
}
</ul>
</nav>
}

View File

@@ -0,0 +1,73 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.3.833
package nav
//lint:file-ignore SA4006 This context is only used if a nested component is present.
import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
// Returns the left portion of the navbar
func navLeft(navItems []NavItem) templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
if templ_7745c5c3_Var1 == nil {
templ_7745c5c3_Var1 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<nav aria-label=\"Global\" class=\"hidden sm:block\"><ul class=\"flex items-center gap-6 text-xl\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
for _, item := range navItems {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "<li><a class=\"text-subtext1 hover:text-green transition\" href=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var2 templ.SafeURL = templ.SafeURL(item.href)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var2)))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var3 string
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(item.name)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/component/nav/navbarleft.templ`, Line: 13, Col: 17}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "</a></li>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "</ul></nav>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
}
var _ = templruntime.GeneratedTemplate

View File

@@ -0,0 +1,122 @@
package nav
import "projectreshoot/pkg/contexts"
type ProfileItem struct {
name string // Label to display
href string // Link reference
}
// Return the list of profile links
func getProfileItems() []ProfileItem {
return []ProfileItem{
{
name: "Profile",
href: "/profile",
},
{
name: "Account",
href: "/account",
},
}
}
// Returns the right portion of the navbar
templ navRight() {
{{ user := contexts.GetUser(ctx) }}
{{ items := getProfileItems() }}
<div class="flex items-center gap-2">
<div class="sm:flex sm:gap-2">
if user != nil {
<div x-data="{ isActive: false }" class="relative">
<div
class="inline-flex items-center overflow-hidden
rounded-lg bg-sapphire hover:bg-sapphire/75 transition"
>
<button
x-on:click="isActive = !isActive"
class="h-full py-2 px-4 text-mantle hover:cursor-pointer"
>
<span class="sr-only">Profile</span>
{ user.Username }
</button>
</div>
<div
class="absolute end-0 z-10 mt-2 w-36 divide-y
divide-surface2 rounded-lg border border-surface1
bg-surface0 shadow-lg"
role="menu"
x-cloak
x-transition
x-show="isActive"
x-on:click.away="isActive = false"
x-on:keydown.escape.window="isActive = false"
>
<div class="p-2">
for _, item := range items {
<a
href={ templ.SafeURL(item.href) }
class="block rounded-lg px-4 py-2 text-md
hover:bg-crust"
role="menuitem"
>
{ item.name }
</a>
}
</div>
<div class="p-2">
<form hx-post="/logout">
<button
type="submit"
class="flex w-full items-center gap-2
rounded-lg px-4 py-2 text-md text-red
hover:bg-red/25 hover:cursor-pointer"
role="menuitem"
@click="isActive=false"
>
Logout
</button>
</form>
</div>
</div>
</div>
} else {
<a
class="hidden rounded-lg px-4 py-2 sm:block
bg-green hover:bg-green/75 text-mantle transition"
href="/login"
>
Login
</a>
<a
class="hidden rounded-lg px-4 py-2 sm:block
bg-blue text-mantle hover:bg-blue/75 transition"
href="/register"
>
Register
</a>
}
</div>
<button
@click="open = !open"
class="block rounded-lg p-2.5 sm:hidden transition
bg-surface0 text-subtext0 hover:text-overlay2/75"
>
<span class="sr-only">Toggle menu</span>
<svg
xmlns="http://www.w3.org/2000/svg"
class="size-5"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor"
stroke-width="2"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
d="M4 6h16M4 12h16M4 18h16"
></path>
</svg>
</button>
</div>
}

View File

@@ -0,0 +1,124 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.3.833
package nav
//lint:file-ignore SA4006 This context is only used if a nested component is present.
import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
import "projectreshoot/pkg/contexts"
type ProfileItem struct {
name string // Label to display
href string // Link reference
}
// Return the list of profile links
func getProfileItems() []ProfileItem {
return []ProfileItem{
{
name: "Profile",
href: "/profile",
},
{
name: "Account",
href: "/account",
},
}
}
// Returns the right portion of the navbar
func navRight() templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
if templ_7745c5c3_Var1 == nil {
templ_7745c5c3_Var1 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
user := contexts.GetUser(ctx)
items := getProfileItems()
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<div class=\"flex items-center gap-2\"><div class=\"sm:flex sm:gap-2\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
if user != nil {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "<div x-data=\"{ isActive: false }\" class=\"relative\"><div class=\"inline-flex items-center overflow-hidden\n rounded-lg bg-sapphire hover:bg-sapphire/75 transition\"><button x-on:click=\"isActive = !isActive\" class=\"h-full py-2 px-4 text-mantle hover:cursor-pointer\"><span class=\"sr-only\">Profile</span> ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var2 string
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(user.Username)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/component/nav/navbarright.templ`, Line: 41, Col: 22}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "</button></div><div class=\"absolute end-0 z-10 mt-2 w-36 divide-y \n divide-surface2 rounded-lg border border-surface1 \n bg-surface0 shadow-lg\" role=\"menu\" x-cloak x-transition x-show=\"isActive\" x-on:click.away=\"isActive = false\" x-on:keydown.escape.window=\"isActive = false\"><div class=\"p-2\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
for _, item := range items {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "<a href=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var3 templ.SafeURL = templ.SafeURL(item.href)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var3)))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "\" class=\"block rounded-lg px-4 py-2 text-md \n hover:bg-crust\" role=\"menuitem\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var4 string
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(item.name)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/component/nav/navbarright.templ`, Line: 63, Col: 20}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "</a>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "</div><div class=\"p-2\"><form hx-post=\"/logout\"><button type=\"submit\" class=\"flex w-full items-center gap-2\n rounded-lg px-4 py-2 text-md text-red \n hover:bg-red/25 hover:cursor-pointer\" role=\"menuitem\" @click=\"isActive=false\">Logout</button></form></div></div></div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
} else {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, "<a class=\"hidden rounded-lg px-4 py-2 sm:block \n bg-green hover:bg-green/75 text-mantle transition\" href=\"/login\">Login</a> <a class=\"hidden rounded-lg px-4 py-2 sm:block\n bg-blue text-mantle hover:bg-blue/75 transition\" href=\"/register\">Register</a>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, "</div><button @click=\"open = !open\" class=\"block rounded-lg p-2.5 sm:hidden transition\n bg-surface0 text-subtext0 hover:text-overlay2/75\"><span class=\"sr-only\">Toggle menu</span> <svg xmlns=\"http://www.w3.org/2000/svg\" class=\"size-5\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4 6h16M4 12h16M4 18h16\"></path></svg></button></div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
}
var _ = templruntime.GeneratedTemplate

View File

@@ -0,0 +1,53 @@
package nav
import "projectreshoot/pkg/contexts"
// Returns the mobile version of the navbar thats only visible when activated
templ sideNav(navItems []NavItem) {
{{ user := contexts.GetUser(ctx) }}
<div
x-show="open"
x-transition
class="absolute w-full bg-mantle sm:hidden z-10"
>
<div class="px-4 py-6">
<ul class="space-y-1">
for _, item := range navItems {
<li>
<a
href={ templ.SafeURL(item.href) }
class="block rounded-lg px-4 py-2 text-lg
bg-surface0 text-text transition hover:bg-surface2"
>
{ item.name }
</a>
</li>
}
</ul>
</div>
if user == nil {
<div class="px-4 pb-6">
<ul class="space-y-1">
<li class="flex justify-center items-center gap-2">
<a
class="w-26 px-4 py-2 rounded-lg
bg-green text-mantle transition hover:bg-green/75
text-center"
href="/login"
>
Login
</a>
<a
class="w-26 px-4 py-2 rounded-lg
bg-blue text-mantle transition hover:bg-blue/75
text-center"
href="/register"
>
Register
</a>
</li>
</ul>
</div>
}
</div>
}

View File

@@ -0,0 +1,86 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.3.833
package nav
//lint:file-ignore SA4006 This context is only used if a nested component is present.
import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
import "projectreshoot/pkg/contexts"
// Returns the mobile version of the navbar thats only visible when activated
func sideNav(navItems []NavItem) templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
if templ_7745c5c3_Var1 == nil {
templ_7745c5c3_Var1 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
user := contexts.GetUser(ctx)
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<div x-show=\"open\" x-transition class=\"absolute w-full bg-mantle sm:hidden z-10\"><div class=\"px-4 py-6\"><ul class=\"space-y-1\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
for _, item := range navItems {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "<li><a href=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var2 templ.SafeURL = templ.SafeURL(item.href)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var2)))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "\" class=\"block rounded-lg px-4 py-2 text-lg\n bg-surface0 text-text transition hover:bg-surface2\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var3 string
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(item.name)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/component/nav/sidenav.templ`, Line: 22, Col: 18}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "</a></li>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "</ul></div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
if user == nil {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "<div class=\"px-4 pb-6\"><ul class=\"space-y-1\"><li class=\"flex justify-center items-center gap-2\"><a class=\"w-26 px-4 py-2 rounded-lg\n bg-green text-mantle transition hover:bg-green/75\n text-center\" href=\"/login\">Login</a> <a class=\"w-26 px-4 py-2 rounded-lg\n bg-blue text-mantle transition hover:bg-blue/75\n text-center\" href=\"/register\">Register</a></li></ul></div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "</div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
}
var _ = templruntime.GeneratedTemplate

View File

@@ -0,0 +1,21 @@
package popup
import "projectreshoot/internal/view/component/form"
templ ConfirmPasswordModal() {
<div
class="z-50 absolute bg-overlay0/55 top-0 left-0 right-0 bottom-0"
x-show="showConfirmPasswordModal"
x-cloak
>
<div
class="p-5 mt-25 w-fit max-w-100 text-center rounded-lg bg-mantle mx-auto"
>
<div class="text-xl">
To complete this action you need to confirm your password
</div>
@form.ConfirmPassword("")
</div>
</div>
}

View File

@@ -0,0 +1,51 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.3.833
package popup
//lint:file-ignore SA4006 This context is only used if a nested component is present.
import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
import "projectreshoot/internal/view/component/form"
func ConfirmPasswordModal() templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
if templ_7745c5c3_Var1 == nil {
templ_7745c5c3_Var1 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<div class=\"z-50 absolute bg-overlay0/55 top-0 left-0 right-0 bottom-0\" x-show=\"showConfirmPasswordModal\" x-cloak><div class=\"p-5 mt-25 w-fit max-w-100 text-center rounded-lg bg-mantle mx-auto\"><div class=\"text-xl\">To complete this action you need to confirm your password</div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = form.ConfirmPassword("").Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "</div></div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
}
var _ = templruntime.GeneratedTemplate

View File

@@ -0,0 +1,63 @@
package popup
templ Error500Popup() {
<div
x-cloak
x-show="showError500"
class="absolute w-82 left-0 right-0 mt-20 mr-5 ml-auto"
x-transition:enter="transform translate-x-[100%] opacity-0 duration-200"
x-transition:enter-start="opacity-0 translate-x-[100%]"
x-transition:enter-end="opacity-100 translate-x-0"
x-transition:leave="opacity-0 duration-200"
x-transition:leave-start="opacity-100 translate-x-0"
x-transition:leave-end="opacity-0 translate-x-[100%]"
>
<div
role="alert"
class="rounded-sm bg-dark-red p-4"
>
<div class="flex justify-between">
<div class="flex items-center gap-2 text-red w-fit">
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
fill="currentColor"
class="size-5"
>
<path
fill-rule="evenodd"
d="M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355
12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309
0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75
0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0
01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z"
clip-rule="evenodd"
></path>
</svg>
<strong class="block font-medium">Something went wrong </strong>
</div>
<div class="flex">
<svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
stroke-width="1.5"
stroke="currentColor"
class="size-6 text-subtext0 hover:cursor-pointer"
@click="showError500=false"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
d="M6 18L18 6M6 6l12 12"
></path>
</svg>
</div>
</div>
<p class="mt-2 text-sm text-red">
An error occured on the server. Please try again later,
or contact an administrator
</p>
</div>
</div>
}

View File

@@ -0,0 +1,40 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.3.833
package popup
//lint:file-ignore SA4006 This context is only used if a nested component is present.
import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
func Error500Popup() templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
if templ_7745c5c3_Var1 == nil {
templ_7745c5c3_Var1 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<div x-cloak x-show=\"showError500\" class=\"absolute w-82 left-0 right-0 mt-20 mr-5 ml-auto\" x-transition:enter=\"transform translate-x-[100%] opacity-0 duration-200\" x-transition:enter-start=\"opacity-0 translate-x-[100%]\" x-transition:enter-end=\"opacity-100 translate-x-0\" x-transition:leave=\"opacity-0 duration-200\" x-transition:leave-start=\"opacity-100 translate-x-0\" x-transition:leave-end=\"opacity-0 translate-x-[100%]\"><div role=\"alert\" class=\"rounded-sm bg-dark-red p-4\"><div class=\"flex justify-between\"><div class=\"flex items-center gap-2 text-red w-fit\"><svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\" class=\"size-5\"><path fill-rule=\"evenodd\" d=\"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 \n 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 \n 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 \n 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 \n 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z\" clip-rule=\"evenodd\"></path></svg> <strong class=\"block font-medium\">Something went wrong </strong></div><div class=\"flex\"><svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\" stroke-width=\"1.5\" stroke=\"currentColor\" class=\"size-6 text-subtext0 hover:cursor-pointer\" @click=\"showError500=false\"><path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M6 18L18 6M6 6l12 12\"></path></svg></div></div><p class=\"mt-2 text-sm text-red\">An error occured on the server. Please try again later, or contact an administrator</p></div></div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
}
var _ = templruntime.GeneratedTemplate

View File

@@ -0,0 +1,63 @@
package popup
templ Error503Popup() {
<div
x-cloak
x-show="showError503"
class="absolute w-82 left-0 right-0 mt-20 mr-5 ml-auto"
x-transition:enter="transform translate-x-[100%] opacity-0 duration-200"
x-transition:enter-start="opacity-0 translate-x-[100%]"
x-transition:enter-end="opacity-100 translate-x-0"
x-transition:leave="opacity-0 duration-200"
x-transition:leave-start="opacity-100 translate-x-0"
x-transition:leave-end="opacity-0 translate-x-[100%]"
>
<div
role="alert"
class="rounded-sm bg-dark-red p-4"
>
<div class="flex justify-between">
<div class="flex items-center gap-2 text-red w-fit">
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
fill="currentColor"
class="size-5"
>
<path
fill-rule="evenodd"
d="M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355
12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309
0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75
0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0
01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z"
clip-rule="evenodd"
></path>
</svg>
<strong class="block font-medium">Service Unavailable</strong>
</div>
<div class="flex">
<svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
stroke-width="1.5"
stroke="currentColor"
class="size-6 text-subtext0 hover:cursor-pointer"
@click="showError503=false"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
d="M6 18L18 6M6 6l12 12"
></path>
</svg>
</div>
</div>
<p class="mt-2 text-sm text-red">
The service is currently available. It could be down for maintenance.
Please try again later.
</p>
</div>
</div>
}

View File

@@ -0,0 +1,40 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.3.833
package popup
//lint:file-ignore SA4006 This context is only used if a nested component is present.
import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
func Error503Popup() templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
if templ_7745c5c3_Var1 == nil {
templ_7745c5c3_Var1 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<div x-cloak x-show=\"showError503\" class=\"absolute w-82 left-0 right-0 mt-20 mr-5 ml-auto\" x-transition:enter=\"transform translate-x-[100%] opacity-0 duration-200\" x-transition:enter-start=\"opacity-0 translate-x-[100%]\" x-transition:enter-end=\"opacity-100 translate-x-0\" x-transition:leave=\"opacity-0 duration-200\" x-transition:leave-start=\"opacity-100 translate-x-0\" x-transition:leave-end=\"opacity-0 translate-x-[100%]\"><div role=\"alert\" class=\"rounded-sm bg-dark-red p-4\"><div class=\"flex justify-between\"><div class=\"flex items-center gap-2 text-red w-fit\"><svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\" class=\"size-5\"><path fill-rule=\"evenodd\" d=\"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 \n 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 \n 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 \n 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 \n 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z\" clip-rule=\"evenodd\"></path></svg> <strong class=\"block font-medium\">Service Unavailable</strong></div><div class=\"flex\"><svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\" stroke-width=\"1.5\" stroke=\"currentColor\" class=\"size-6 text-subtext0 hover:cursor-pointer\" @click=\"showError503=false\"><path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M6 18L18 6M6 6l12 12\"></path></svg></div></div><p class=\"mt-2 text-sm text-red\">The service is currently available. It could be down for maintenance. Please try again later.</p></div></div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
}
var _ = templruntime.GeneratedTemplate

View File

@@ -0,0 +1,44 @@
package search
import "projectreshoot/pkg/tmdb"
import "fmt"
templ MovieResults(movies *tmdb.ResultMovies, image *tmdb.Image) {
for _, movie := range movies.Results {
<div
class="bg-surface0 p-4 rounded-lg shadow-lg flex
items-start space-x-4"
>
<img
src={ movie.GetPoster(image, "w92") }
alt="Movie Poster"
class="rounded-lg object-cover"
width="96"
height="144"
onerror="this.onerror=null; setFallbackColor(this);"
/>
<script>
function setFallbackColor(img) {
const baseColor = getComputedStyle(document.documentElement).
getPropertyValue('--base').trim();
img.src = `data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='144'%3E%3Crect width='100%' height='100%' fill='${baseColor}'/%3E%3C/svg%3E`;
}
</script>
<div>
<a
href={ templ.SafeURL(fmt.Sprintf("/movie/%v", movie.ID)) }
class="text-xl font-semibold transition hover:text-green"
>{ movie.Title } { movie.ReleaseYear() }</a>
<p class="text-subtext0">
Released:
<span class="font-medium">{ movie.ReleaseDate }</span>
</p>
<p class="text-subtext0">
Original Title:
<span class="font-medium">{ movie.OriginalTitle }</span>
</p>
<p class="text-subtext0">{ movie.Overview }</p>
</div>
</div>
}
}

View File

@@ -0,0 +1,132 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.3.833
package search
//lint:file-ignore SA4006 This context is only used if a nested component is present.
import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
import "projectreshoot/pkg/tmdb"
import "fmt"
func MovieResults(movies *tmdb.ResultMovies, image *tmdb.Image) templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
if templ_7745c5c3_Var1 == nil {
templ_7745c5c3_Var1 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
for _, movie := range movies.Results {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<div class=\"bg-surface0 p-4 rounded-lg shadow-lg flex \n items-start space-x-4\"><img src=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var2 string
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(movie.GetPoster(image, "w92"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/component/search/movies_results.templ`, Line: 13, Col: 39}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "\" alt=\"Movie Poster\" class=\"rounded-lg object-cover\" width=\"96\" height=\"144\" onerror=\"this.onerror=null; setFallbackColor(this);\"><script>\n function setFallbackColor(img) {\n const baseColor = getComputedStyle(document.documentElement).\n getPropertyValue('--base').trim();\n img.src = `data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='144'%3E%3Crect width='100%' height='100%' fill='${baseColor}'/%3E%3C/svg%3E`;\n }\n </script><div><a href=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var3 templ.SafeURL = templ.SafeURL(fmt.Sprintf("/movie/%v", movie.ID))
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var3)))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "\" class=\"text-xl font-semibold transition hover:text-green\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var4 string
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(movie.Title)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/component/search/movies_results.templ`, Line: 31, Col: 18}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, " ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var5 string
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(movie.ReleaseYear())
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/component/search/movies_results.templ`, Line: 31, Col: 42}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "</a><p class=\"text-subtext0\">Released: <span class=\"font-medium\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var6 string
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(movie.ReleaseDate)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/component/search/movies_results.templ`, Line: 34, Col: 50}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "</span></p><p class=\"text-subtext0\">Original Title: <span class=\"font-medium\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var7 string
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(movie.OriginalTitle)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/component/search/movies_results.templ`, Line: 38, Col: 52}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "</span></p><p class=\"text-subtext0\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var8 string
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(movie.Overview)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/component/search/movies_results.templ`, Line: 40, Col: 45}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, "</p></div></div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
return nil
})
}
var _ = templruntime.GeneratedTemplate

View File

@@ -0,0 +1,107 @@
package layout
import "projectreshoot/internal/view/component/nav"
import "projectreshoot/internal/view/component/footer"
import "projectreshoot/internal/view/component/popup"
// Global page layout. Includes HTML document settings, header tags
// navbar and footer
templ Global(title string) {
<!DOCTYPE html>
<html
lang="en"
x-data="{
theme: localStorage.getItem('theme')
|| 'system'}"
x-init="$watch('theme', (val) => localStorage.setItem('theme', val))"
x-bind:class="{'dark': theme === 'dark' || (theme === 'system' &&
window.matchMedia('(prefers-color-scheme: dark)').matches)}"
>
<head>
<script>
(function () {
let theme = localStorage.getItem("theme") || "system";
if (theme === "system") {
theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
}
if (theme === "dark") {
document.documentElement.classList.add("dark");
} else {
document.documentElement.classList.remove("dark");
}
})();
</script>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>{ title }</title>
<link rel="icon" type="image/x-icon" href="/static/favicon.ico"/>
<link href="/static/css/output.css" rel="stylesheet"/>
<script src="https://unpkg.com/htmx.org@2.0.4" integrity="sha384-HGfztofotfshcF7+8n44JQL2oJmowVChPTg48S+jvZoztPfvwD79OC/LTtG6dMp+" crossorigin="anonymous"></script>
<script defer src="https://cdn.jsdelivr.net/npm/@alpinejs/persist@3.x.x/dist/cdn.min.js"></script>
<script src="https://unpkg.com/alpinejs" defer></script>
<script>
// uncomment this line to enable logging of htmx events
// htmx.logAll();
</script>
<script>
const bodyData = {
showError500: false,
showError503: false,
showConfirmPasswordModal: false,
handleHtmxBeforeOnLoad(event) {
const requestPath = event.detail.pathInfo.requestPath;
if (requestPath === "/reauthenticate") {
// handle password incorrect on refresh attempt
if (event.detail.xhr.status === 445) {
event.detail.shouldSwap = true;
event.detail.isError = false;
} else if (event.detail.xhr.status === 200) {
this.showConfirmPasswordModal = false;
}
}
},
// handle errors from the server on HTMX requests
handleHtmxError(event) {
const errorCode = event.detail.errorInfo.error;
// internal server error
if (errorCode.includes('Code 500')) {
this.showError500 = true;
setTimeout(() => this.showError500 = false, 6000);
}
// service not available error
if (errorCode.includes('Code 503')) {
this.showError503 = true;
setTimeout(() => this.showError503 = false, 6000);
}
// user is authorized but needs to refresh their login
if (errorCode.includes('Code 444')) {
this.showConfirmPasswordModal = true;
}
},
};
</script>
</head>
<body
class="bg-base text-text ubuntu-mono-regular overflow-x-hidden"
x-data="bodyData"
x-on:htmx:error="handleHtmxError($event)"
x-on:htmx:before-on-load="handleHtmxBeforeOnLoad($event)"
>
@popup.Error500Popup()
@popup.Error503Popup()
@popup.ConfirmPasswordModal()
<div
id="main-content"
class="flex flex-col h-screen justify-between"
>
@nav.Navbar()
<div id="page-content" class="mb-auto md:px-5 md:pt-5">
{ children... }
</div>
@footer.Footer()
</div>
</body>
</html>
}

View File

@@ -0,0 +1,99 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.3.833
package layout
//lint:file-ignore SA4006 This context is only used if a nested component is present.
import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
import "projectreshoot/internal/view/component/nav"
import "projectreshoot/internal/view/component/footer"
import "projectreshoot/internal/view/component/popup"
// Global page layout. Includes HTML document settings, header tags
// navbar and footer
func Global(title string) templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
if templ_7745c5c3_Var1 == nil {
templ_7745c5c3_Var1 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<!doctype html><html lang=\"en\" x-data=\"{\n theme: localStorage.getItem(&#39;theme&#39;)\n || &#39;system&#39;}\" x-init=\"$watch(&#39;theme&#39;, (val) =&gt; localStorage.setItem(&#39;theme&#39;, val))\" x-bind:class=\"{&#39;dark&#39;: theme === &#39;dark&#39; || (theme === &#39;system&#39; &amp;&amp;\n window.matchMedia(&#39;(prefers-color-scheme: dark)&#39;).matches)}\"><head><script>\n (function () {\n let theme = localStorage.getItem(\"theme\") || \"system\";\n if (theme === \"system\") {\n theme = window.matchMedia(\"(prefers-color-scheme: dark)\").matches ? \"dark\" : \"light\";\n }\n if (theme === \"dark\") {\n document.documentElement.classList.add(\"dark\");\n } else {\n document.documentElement.classList.remove(\"dark\");\n }\n })();\n </script><meta charset=\"UTF-8\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"><title>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var2 string
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(title)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/layout/global.templ`, Line: 36, Col: 17}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "</title><link rel=\"icon\" type=\"image/x-icon\" href=\"/static/favicon.ico\"><link href=\"/static/css/output.css\" rel=\"stylesheet\"><script src=\"https://unpkg.com/htmx.org@2.0.4\" integrity=\"sha384-HGfztofotfshcF7+8n44JQL2oJmowVChPTg48S+jvZoztPfvwD79OC/LTtG6dMp+\" crossorigin=\"anonymous\"></script><script defer src=\"https://cdn.jsdelivr.net/npm/@alpinejs/persist@3.x.x/dist/cdn.min.js\"></script><script src=\"https://unpkg.com/alpinejs\" defer></script><script>\n // uncomment this line to enable logging of htmx events\n // htmx.logAll();\n </script><script>\n const bodyData = {\n showError500: false,\n showError503: false,\n showConfirmPasswordModal: false,\n handleHtmxBeforeOnLoad(event) {\n const requestPath = event.detail.pathInfo.requestPath;\n if (requestPath === \"/reauthenticate\") {\n // handle password incorrect on refresh attempt\n if (event.detail.xhr.status === 445) {\n event.detail.shouldSwap = true;\n event.detail.isError = false;\n } else if (event.detail.xhr.status === 200) {\n this.showConfirmPasswordModal = false;\n }\n }\n },\n // handle errors from the server on HTMX requests\n handleHtmxError(event) {\n const errorCode = event.detail.errorInfo.error;\n \n // internal server error \n if (errorCode.includes('Code 500')) {\n this.showError500 = true;\n setTimeout(() => this.showError500 = false, 6000);\n }\n // service not available error\n if (errorCode.includes('Code 503')) {\n this.showError503 = true;\n setTimeout(() => this.showError503 = false, 6000);\n }\n \n // user is authorized but needs to refresh their login\n if (errorCode.includes('Code 444')) {\n this.showConfirmPasswordModal = true;\n }\n },\n };\n </script></head><body class=\"bg-base text-text ubuntu-mono-regular overflow-x-hidden\" x-data=\"bodyData\" x-on:htmx:error=\"handleHtmxError($event)\" x-on:htmx:before-on-load=\"handleHtmxBeforeOnLoad($event)\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = popup.Error500Popup().Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = popup.Error503Popup().Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = popup.ConfirmPasswordModal().Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "<div id=\"main-content\" class=\"flex flex-col h-screen justify-between\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = nav.Navbar().Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "<div id=\"page-content\" class=\"mb-auto md:px-5 md:pt-5\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templ_7745c5c3_Var1.Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "</div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = footer.Footer().Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "</div></body></html>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
}
var _ = templruntime.GeneratedTemplate

View File

@@ -0,0 +1,41 @@
package page
import "projectreshoot/internal/view/layout"
// Returns the about page content
templ About() {
@layout.Global("About") {
<div class="text-center max-w-150 m-auto">
<div class="text-4xl mt-8">About</div>
<div class="text-xl font-bold mt-4">What is Project Reshoot?</div>
<div class="text-lg mt-2">
Project Reshoot is a movie review site that aims to provide
a better experience for the users. Instead of a single number
that shows the average, or a spread of star ratings, Project
Reshoot asks you to rate movies with a vibe. These ratings
are shown as an easy to see pie chart showing how everyone
felt.
</div>
<div class="text-lg mt-2">
The other major feature is the ability for you to customize
what details you see about movies, hiding details you don't
want to see until after you've watched it. This gives you peace
of mind when searching for new movies to watch.
</div>
<div class="text-xl font-bold mt-4">Why the name?</div>
<div class="text-lg mt-2">
The name came partially from the premise of wanting to deliver
a new take on movie reviews, and partially from it being rewritten
from scratch in a new technology stack (Goodbye NextJS, Hello GOTH).
</div>
<div class="text-xl font-bold mt-4">Who's behind it?</div>
<div class="text-lg mt-2">
Currently Project Reshoot is being built by a team of 1.
It is somewhat of a passion project and a way to practice
my development skills. For the time being, it will likely stay
that way, but if you want to contribute, you can check out the
<a href="https://github.com/haelnorr/moviedb">Github repo here</a>.
</div>
</div>
}
}

View File

@@ -0,0 +1,61 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.3.833
package page
//lint:file-ignore SA4006 This context is only used if a nested component is present.
import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
import "projectreshoot/internal/view/layout"
// Returns the about page content
func About() templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
if templ_7745c5c3_Var1 == nil {
templ_7745c5c3_Var1 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
templ_7745c5c3_Var2 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<div class=\"text-center max-w-150 m-auto\"><div class=\"text-4xl mt-8\">About</div><div class=\"text-xl font-bold mt-4\">What is Project Reshoot?</div><div class=\"text-lg mt-2\">Project Reshoot is a movie review site that aims to provide a better experience for the users. Instead of a single number that shows the average, or a spread of star ratings, Project Reshoot asks you to rate movies with a vibe. These ratings are shown as an easy to see pie chart showing how everyone felt.</div><div class=\"text-lg mt-2\">The other major feature is the ability for you to customize what details you see about movies, hiding details you don't want to see until after you've watched it. This gives you peace of mind when searching for new movies to watch.</div><div class=\"text-xl font-bold mt-4\">Why the name?</div><div class=\"text-lg mt-2\">The name came partially from the premise of wanting to deliver a new take on movie reviews, and partially from it being rewritten from scratch in a new technology stack (Goodbye NextJS, Hello GOTH).</div><div class=\"text-xl font-bold mt-4\">Who's behind it?</div><div class=\"text-lg mt-2\">Currently Project Reshoot is being built by a team of 1. It is somewhat of a passion project and a way to practice my development skills. For the time being, it will likely stay that way, but if you want to contribute, you can check out the <a href=\"https://github.com/haelnorr/moviedb\">Github repo here</a>.</div></div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
templ_7745c5c3_Err = layout.Global("About").Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
}
var _ = templruntime.GeneratedTemplate

View File

@@ -0,0 +1,10 @@
package page
import "projectreshoot/internal/view/layout"
import "projectreshoot/internal/view/component/account"
templ Account(subpage string) {
@layout.Global("Account - " + subpage) {
@account.AccountContainer(subpage)
}
}

View File

@@ -0,0 +1,61 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.3.833
package page
//lint:file-ignore SA4006 This context is only used if a nested component is present.
import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
import "projectreshoot/internal/view/layout"
import "projectreshoot/internal/view/component/account"
func Account(subpage string) templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
if templ_7745c5c3_Var1 == nil {
templ_7745c5c3_Var1 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
templ_7745c5c3_Var2 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Err = account.AccountContainer(subpage).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
templ_7745c5c3_Err = layout.Global("Account - "+subpage).Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
}
var _ = templruntime.GeneratedTemplate

View File

@@ -0,0 +1,34 @@
package page
import "projectreshoot/internal/view/layout"
import "strconv"
// Page template for Error pages. Error code should be a HTTP status code as
// a string, and err should be the corresponding response title.
// Message is a custom error message displayed below the code and error.
templ Error(code int, err string, message string) {
@layout.Global(err) {
<div
class="grid mt-24 left-0 right-0 top-0 bottom-0
place-content-center bg-base px-4"
>
<div class="text-center">
<h1
class="text-9xl text-text"
>{ strconv.Itoa(code) }</h1>
<p
class="text-2xl font-bold tracking-tight text-subtext1
sm:text-4xl"
>{ err }</p>
<p
class="mt-4 text-subtext0"
>{ message }</p>
<a
href="/"
class="mt-6 inline-block rounded-lg bg-mauve px-5 py-3
text-sm text-crust transition hover:bg-mauve/75"
>Go to homepage</a>
</div>
</div>
}
}

View File

@@ -0,0 +1,103 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.3.833
package page
//lint:file-ignore SA4006 This context is only used if a nested component is present.
import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
import "projectreshoot/internal/view/layout"
import "strconv"
// Page template for Error pages. Error code should be a HTTP status code as
// a string, and err should be the corresponding response title.
// Message is a custom error message displayed below the code and error.
func Error(code int, err string, message string) templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
if templ_7745c5c3_Var1 == nil {
templ_7745c5c3_Var1 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
templ_7745c5c3_Var2 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<div class=\"grid mt-24 left-0 right-0 top-0 bottom-0 \n place-content-center bg-base px-4\"><div class=\"text-center\"><h1 class=\"text-9xl text-text\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var3 string
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(strconv.Itoa(code))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/page/error.templ`, Line: 18, Col: 25}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "</h1><p class=\"text-2xl font-bold tracking-tight text-subtext1\n sm:text-4xl\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var4 string
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(err)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/page/error.templ`, Line: 22, Col: 10}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "</p><p class=\"mt-4 text-subtext0\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var5 string
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(message)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/page/error.templ`, Line: 25, Col: 14}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "</p><a href=\"/\" class=\"mt-6 inline-block rounded-lg bg-mauve px-5 py-3 \n text-sm text-crust transition hover:bg-mauve/75\">Go to homepage</a></div></div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
templ_7745c5c3_Err = layout.Global(err).Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
}
var _ = templruntime.GeneratedTemplate

View File

@@ -0,0 +1,13 @@
package page
import "projectreshoot/internal/view/layout"
// Page content for the index page
templ Index() {
@layout.Global("Project Reshoot") {
<div class="text-center mt-24">
<div class="text-4xl lg:text-6xl">Project Reshoot</div>
<div>A better way to discover and rate films</div>
</div>
}
}

View File

@@ -0,0 +1,61 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.3.833
package page
//lint:file-ignore SA4006 This context is only used if a nested component is present.
import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
import "projectreshoot/internal/view/layout"
// Page content for the index page
func Index() templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
if templ_7745c5c3_Var1 == nil {
templ_7745c5c3_Var1 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
templ_7745c5c3_Var2 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<div class=\"text-center mt-24\"><div class=\"text-4xl lg:text-6xl\">Project Reshoot</div><div>A better way to discover and rate films</div></div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
templ_7745c5c3_Err = layout.Global("Project Reshoot").Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
}
var _ = templruntime.GeneratedTemplate

View File

@@ -0,0 +1,42 @@
package page
import "projectreshoot/internal/view/layout"
import "projectreshoot/internal/view/component/form"
// Returns the login page
templ Login() {
@layout.Global("Login") {
<div class="max-w-100 mx-auto px-2">
<div class="mt-7 bg-mantle border border-surface1 rounded-xl">
<div class="p-4 sm:p-7">
<div class="text-center">
<h1
class="block text-2xl font-bold"
>Login</h1>
<p
class="mt-2 text-sm text-subtext0"
>
Don't have an account yet?
<a
class="text-blue decoration-2 hover:underline
focus:outline-none focus:underline"
href="/register"
>
Sign up here
</a>
</p>
</div>
<div class="mt-5">
<div
class="py-3 flex items-center text-xs text-subtext0
uppercase before:flex-1 before:border-t
before:border-overlay1 before:me-6 after:flex-1
after:border-t after:border-overlay1 after:ms-6"
>Or</div>
@form.LoginForm("")
</div>
</div>
</div>
</div>
}
}

View File

@@ -0,0 +1,70 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.3.833
package page
//lint:file-ignore SA4006 This context is only used if a nested component is present.
import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
import "projectreshoot/internal/view/layout"
import "projectreshoot/internal/view/component/form"
// Returns the login page
func Login() templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
if templ_7745c5c3_Var1 == nil {
templ_7745c5c3_Var1 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
templ_7745c5c3_Var2 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<div class=\"max-w-100 mx-auto px-2\"><div class=\"mt-7 bg-mantle border border-surface1 rounded-xl\"><div class=\"p-4 sm:p-7\"><div class=\"text-center\"><h1 class=\"block text-2xl font-bold\">Login</h1><p class=\"mt-2 text-sm text-subtext0\">Don't have an account yet? <a class=\"text-blue decoration-2 hover:underline \n focus:outline-none focus:underline\" href=\"/register\">Sign up here</a></p></div><div class=\"mt-5\"><div class=\"py-3 flex items-center text-xs text-subtext0 \n uppercase before:flex-1 before:border-t \n before:border-overlay1 before:me-6 after:flex-1 \n after:border-t after:border-overlay1 after:ms-6\">Or</div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = form.LoginForm("").Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "</div></div></div></div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
templ_7745c5c3_Err = layout.Global("Login").Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
}
var _ = templruntime.GeneratedTemplate

View File

@@ -0,0 +1,93 @@
package page
import "projectreshoot/pkg/tmdb"
import "projectreshoot/internal/view/layout"
templ Movie(movie *tmdb.Movie, credits *tmdb.Credits, image *tmdb.Image) {
@layout.Global(movie.Title) {
<div class="md:bg-surface0 md:p-2 md:rounded-lg transition-all">
<div
id="billedcrew"
class="hidden"
>
for _, billedcrew := range credits.BilledCrew() {
<span class="flex flex-col text-left w-[130px] md:w-[180px]">
<span class="font-bold">{ billedcrew.Name }</span>
<span class="text-subtext1">{ billedcrew.FRoles() }</span>
</span>
}
</div>
<div class="flex items-start">
<div class="w-[154px] md:w-[300px] flex-col">
<img
class="object-cover aspect-[2/3] w-[154px] md:w-[300px]
transition-all md:rounded-md shadow-black shadow-2xl"
src={ movie.GetPoster(image, "w300") }
alt="Poster"
/>
<div
id="billedcrew-sm"
class="text-sm md:text-lg text-subtext1 flex gap-6
mt-5 flex-wrap justify-around flex-col px-5 md:hidden"
></div>
<script>
function moveBilledCrew() {
const billedCrewMd = document.getElementById('billedcrew-md');
const billedCrewSm = document.getElementById('billedcrew-sm');
const billedCrew = document.getElementById('billedcrew');
if (window.innerWidth < 768) {
billedCrewSm.innerHTML = billedCrew.innerHTML;
billedCrewMd.innerHTML = "";
} else {
billedCrewMd.innerHTML = billedCrew.innerHTML;
billedCrewSm.innerHTML = "";
}
}
window.addEventListener('load', moveBilledCrew);
const resizeObs = new ResizeObserver(() => {
moveBilledCrew();
});
resizeObs.observe(document.body);
</script>
</div>
<div class="flex flex-col flex-1 text-center px-4">
<span class="text-xl md:text-3xl font-semibold">
{ movie.Title }
</span>
<span class="text-sm md:text-lg text-subtext1">
{ movie.FGenres() }
&#x2022; { movie.FRuntime() }
&#x2022; { movie.ReleaseYear() }
</span>
<div class="flex justify-center gap-2 mt-2">
<div
class="w-20 h-20 md:w-30 md:h-30 bg-overlay2
transition-all rounded-sm"
></div>
<div
class="w-20 h-20 md:w-30 md:h-30 bg-overlay2
transition-all rounded-sm"
></div>
</div>
<div class="flex flex-col mt-4">
<span class="text-sm md:text-lg text-overlay2 italic">
{ movie.Tagline }
</span>
<div
id="billedcrew-md"
class="hidden text-sm md:text-lg text-subtext1 md:flex gap-6
mt-5 flex-wrap justify-around"
></div>
<span class="text-lg mt-5 font-semibold">Overview</span>
<span class="text-sm md:text-lg text-subtext1">
{ movie.Overview }
</span>
</div>
</div>
</div>
</div>
}
}

View File

@@ -0,0 +1,31 @@
package page
import "projectreshoot/internal/view/layout"
templ Movies() {
@layout.Global("Search movies") {
<div class="max-w-4xl mx-auto md:mt-0 mt-2 px-2 md:px-0">
<form hx-post="/search-movies" hx-target="#search-movies-results">
<div
class="max-w-100 flex items-center space-x-2 mb-2"
>
<input
id="search"
name="search"
type="text"
placeholder="Search movies..."
class="flex-grow p-2 border rounded-lg
bg-mantle border-surface2 shadow-sm
focus:outline-none focus:ring-2 focus:ring-blue"
/>
<button
type="submit"
class="py-2 px-4 bg-green text-mantle rounded-lg transition
hover:cursor-pointer hover:bg-green/75"
>Search</button>
</div>
<div id="search-movies-results" class="space-y-4"></div>
</form>
</div>
}
}

View File

@@ -0,0 +1,60 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.3.833
package page
//lint:file-ignore SA4006 This context is only used if a nested component is present.
import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
import "projectreshoot/internal/view/layout"
func Movies() templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
if templ_7745c5c3_Var1 == nil {
templ_7745c5c3_Var1 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
templ_7745c5c3_Var2 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<div class=\"max-w-4xl mx-auto md:mt-0 mt-2 px-2 md:px-0\"><form hx-post=\"/search-movies\" hx-target=\"#search-movies-results\"><div class=\"max-w-100 flex items-center space-x-2 mb-2\"><input id=\"search\" name=\"search\" type=\"text\" placeholder=\"Search movies...\" class=\"flex-grow p-2 border rounded-lg \n bg-mantle border-surface2 shadow-sm\n focus:outline-none focus:ring-2 focus:ring-blue\"> <button type=\"submit\" class=\"py-2 px-4 bg-green text-mantle rounded-lg transition\n hover:cursor-pointer hover:bg-green/75\">Search</button></div><div id=\"search-movies-results\" class=\"space-y-4\"></div></form></div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
templ_7745c5c3_Err = layout.Global("Search movies").Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
}
var _ = templruntime.GeneratedTemplate

View File

@@ -0,0 +1,188 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.3.833
package page
//lint:file-ignore SA4006 This context is only used if a nested component is present.
import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
import "projectreshoot/pkg/tmdb"
import "projectreshoot/internal/view/layout"
func Movie(movie *tmdb.Movie, credits *tmdb.Credits, image *tmdb.Image) templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
if templ_7745c5c3_Var1 == nil {
templ_7745c5c3_Var1 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
templ_7745c5c3_Var2 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<div class=\"md:bg-surface0 md:p-2 md:rounded-lg transition-all\"><div id=\"billedcrew\" class=\"hidden\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
for _, billedcrew := range credits.BilledCrew() {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "<span class=\"flex flex-col text-left w-[130px] md:w-[180px]\"><span class=\"font-bold\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var3 string
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(billedcrew.Name)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/page/movie.templ`, Line: 15, Col: 47}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "</span> <span class=\"text-subtext1\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var4 string
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(billedcrew.FRoles())
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/page/movie.templ`, Line: 16, Col: 55}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "</span></span>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "</div><div class=\"flex items-start\"><div class=\"w-[154px] md:w-[300px] flex-col\"><img class=\"object-cover aspect-[2/3] w-[154px] md:w-[300px] \n transition-all md:rounded-md shadow-black shadow-2xl\" src=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var5 string
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(movie.GetPoster(image, "w300"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/page/movie.templ`, Line: 25, Col: 42}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "\" alt=\"Poster\"><div id=\"billedcrew-sm\" class=\"text-sm md:text-lg text-subtext1 flex gap-6\n mt-5 flex-wrap justify-around flex-col px-5 md:hidden\"></div><script>\n function moveBilledCrew() {\n const billedCrewMd = document.getElementById('billedcrew-md');\n const billedCrewSm = document.getElementById('billedcrew-sm');\n const billedCrew = document.getElementById('billedcrew');\n\n if (window.innerWidth < 768) {\n billedCrewSm.innerHTML = billedCrew.innerHTML;\n billedCrewMd.innerHTML = \"\";\n } else {\n billedCrewMd.innerHTML = billedCrew.innerHTML;\n billedCrewSm.innerHTML = \"\";\n }\n }\n\n window.addEventListener('load', moveBilledCrew);\n\n const resizeObs = new ResizeObserver(() => {\n moveBilledCrew();\n });\n resizeObs.observe(document.body);\n </script></div><div class=\"flex flex-col flex-1 text-center px-4\"><span class=\"text-xl md:text-3xl font-semibold\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var6 string
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(movie.Title)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/page/movie.templ`, Line: 58, Col: 19}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "</span> <span class=\"text-sm md:text-lg text-subtext1\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var7 string
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(movie.FGenres())
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/page/movie.templ`, Line: 61, Col: 23}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, " &#x2022; ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var8 string
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(movie.FRuntime())
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/page/movie.templ`, Line: 62, Col: 33}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, " &#x2022; ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var9 string
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(movie.ReleaseYear())
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/page/movie.templ`, Line: 63, Col: 36}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 10, "</span><div class=\"flex justify-center gap-2 mt-2\"><div class=\"w-20 h-20 md:w-30 md:h-30 bg-overlay2 \n transition-all rounded-sm\"></div><div class=\"w-20 h-20 md:w-30 md:h-30 bg-overlay2 \n transition-all rounded-sm\"></div></div><div class=\"flex flex-col mt-4\"><span class=\"text-sm md:text-lg text-overlay2 italic\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var10 string
templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(movie.Tagline)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/page/movie.templ`, Line: 77, Col: 22}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 11, "</span><div id=\"billedcrew-md\" class=\"hidden text-sm md:text-lg text-subtext1 md:flex gap-6\n mt-5 flex-wrap justify-around\"></div><span class=\"text-lg mt-5 font-semibold\">Overview</span> <span class=\"text-sm md:text-lg text-subtext1\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var11 string
templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(movie.Overview)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/page/movie.templ`, Line: 86, Col: 23}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, "</span></div></div></div></div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
templ_7745c5c3_Err = layout.Global(movie.Title).Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
}
var _ = templruntime.GeneratedTemplate

View File

@@ -0,0 +1,13 @@
package page
import "projectreshoot/internal/view/layout"
import "projectreshoot/pkg/contexts"
templ Profile() {
{{ user := contexts.GetUser(ctx) }}
@layout.Global("Profile - " + user.Username) {
<div class="">
Hello, { user.Username }
</div>
}
}

View File

@@ -0,0 +1,75 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.3.833
package page
//lint:file-ignore SA4006 This context is only used if a nested component is present.
import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
import "projectreshoot/internal/view/layout"
import "projectreshoot/pkg/contexts"
func Profile() templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
if templ_7745c5c3_Var1 == nil {
templ_7745c5c3_Var1 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
user := contexts.GetUser(ctx)
templ_7745c5c3_Var2 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<div class=\"\">Hello, ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var3 string
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(user.Username)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/page/profile.templ`, Line: 10, Col: 25}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "</div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
templ_7745c5c3_Err = layout.Global("Profile - "+user.Username).Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
}
var _ = templruntime.GeneratedTemplate

View File

@@ -0,0 +1,42 @@
package page
import "projectreshoot/internal/view/layout"
import "projectreshoot/internal/view/component/form"
// Returns the login page
templ Register() {
@layout.Global("Register") {
<div class="max-w-100 mx-auto px-2">
<div class="mt-7 bg-mantle border border-surface1 rounded-xl">
<div class="p-4 sm:p-7">
<div class="text-center">
<h1
class="block text-2xl font-bold"
>Register</h1>
<p
class="mt-2 text-sm text-subtext0"
>
Already have an account?
<a
class="text-blue decoration-2 hover:underline
focus:outline-none focus:underline"
href="/login"
>
Login here
</a>
</p>
</div>
<div class="mt-5">
<div
class="py-3 flex items-center text-xs text-subtext0
uppercase before:flex-1 before:border-t
before:border-overlay1 before:me-6 after:flex-1
after:border-t after:border-overlay1 after:ms-6"
>Or</div>
@form.RegisterForm("")
</div>
</div>
</div>
</div>
}
}

View File

@@ -0,0 +1,70 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.3.833
package page
//lint:file-ignore SA4006 This context is only used if a nested component is present.
import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
import "projectreshoot/internal/view/layout"
import "projectreshoot/internal/view/component/form"
// Returns the login page
func Register() templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
if templ_7745c5c3_Var1 == nil {
templ_7745c5c3_Var1 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
templ_7745c5c3_Var2 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<div class=\"max-w-100 mx-auto px-2\"><div class=\"mt-7 bg-mantle border border-surface1 rounded-xl\"><div class=\"p-4 sm:p-7\"><div class=\"text-center\"><h1 class=\"block text-2xl font-bold\">Register</h1><p class=\"mt-2 text-sm text-subtext0\">Already have an account? <a class=\"text-blue decoration-2 hover:underline \n focus:outline-none focus:underline\" href=\"/login\">Login here</a></p></div><div class=\"mt-5\"><div class=\"py-3 flex items-center text-xs text-subtext0 \n uppercase before:flex-1 before:border-t \n before:border-overlay1 before:me-6 after:flex-1 \n after:border-t after:border-overlay1 after:ms-6\">Or</div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = form.RegisterForm("").Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "</div></div></div></div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
templ_7745c5c3_Err = layout.Global("Register").Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
}
var _ = templruntime.GeneratedTemplate