From c2913318dec546938cab0dd2dd9959f7473265aa Mon Sep 17 00:00:00 2001 From: Patryk Hegenberg Date: Fri, 29 Dec 2023 09:38:09 +0100 Subject: [PATCH] wrote the server.go file and introduced another file structure --- .env | 6 + {images => assets/images}/01coin.gif | Bin .../images}/16x16DungeonTileset.png | Bin {images => assets/images}/HeroBanner.png | Bin {images => assets/images}/icon.png | Bin {images => assets/images}/monster_imp.png | Bin .../images}/monster_necromancer.png | Bin .../images}/npc_knight_green.png | Bin .../images}/weapon_silver_topaz.png | Bin .../images}/weapon_sword_red.png | Bin .../images}/weapon_sword_ruby.png | Bin {styles => assets/styles}/game.css | 0 {styles => assets/styles}/mathe.css | 0 {styles => assets/styles}/style.css | 132 ++++++++++++++---- server.go | 78 +++++++++++ 15 files changed, 185 insertions(+), 31 deletions(-) create mode 100644 .env rename {images => assets/images}/01coin.gif (100%) rename {images => assets/images}/16x16DungeonTileset.png (100%) rename {images => assets/images}/HeroBanner.png (100%) rename {images => assets/images}/icon.png (100%) rename {images => assets/images}/monster_imp.png (100%) rename {images => assets/images}/monster_necromancer.png (100%) rename {images => assets/images}/npc_knight_green.png (100%) rename {images => assets/images}/weapon_silver_topaz.png (100%) rename {images => assets/images}/weapon_sword_red.png (100%) rename {images => assets/images}/weapon_sword_ruby.png (100%) rename {styles => assets/styles}/game.css (100%) rename {styles => assets/styles}/mathe.css (100%) rename {styles => assets/styles}/style.css (94%) create mode 100644 server.go diff --git a/.env b/.env new file mode 100644 index 0000000..e29f14f --- /dev/null +++ b/.env @@ -0,0 +1,6 @@ +DB_Host: 'db' +DB_Port: 3306 +DB_Name: 'MatheApp' +DB_Charset: 'utf8mb4' +DB_User: 'MatheApp' +DB_Password: 'password' diff --git a/images/01coin.gif b/assets/images/01coin.gif similarity index 100% rename from images/01coin.gif rename to assets/images/01coin.gif diff --git a/images/16x16DungeonTileset.png b/assets/images/16x16DungeonTileset.png similarity index 100% rename from images/16x16DungeonTileset.png rename to assets/images/16x16DungeonTileset.png diff --git a/images/HeroBanner.png b/assets/images/HeroBanner.png similarity index 100% rename from images/HeroBanner.png rename to assets/images/HeroBanner.png diff --git a/images/icon.png b/assets/images/icon.png similarity index 100% rename from images/icon.png rename to assets/images/icon.png diff --git a/images/monster_imp.png b/assets/images/monster_imp.png similarity index 100% rename from images/monster_imp.png rename to assets/images/monster_imp.png diff --git a/images/monster_necromancer.png b/assets/images/monster_necromancer.png similarity index 100% rename from images/monster_necromancer.png rename to assets/images/monster_necromancer.png diff --git a/images/npc_knight_green.png b/assets/images/npc_knight_green.png similarity index 100% rename from images/npc_knight_green.png rename to assets/images/npc_knight_green.png diff --git a/images/weapon_silver_topaz.png b/assets/images/weapon_silver_topaz.png similarity index 100% rename from images/weapon_silver_topaz.png rename to assets/images/weapon_silver_topaz.png diff --git a/images/weapon_sword_red.png b/assets/images/weapon_sword_red.png similarity index 100% rename from images/weapon_sword_red.png rename to assets/images/weapon_sword_red.png diff --git a/images/weapon_sword_ruby.png b/assets/images/weapon_sword_ruby.png similarity index 100% rename from images/weapon_sword_ruby.png rename to assets/images/weapon_sword_ruby.png diff --git a/styles/game.css b/assets/styles/game.css similarity index 100% rename from styles/game.css rename to assets/styles/game.css diff --git a/styles/mathe.css b/assets/styles/mathe.css similarity index 100% rename from styles/mathe.css rename to assets/styles/mathe.css diff --git a/styles/style.css b/assets/styles/style.css similarity index 94% rename from styles/style.css rename to assets/styles/style.css index fbbc2a4..6fbaae5 100644 --- a/styles/style.css +++ b/assets/styles/style.css @@ -20,6 +20,7 @@ h1 { font-size: 2em; margin: 0.67em 0; } + figcaption, figure, main { @@ -50,7 +51,8 @@ img { max-width: 100%; vertical-align: middle; } -.site-header img{ + +.site-header img { height: 60px; } @@ -84,6 +86,7 @@ h6, color: #2e1e26; font-weight: 600; } + h1, .h1 { font-size: 38px; @@ -119,6 +122,7 @@ h2, margin-top: 48px; margin-bottom: 16px; } + h3, .h3 { margin-top: 36px; @@ -141,9 +145,11 @@ p { .container { max-width: 1128px; } + .container-sm { max-width: 848px; } + .container .container-sm { max-width: 800px; padding-left: 0; @@ -167,6 +173,7 @@ p { padding: 12px 0; z-index: 2; } + .site-header-inner { position: relative; display: flex; @@ -179,8 +186,8 @@ p { text-align: center; padding-top: 48px; padding-bottom: 88px; - background-image: url("./../../images/HeroBanner.png"); - background-repeat: no-repeat; + background-image: url("/static/images/HeroBanner.png"); + background-repeat: no-repeat; background-position: center; background-size: cover; } @@ -192,15 +199,18 @@ footer img { .hero-copy { position: relative; } + .hero-paragraph { margin-bottom: 32px; } + .hero-cta { max-width: 400px; margin-left: auto; margin-right: auto; margin-bottom: 80px; } + .lights-toggle { color: rgba(107, 122, 144, 0.64); } @@ -211,10 +221,12 @@ footer img { padding-top: 88px; padding-bottom: 120px; } + .hero-inner { display: flex; justify-content: space-between; } + .hero-copy { padding-top: 40px; padding-right: 48px; @@ -222,33 +234,42 @@ footer img { max-width: 512px; z-index: 1; } + .hero-title { margin-bottom: 16px; } + .hero-paragraph { margin-bottom: 32px; } + .hero-cta { display: flex; align-items: center; margin: 0; } + .hero-cta .button { min-width: 170px; } + .hero-cta .button:first-child { margin-right: 32px; } + .header-illustration { display: block; } + .hero-media { z-index: 0; } + .hero-media img, .hero-media svg { max-width: none; } + .header-illustration-image { display: block; position: absolute; @@ -258,6 +279,7 @@ footer img { height: 324px; } } + .features-wrap { max-width: 540px; margin: 0 auto; @@ -267,21 +289,26 @@ footer img { text-align: center; margin-bottom: 48px; } + .feature:last-of-type { margin-bottom: 0; } + .feature-icon { display: inline-flex; margin-bottom: 16px; } + .feature-icon img, .feature-icon svg { max-width: none; } + .feature-title { position: relative; margin-bottom: 26px; } + .feature-title::after { content: ''; width: 32px; @@ -291,20 +318,25 @@ footer img { left: calc(50% - 16px); background: #e9edf3; } - .feature-title::after { + +.feature-title::after { background: #3f2a34; } + @media (min-width: 641px) { .features { position: relative; } + .features .section-inner { padding-bottom: 100px; } + .features .section-paragraph { padding-left: 72px; padding-right: 72px; } + .features::before { content: ''; width: 100%; @@ -312,40 +344,47 @@ footer img { position: absolute; left: 0; top: 168px; - background: linear-gradient( - to bottom, - #3f2a34, - #3f2a34 - ); + background: linear-gradient(to bottom, + #3f2a34, + #3f2a34); } - .features::before { + + .features::before { display: none; } + .feature { text-align: left; } + .feature-inner { display: flex; } + .feature-icon { display: block; margin-top: 8px; margin-right: 32px; margin-bottom: 0; } + .feature-title::after { left: 0; } } + .cta { position: relative; } + .cta .section-inner { padding-bottom: 64px; } + .cta .section-paragraph { margin-bottom: 32px; } + .cta::before { content: ''; position: absolute; @@ -354,32 +393,39 @@ footer img { height: 263px; width: 1440px; } + .cta-cta { max-width: 400px; margin-left: auto; margin-right: auto; } + @media (max-width: 639px) { .cta-cta .button { display: flex; } } + @media (min-width: 641px) { .cta .section-inner { padding-bottom: 128px; } + .cta .section-paragraph { margin-bottom: 40px; padding-left: 72px; padding-right: 72px; } + .cta::before { bottom: 0; } } + .is-boxed { background: #e9edf3; } + .body-wrap { background: #fff; overflow: hidden; @@ -387,14 +433,17 @@ footer img { flex-direction: column; min-height: 100vh; } + .boxed-container { max-width: 1440px; margin: 0 auto; box-shadow: 0 16px 48px rgba(255, 255, 255, 0.5); } + main { flex: 1 0 auto; } + .section-inner { position: relative; padding-top: 48px; @@ -432,6 +481,7 @@ main { margin: 0 auto; height: 500px; } + .container2 { display: flex; justify-content: center; @@ -440,6 +490,7 @@ main { margin: 0 auto; height: 750px; } + .container3 { display: flex; justify-content: center; @@ -450,6 +501,7 @@ main { background-color: #2e1e26; padding: 20px; } + .container4 { display: flex; justify-content: center; @@ -460,6 +512,7 @@ main { background-color: #2e1e26; padding: 20px; } + .footer-copyright { flex: none; width: 80%; @@ -467,6 +520,7 @@ main { justify-content: center; align-items: center; } + .register { height: 1200px; display: flex; @@ -490,6 +544,7 @@ main { .nes-field { max-width: 400px; } + .login { height: 1200px; display: flex; @@ -510,6 +565,7 @@ main { border-radius: 5px; box-shadow: #3f2a34; } + .learnContainer { display: flex; justify-content: center; @@ -523,6 +579,7 @@ main { border-radius: 5px; box-shadow: 0 0 4px #433e4c } + .profile { height: 1200px; display: flex; @@ -532,58 +589,68 @@ main { border-radius: 5px; box-shadow: #3f2a34; } + .container .login { display: flex; justify-content: center; align-items: center; text-align: center; } + .asset-dark { visibility: hidden; opacity: 0; } + .is-loaded .asset-dark { visibility: visible; opacity: 1; } + .asset-dark { display: none; } - .asset-dark { +.asset-dark { display: block; } - a { + +a { color: #8595ae; } - h1, - h2, - h3, - h4, - h5, - h6, - .h1, - .h2, - .h3, - .h4, - .h5, - .h6 { + +h1, +h2, +h3, +h4, +h5, +h6, +.h1, +.h2, +.h3, +.h4, +.h5, +.h6 { color: #fff !important; } + .is-boxed { background: #3f2a34; } - .body-wrap { + +.body-wrap { background: #2e1e26; } - .boxed-container { + +.boxed-container { box-shadow: 0 16px 48px #433e4c; } - .has-top-divider { +.has-top-divider { position: relative; } - .has-top-divider::before { + +.has-top-divider::before { content: ''; position: absolute; top: 0; @@ -593,10 +660,12 @@ main { height: 1px; background: #3f2a34; } - .has-bottom-divider { + +.has-bottom-divider { position: relative; } - .has-bottom-divider::after { + +.has-bottom-divider::after { content: ''; position: absolute; bottom: 0; @@ -606,6 +675,7 @@ main { height: 1px; background: #3f2a34; } + body, a, h1, @@ -625,4 +695,4 @@ h6, .boxed-container { transition: box-shadow 0.15s ease; -} +} \ No newline at end of file diff --git a/server.go b/server.go new file mode 100644 index 0000000..3ad5e8e --- /dev/null +++ b/server.go @@ -0,0 +1,78 @@ +package main + +import ( + // "fmt" + "net/http" + // "os" + // "os/exec" + // "runtime" + // "strconv" + + // "github.com/chasefleming/elem-go" + // "github.com/chasefleming/elem-go/attrs" + // "github.com/chasefleming/elem-go/htmx" + "the_math_wizard/views" + + "github.com/labstack/echo/v4" + "github.com/labstack/echo/v4/middleware" +) + +func main() { + e := echo.New() + e.Static("/static", "assets") + + // Middleware + e.Use(middleware.Logger()) + e.Use(middleware.Recover()) + + // Routes + e.GET("/", RenderIndexRoute) + e.GET("/learn", RenderLearnRoute) + e.GET("/mathe", RenderMatheRoute) + e.GET("/game", RenderGameRoute) + e.GET("/login", RenderLoginRoute) + e.GET("/register", RenderRegisterRoute) + e.GET("/profile", RenderProfileRoute) + e.GET("/logout", LogoutRoute) + e.GET("/delete", DeleteRoute) + e.GET("/updateData", RenderUpdateRoute) + e.GET("/deleteUser", RenderDeleteRoute) + + // Start the server + e.Logger.Fatal(e.Start(":3000")) + +} + +func RenderIndexRoute(c echo.Context) error { + return c.HTML(http.StatusOK, views.RenderIndex()) +} +func RenderLearnRoute(c echo.Context) error { + return nil +} +func RenderMatheRoute(c echo.Context) error { + return nil +} +func RenderGameRoute(c echo.Context) error { + return nil +} +func RenderLoginRoute(c echo.Context) error { + return nil +} +func RenderRegisterRoute(c echo.Context) error { + return nil +} +func RenderProfileRoute(c echo.Context) error { + return nil +} +func LogoutRoute(c echo.Context) error { + return nil +} +func DeleteRoute(c echo.Context) error { + return nil +} +func RenderUpdateRoute(c echo.Context) error { + return nil +} +func RenderDeleteRoute(c echo.Context) error { + return nil +}