+ hp feature now working as intended
This commit is contained in:
@@ -3,6 +3,7 @@ package handler
|
||||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
"reflect"
|
||||
"strconv"
|
||||
|
||||
"github.com/gofiber/fiber/v3"
|
||||
@@ -11,6 +12,11 @@ import (
|
||||
)
|
||||
|
||||
func Tracker(c fiber.Ctx) error {
|
||||
sess, err := store.Get(c)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
hx := len(c.GetReqHeaders()["Hx-Request"]) > 0
|
||||
|
||||
data := hptracker.TrackerData{
|
||||
@@ -25,11 +31,17 @@ func Tracker(c fiber.Ctx) error {
|
||||
ManaPercentage: "0",
|
||||
}
|
||||
|
||||
fields := []string{"HP", "HPBase", "HPStartPercentage", "HPPercentage", "Mana", "ManaBase", "ManaRegen", "ManaStartPercentage", "ManaPercentage"}
|
||||
for _, field := range fields {
|
||||
if val := sess.Get("tracker_" + field); val != nil {
|
||||
reflect.ValueOf(&data).Elem().FieldByName(field).SetString(fmt.Sprint(val))
|
||||
}
|
||||
}
|
||||
|
||||
return render(c, hptracker.Show(hx, data))
|
||||
}
|
||||
|
||||
func TrackerUpdate(c fiber.Ctx) error {
|
||||
|
||||
sess, err := store.Get(c)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -47,14 +59,6 @@ func TrackerUpdate(c fiber.Ctx) error {
|
||||
ManaPercentage: "100",
|
||||
}
|
||||
|
||||
// why no work?
|
||||
// values := reflect.ValueOf(data)
|
||||
// types := values.Type()
|
||||
// prefix := "tracker_"
|
||||
// for i := 0; i < values.NumField(); i++ {
|
||||
// sess.Set(prefix+types.Field(i).Name, values.Field(i))
|
||||
// log.Info("test")
|
||||
// }
|
||||
pre := "tracker_"
|
||||
sess.Set(pre+"HP", data.HP)
|
||||
sess.Set(pre+"HPBase", data.HPBase)
|
||||
@@ -67,15 +71,12 @@ func TrackerUpdate(c fiber.Ctx) error {
|
||||
sess.Set(pre+"ManaStartPercentage", data.ManaStartPercentage)
|
||||
sess.Set(pre+"ManaPercentage", data.ManaPercentage)
|
||||
|
||||
// sess.Set("tracker", data)
|
||||
|
||||
sess.Save()
|
||||
|
||||
return render(c, hptracker.TrackerColumn(data))
|
||||
}
|
||||
|
||||
func TrackerDamage(c fiber.Ctx) error {
|
||||
|
||||
sess, err := store.Get(c)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -83,28 +84,29 @@ func TrackerDamage(c fiber.Ctx) error {
|
||||
|
||||
damage, err := strconv.Atoi(c.FormValue("damageInput"))
|
||||
if err != nil {
|
||||
c.SendStatus(418)
|
||||
return err
|
||||
} else if damage == 0 {
|
||||
c.SendStatus(418)
|
||||
return c.SendString("HP NOT NULL")
|
||||
}
|
||||
|
||||
if damage < 0 {
|
||||
damage *= -1
|
||||
c.Status(422)
|
||||
return c.SendString(err.Error())
|
||||
} else if damage <= 0 {
|
||||
c.Status(422)
|
||||
c.Append("HX-Retarget", "#damageInputs")
|
||||
return render(c, hptracker.Hp(hptracker.DamageData{
|
||||
Errors: "Darf nicht 0 oder kleiner sein.",
|
||||
}))
|
||||
}
|
||||
|
||||
currentHP, err := strconv.Atoi(fmt.Sprint(sess.Get("tracker_HP")))
|
||||
if err != nil {
|
||||
c.SendStatus(418)
|
||||
return err
|
||||
c.Status(422)
|
||||
c.Append("HX-Retarget", "#damageInputs")
|
||||
return render(c, hptracker.Hp(hptracker.DamageData{
|
||||
Errors: "Standard Werte nicht gesetzt.",
|
||||
Values: c.FormValue("damageInput"),
|
||||
SavingThrow: c.FormValue("savingthrow"),
|
||||
}))
|
||||
}
|
||||
|
||||
baseHP, err := strconv.Atoi(fmt.Sprint(sess.Get("tracker_HPBase")))
|
||||
if err != nil {
|
||||
c.SendStatus(418)
|
||||
return err
|
||||
}
|
||||
// no error handling here because it's already done for currentHP
|
||||
baseHP, _ := strconv.Atoi(fmt.Sprint(sess.Get("tracker_HPBase")))
|
||||
|
||||
heal := string(c.FormValue("heal"))
|
||||
savingThrow := string(c.FormValue("savingthrow"))
|
||||
@@ -114,7 +116,7 @@ func TrackerDamage(c fiber.Ctx) error {
|
||||
damage -= int(math.Round(damageFloat))
|
||||
}
|
||||
|
||||
if heal == "true" && damage > 0 {
|
||||
if heal == "true" {
|
||||
damage *= -1
|
||||
}
|
||||
|
||||
@@ -142,9 +144,61 @@ func TrackerDamage(c fiber.Ctx) error {
|
||||
|
||||
sess.Save()
|
||||
|
||||
c.Append("HX-Trigger", "HPUpdated")
|
||||
|
||||
return render(c, hptracker.HPTracker(data))
|
||||
}
|
||||
|
||||
func TrackerMana(c fiber.Ctx) error {
|
||||
sess, err := store.Get(c)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
mana, err := strconv.Atoi(c.FormValue("manaInput"))
|
||||
if err != nil {
|
||||
c.Status(422)
|
||||
return c.SendString(err.Error())
|
||||
} else if mana <= 0 {
|
||||
c.Status(422)
|
||||
// c.Append("HX-Retarget", "#damageInputs")
|
||||
// return render(c, hptracker.Hp(hptracker.DamageData{
|
||||
// Errors: "Darf nicht 0 oder kleiner sein.",
|
||||
// }))
|
||||
return nil
|
||||
}
|
||||
|
||||
currentMana, err := strconv.Atoi(fmt.Sprint(sess.Get("tracker_Mana")))
|
||||
if err != nil {
|
||||
c.Status(422)
|
||||
// c.Append("HX-Retarget", "#manaInputs")
|
||||
// return render(c, hptracker.Mana(hptracker.DamageData{
|
||||
// Errors: "Standard Werte nicht gesetzt.",
|
||||
// }))
|
||||
return err
|
||||
}
|
||||
|
||||
baseMana, _ := strconv.Atoi(fmt.Sprint(sess.Get("tracker_ManaBase")))
|
||||
|
||||
newMana := currentMana - mana
|
||||
|
||||
newPercentage := (newMana * 100) / baseMana
|
||||
|
||||
data := hptracker.TrackerData{
|
||||
Mana: fmt.Sprint(newMana),
|
||||
ManaBase: fmt.Sprint(sess.Get("tracker_ManaBase")),
|
||||
ManaStartPercentage: fmt.Sprint(sess.Get("tracker_ManaPercentage")),
|
||||
ManaPercentage: fmt.Sprint(newPercentage),
|
||||
}
|
||||
|
||||
sess.Set("tracker_Mana", newMana)
|
||||
sess.Set("tracker_ManaPercentage", newPercentage)
|
||||
|
||||
sess.Save()
|
||||
|
||||
return render(c, hptracker.ManaTracker(data))
|
||||
}
|
||||
|
||||
func CheckStore(c fiber.Ctx) error {
|
||||
sess, err := store.Get(c)
|
||||
if err != nil {
|
||||
|
||||
1
main.go
1
main.go
@@ -23,6 +23,7 @@ func main() {
|
||||
tracker.Get("/", handler.Tracker)
|
||||
tracker.Post("/update", handler.TrackerUpdate)
|
||||
tracker.Post("/damage", handler.TrackerDamage)
|
||||
tracker.Post("/mana", handler.TrackerMana)
|
||||
tracker.Get("/check", handler.CheckStore)
|
||||
// app.Get("/*", func(c *fiber.Ctx) error {
|
||||
// return c.SendString("Hello, World!")
|
||||
|
||||
@@ -1880,6 +1880,7 @@ progress,
|
||||
:root {
|
||||
--color-hp: #f06048;
|
||||
--color-mana: #01aaff;
|
||||
--color-error: #c52f21;
|
||||
}
|
||||
|
||||
.text-center {
|
||||
@@ -1977,6 +1978,10 @@ progress {
|
||||
}
|
||||
}
|
||||
|
||||
.error-helper {
|
||||
color: var(--color-error);
|
||||
}
|
||||
|
||||
.mb-0 {
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@
|
||||
|
||||
--color-hp: #{$red-400};
|
||||
--color-mana: #{$azure-350};
|
||||
|
||||
--color-error: #{$red-550};
|
||||
}
|
||||
|
||||
// *, ::after, ::before {
|
||||
@@ -231,7 +231,9 @@ progress{
|
||||
}
|
||||
|
||||
|
||||
|
||||
.error-helper{
|
||||
color: var(--color-error);
|
||||
}
|
||||
|
||||
|
||||
// utility
|
||||
|
||||
@@ -15,6 +15,18 @@ type TrackerData struct {
|
||||
ManaRegen string
|
||||
}
|
||||
|
||||
type DamageData struct {
|
||||
Values string
|
||||
SavingThrow string
|
||||
Errors string
|
||||
}
|
||||
|
||||
var dd = DamageData {
|
||||
Values: "",
|
||||
SavingThrow: "",
|
||||
Errors: "",
|
||||
}
|
||||
|
||||
templ Show(hx bool, td TrackerData){
|
||||
@layout.Base(hx){
|
||||
<div class="container">
|
||||
@@ -41,15 +53,40 @@ templ Show(hx bool, td TrackerData){
|
||||
<div class="grid">
|
||||
<div>
|
||||
<h3>TP</h3>
|
||||
@hp()
|
||||
@Hp(dd)
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<h3>Mana</h3>
|
||||
@mana()
|
||||
@Mana()
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", (event) => {
|
||||
document.body.addEventListener("htmx:beforeSwap", function(evt){
|
||||
if (evt.detail.xhr.status === 422){
|
||||
evt.detail.shouldSwap = true;
|
||||
evt.detail.isError = false;
|
||||
}
|
||||
});
|
||||
|
||||
document.body.addEventListener("HPUpdated", function() {
|
||||
var input = document.getElementById('damageInput');
|
||||
input.value = "";
|
||||
input.removeAttribute('aria-invalid');
|
||||
|
||||
var errorMessage = document.getElementById('damageError');
|
||||
if (errorMessage) {
|
||||
errorMessage.parentNode.removeChild(errorMessage);
|
||||
}
|
||||
|
||||
var savingthrow = document.getElementById('savingthrow');
|
||||
savingthrow.checked = false;
|
||||
});
|
||||
})
|
||||
|
||||
</script>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +100,7 @@ templ TrackerColumn(td TrackerData){
|
||||
@HPTracker(td)
|
||||
</div>
|
||||
|
||||
<div class="progress">
|
||||
<div id="manaBar" class="progress">
|
||||
@ManaTracker(td)
|
||||
</div>
|
||||
|
||||
@@ -127,44 +164,67 @@ templ baseStats(){
|
||||
</details>
|
||||
}
|
||||
|
||||
templ hp(){
|
||||
templ Hp(dd DamageData){
|
||||
|
||||
<form id="damageInputs" hx-post="/hp-mana-tracker/damage" hx-target="#hpBar">
|
||||
|
||||
<form hx-post="/hp-mana-tracker/damage" hx-target="#hpBar">
|
||||
<fieldset role="group">
|
||||
|
||||
<button class="secondary" name="damage" value="true">
|
||||
-
|
||||
</button>
|
||||
|
||||
<input name="damageInput" type="number"/>
|
||||
|
||||
<input
|
||||
id="damageInput"
|
||||
name="damageInput"
|
||||
type="number"
|
||||
placeholder="Schaden/Heilung"
|
||||
required
|
||||
if dd.Errors != "" {
|
||||
aria-invalid="true"
|
||||
}
|
||||
value={dd.Values}
|
||||
/>
|
||||
|
||||
<button class="secondary" name="heal" value="true">
|
||||
+
|
||||
</button>
|
||||
|
||||
</fieldset>
|
||||
if dd.Errors != "" {
|
||||
<small id="damageError" class="error-helper">{dd.Errors}</small>
|
||||
}
|
||||
|
||||
|
||||
<fieldset>
|
||||
<label for="savingthrow">
|
||||
<input id="savingthrow" name="savingthrow" type="checkbox" role="switch"/>
|
||||
<input id="savingthrow" name="savingthrow" type="checkbox" role="switch"
|
||||
if dd.SavingThrow != "" {
|
||||
checked
|
||||
}
|
||||
/>
|
||||
Verteidigungswurf
|
||||
</label>
|
||||
</fieldset>
|
||||
</form>
|
||||
}
|
||||
|
||||
templ mana(){
|
||||
<fieldset role="group">
|
||||
templ Mana(){
|
||||
<form hx-post="/hp-mana-tracker/mana" hx-target="#manaBar">
|
||||
<fieldset role="group">
|
||||
|
||||
<button class="secondary" name="use" hx-get="/hp-mana-tracker/check">
|
||||
-
|
||||
</button>
|
||||
<button class="secondary" name="use">
|
||||
-
|
||||
</button>
|
||||
|
||||
<input type="number" placeholder="" min="0" value="0"/>
|
||||
<input name="manaInput" type="number" placeholder="" min="0" value="0"/>
|
||||
|
||||
<button class="secondary" name="add">
|
||||
+
|
||||
</button>
|
||||
<button class="secondary" name="add">
|
||||
+
|
||||
</button>
|
||||
|
||||
</fieldset>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
}
|
||||
@@ -26,6 +26,18 @@ type TrackerData struct {
|
||||
ManaRegen string
|
||||
}
|
||||
|
||||
type DamageData struct {
|
||||
Values string
|
||||
SavingThrow string
|
||||
Errors string
|
||||
}
|
||||
|
||||
var dd = DamageData{
|
||||
Values: "",
|
||||
SavingThrow: "",
|
||||
Errors: "",
|
||||
}
|
||||
|
||||
func Show(hx bool, td TrackerData) templ.Component {
|
||||
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
|
||||
@@ -65,7 +77,7 @@ func Show(hx bool, td TrackerData) templ.Component {
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = hp().Render(ctx, templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = Hp(dd).Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
@@ -73,7 +85,7 @@ func Show(hx bool, td TrackerData) templ.Component {
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = mana().Render(ctx, templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = Mana().Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
@@ -160,7 +172,7 @@ func HPTracker(td TrackerData) templ.Component {
|
||||
var templ_7745c5c3_Var5 string
|
||||
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(td.HP)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/hptracker/tracker.templ`, Line: 72, Col: 43}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/hptracker/tracker.templ`, Line: 109, Col: 43}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
@@ -173,7 +185,7 @@ func HPTracker(td TrackerData) templ.Component {
|
||||
var templ_7745c5c3_Var6 string
|
||||
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(td.HPBase)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/hptracker/tracker.templ`, Line: 72, Col: 55}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/hptracker/tracker.templ`, Line: 109, Col: 55}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
@@ -227,7 +239,7 @@ func ManaTracker(td TrackerData) templ.Component {
|
||||
var templ_7745c5c3_Var9 string
|
||||
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(td.Mana)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/hptracker/tracker.templ`, Line: 77, Col: 47}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/hptracker/tracker.templ`, Line: 114, Col: 47}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
@@ -240,7 +252,7 @@ func ManaTracker(td TrackerData) templ.Component {
|
||||
var templ_7745c5c3_Var10 string
|
||||
templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(td.ManaBase)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/hptracker/tracker.templ`, Line: 77, Col: 61}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/hptracker/tracker.templ`, Line: 114, Col: 61}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
@@ -320,7 +332,7 @@ func baseStats() templ.Component {
|
||||
})
|
||||
}
|
||||
|
||||
func hp() templ.Component {
|
||||
func Hp(dd DamageData) templ.Component {
|
||||
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
@@ -337,27 +349,78 @@ func hp() templ.Component {
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
|
||||
if dd.Errors != "" {
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 21)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
func mana() templ.Component {
|
||||
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
templ_7745c5c3_Buffer = templ.GetBuffer()
|
||||
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 22)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var14 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var14 == nil {
|
||||
templ_7745c5c3_Var14 = templ.NopComponent
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(dd.Values))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 21)
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 23)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if dd.Errors != "" {
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 24)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var14 string
|
||||
templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(dd.Errors)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/hptracker/tracker.templ`, Line: 195, Col: 67}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 25)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 26)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if dd.SavingThrow != "" {
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 27)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 28)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
func Mana() templ.Component {
|
||||
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
templ_7745c5c3_Buffer = templ.GetBuffer()
|
||||
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var15 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var15 == nil {
|
||||
templ_7745c5c3_Var15 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 29)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user