Games now have a page and everything works on multiple size screens, but I need to do a serious refactoring to normalize all data to be Go style.

This commit is contained in:
Zed A. Shaw 2025-09-18 14:57:52 -04:00
parent 31b224c6e8
commit 931c493928
9 changed files with 123 additions and 26 deletions

View file

@ -127,13 +127,14 @@ func Update(table string, value reflect.Value) error {
// skip update of id to avoid replacing it
if tag == "id" { continue }
fmt.Println(">>>>>>>>>>>>>>>>> field", tag, "=", field.Interface())
builder = builder.Set(tag, field.Interface())
}
builder = builder.Where(sq.Eq{"id": value.FieldByName("Id").Interface()})
sql_query, args, err := builder.ToSql()
fmt.Println("UPDATE QUERY", sql_query, args)
fmt.Println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!UPDATE QUERY", sql_query, args)
if err != nil { return err}
_, err = data.DB.Exec(sql_query, args...)

View file

@ -56,7 +56,9 @@ func ReflectOnPost(typeOf reflect.Type, c *fiber.Ctx) (reflect.Value, error) {
var validate *validator.Validate
validate = validator.New(validator.WithRequiredStructEnabled())
if err := validate.Struct(result); err != nil {
err := validate.Struct(result)
if err != nil {
validationErrors := err.(validator.ValidationErrors)
log.Println(validationErrors)
return result_val, err

View file

@ -36,6 +36,10 @@ type Game struct {
Url string `db:"url" json:"url"`
Tags string `db:"tags" json:"tags"`
Video string `db:"video" json:"video"`
CurrentStatus string `db:"current_status" json:"current_status" form:"current_status"`
PlannedWork string `db:"planned_work" json:"planned_work" form:"planned_work"`
CodeUrl string `db:"code_url" json:"code_url" form:"code_url"`
HeaderImage string `db:"header_image" json:"header_image" form:"header_image"`
}
func Models() map[string]reflect.Type {

View file

@ -0,0 +1,15 @@
-- +goose Up
-- +goose StatementBegin
ALTER TABLE game ADD COLUMN current_status TEXT DEFAULT "";
ALTER TABLE game ADD COLUMN planned_work TEXT DEFAULT "";
ALTER TABLE game ADD COLUMN code_url TEXT DEFAULT "";
ALTER TABLE game ADD COLUMN header_image TEXT DEFAULT "";
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
ALTER TABLE game DROP COLUMN current_status;
ALTER TABLE game DROP COLUMN planned_work;
ALTER TABLE game DROP COLUMN code_url;
ALTER TABLE game DROP COLUMN header_image;
-- +goose StatementEnd

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

View file

@ -200,7 +200,7 @@ block.center-vertical {
}
bar {
@apply flex flex-row p-4 gap-4;
@apply flex flex-col sm:flex-row p-4 gap-4;
}
bar.center-horizontal {

View file

@ -247,6 +247,9 @@
.flex {
display: flex;
}
.grid {
display: grid;
}
.hidden {
display: none;
}
@ -262,6 +265,9 @@
.aspect-\[9\/12\]\! {
aspect-ratio: 9/12 !important;
}
.aspect-square {
aspect-ratio: 1 / 1;
}
.aspect-square\! {
aspect-ratio: 1 / 1 !important;
}
@ -308,12 +314,21 @@
.flex-1 {
flex: 1;
}
.flex-shrink {
flex-shrink: 1;
}
.shrink-0 {
flex-shrink: 0;
}
.border-collapse {
border-collapse: collapse;
}
.transform {
transform: var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,);
}
.resize {
resize: both;
}
.two-panel {
grid-template-columns: repeat(1, minmax(0, 1fr));
grid-template-rows: repeat(2, minmax(0, 1fr));
@ -351,6 +366,9 @@
.justify-evenly {
justify-content: space-evenly;
}
.gap-0 {
gap: calc(var(--spacing) * 0);
}
.gap-0\! {
gap: calc(var(--spacing) * 0) !important;
}
@ -414,6 +432,10 @@
border-width: 1px !important;
border-color: var(--color-red-900) !important;
}
.border {
border-style: var(--tw-border-style);
border-width: 1px;
}
.border-1 {
border-style: var(--tw-border-style);
border-width: 1px;
@ -484,6 +506,9 @@
.bg-gray-800 {
background-color: var(--color-gray-800);
}
.bg-green-400 {
background-color: var(--color-green-400);
}
.bg-green-400\! {
background-color: var(--color-green-400) !important;
}
@ -496,6 +521,9 @@
.\!p-4 {
padding: calc(var(--spacing) * 4) !important;
}
.p-0 {
padding: calc(var(--spacing) * 0);
}
.p-0\! {
padding: calc(var(--spacing) * 0) !important;
}
@ -523,6 +551,9 @@
.\!pb-20 {
padding-bottom: calc(var(--spacing) * 20) !important;
}
.pb-0 {
padding-bottom: calc(var(--spacing) * 0);
}
.pb-0\! {
padding-bottom: calc(var(--spacing) * 0) !important;
}
@ -541,6 +572,9 @@
.pb-8 {
padding-bottom: calc(var(--spacing) * 8);
}
.pb-10 {
padding-bottom: calc(var(--spacing) * 10);
}
.pb-10\! {
padding-bottom: calc(var(--spacing) * 10) !important;
}
@ -589,12 +623,18 @@
--tw-font-weight: var(--font-weight-light);
font-weight: var(--font-weight-light);
}
.text-wrap {
text-wrap: wrap;
}
.text-gray-50 {
color: var(--color-gray-50);
}
.text-gray-300 {
color: var(--color-gray-300);
}
.text-gray-400 {
color: var(--color-gray-400);
}
.text-gray-950 {
color: var(--color-gray-950);
}
@ -604,15 +644,27 @@
.text-red-500 {
color: var(--color-red-500);
}
.underline {
text-decoration-line: underline;
}
.shadow-lg {
--tw-shadow: 0 10px 15px -3px var(--tw-shadow-color, rgb(0 0 0 / 0.1)), 0 4px 6px -4px var(--tw-shadow-color, rgb(0 0 0 / 0.1));
box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
}
.outline {
outline-style: var(--tw-outline-style);
outline-width: 1px;
}
.transition {
transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to, opacity, box-shadow, transform, translate, scale, rotate, filter, -webkit-backdrop-filter, backdrop-filter, display, visibility, content-visibility, overlay, pointer-events;
transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
transition-duration: var(--tw-duration, var(--default-transition-duration));
}
.\*\:\!p-0 {
:is(& > *) {
padding: calc(var(--spacing) * 0) !important;
}
}
.\*\:text-xl {
:is(& > *) {
font-size: var(--text-xl);
@ -1045,9 +1097,12 @@ block.center-vertical {
}
bar {
display: flex;
flex-direction: row;
flex-direction: column;
gap: calc(var(--spacing) * 4);
padding: calc(var(--spacing) * 4);
@media (width >= 40rem) {
flex-direction: row;
}
}
bar.center-horizontal {
justify-content: center;

View file

@ -6,35 +6,55 @@
<div class="gap-3 pb-3 flex flex-col lg:flex-row-reverse">
<div class="!text-sm !p-0 flex flex-col md:flex-row lg:flex-col">
<shape class="video">small header</shape>
<img :src="item.header_image" />
<block>
<p class="m-2" x-text="item.description"></p>
<table>
<tr><th class="text-gray-400 text-left">RECENT REVIEWS:</th><td>Insanely Optimistic</td></tr>
<tr><th class="text-gray-400 text-left">ENGLISH REVIEWS:</th><td>Probably Racist</td></tr>
<tr><th class="text-gray-400 text-left">RELEASE DATE:</th><td>A Total Fantasy</td></tr>
<tr><th class="text-gray-400 text-left">DEVELOPER:</th><td>Zed A. Shaw</td></tr>
<tr><th class="text-gray-400 text-left">PUBLISHER:</th><td>My Fucking Self</td></tr>
</table>
</block>
</div>
<video controls width="600">
<div class="flex">
<video controls>
<template x-if="item.video">
<source :src="item.video" type="video/mp4" />
</template>
</video>
</div>
</div>
<grid class="bg-gray-800 two-panel">
<bar class="!p-0 *:!p-0">
<block>
<p>Polaroid retro pork belly yes plz bitters, viral chicharrones typewriter chartreuse vice Brooklyn. Adaptogen pour-over vibecession viral. Tote bag tonx DIY microdosing. Pickled selvage bespoke small batch, blue bottle twee tacos jean shorts before they sold out chicharrones solarpunk. Hoodie taiyaki poutine jianbing chambray.</p>
</block>
<table class="flex flex-col">
<template x-for="tag in item.tags.split(' ')">
<tr>
<td style="width: 24px; min-width: 24px; max-width: 24px" class="aspect-square bg-gray-300 p-1"><img src="/icons/baby.svg" /></td>
<td class="p-1" x-text="tag"></td>
</tr>
</template>
</table>
<block class="bg-gray-800">
<h2>Current Status</h2>
<p>Polaroid retro pork belly yes plz bitters, viral chicharrones typewriter chartreuse vice Brooklyn. Adaptogen pour-over vibecession viral. Tote bag tonx DIY microdosing. Pickled selvage bespoke small batch, blue bottle twee tacos jean shorts before they sold out chicharrones solarpunk. Hoodie taiyaki poutine jianbing chambray.</p>
<block>
<h4>Current Status</h4>
<p x-text="item.current_status"></p>
</block>
</block>
<block>
<h2>Planned Work</h2>
<p>Polaroid retro pork belly yes plz bitters, viral chicharrones typewriter chartreuse vice Brooklyn. Adaptogen pour-over vibecession viral. Tote bag tonx DIY microdosing. Pickled selvage bespoke small batch, blue bottle twee tacos jean shorts before they sold out chicharrones solarpunk. Hoodie taiyaki poutine jianbing chambray.</p>
<block>
<h4>Planned Work</h4>
<p x-text="item.planned_work"></p>
</block>
<block class="bg-gray-800">
<h2>Read The Code</h2>
<p>Polaroid retro pork belly yes plz bitters, viral chicharrones typewriter chartreuse vice Brooklyn. Adaptogen pour-over vibecession viral. Tote bag tonx DIY microdosing. Pickled selvage bespoke small batch, blue bottle twee tacos jean shorts before they sold out chicharrones solarpunk. Hoodie taiyaki poutine jianbing chambray.</p>
<button><a href="https://git.learnjsthehardway.com/learn-code-the-hard-way/turings-tarpit">View the Git</a></button>
<block>
<h4>Read The Code</h4>
<p>All of the code for this project is online in my personal git repository. It's not open source, but you can read the code, run the game, and learn from it. Think of it like the programmer's version of a thirst trap on Instagram. You can look but you own nothing.</p>
<button><a :href="item.code_url" target="_blank">View the Git</a></button>
</block>
</grid>
</block>
</bar>
</div>

View file

@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<meta name="viewport" content="initial-scale=1.0" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="author" content="Zed A. Shaw" />
<meta name="description" content="My Go learning project, which is a Twitch support thing." />
<link rel="icon" href="/favicon.ico" type="image/x-icon" />