From ab2ed60eb7f5dbcc5b74cbe3ebc16474e5042957 Mon Sep 17 00:00:00 2001 From: Maxence Lallemand Date: Sun, 18 Aug 2024 16:38:56 +0200 Subject: [PATCH 1/3] feat: add marquee route and page --- .gitignore | 3 ++- main.go | 5 +++++ templates/marquee.html | 16 ++++++++++++++++ webpanel/misc.go | 27 +++++++++++++++++++++++++++ 4 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 templates/marquee.html create mode 100644 webpanel/misc.go diff --git a/.gitignore b/.gitignore index dd64054..c63e152 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ config.xml salt.bin thumbnail.ces /assets/contest -.DS_Store \ No newline at end of file +.DS_Store +assets/marquee \ No newline at end of file diff --git a/main.go b/main.go index 178c8bc..32fcfed 100644 --- a/main.go +++ b/main.go @@ -78,6 +78,11 @@ func main() { } { auth.GET("/admin", panel.AdminPage) + auth.GET("/marquee", panel.MarqueePage) + auth.POST("/editmarquee", panel.EditMarquee) + auth.POST("/marquee", func(c *gin.Context) { + c.Redirect(http.StatusMovedPermanently, "/panel/marquee") + }) auth.GET("/contests", panel.ViewContests) auth.POST("/contests", func(c *gin.Context) { c.Redirect(http.StatusMovedPermanently, "/panel/contests") diff --git a/templates/marquee.html b/templates/marquee.html new file mode 100644 index 0000000..9ef4592 --- /dev/null +++ b/templates/marquee.html @@ -0,0 +1,16 @@ + + + + + + Marquee Editor + + +
+
+ + +
+
+ + \ No newline at end of file diff --git a/webpanel/misc.go b/webpanel/misc.go new file mode 100644 index 0000000..ae76a14 --- /dev/null +++ b/webpanel/misc.go @@ -0,0 +1,27 @@ +package webpanel + +import ( + "fmt" + "net/http" + "os" + + "github.com/gin-gonic/gin" +) + +func (w *WebPanel) MarqueePage(c *gin.Context) { + c.HTML(http.StatusOK, "marquee.html", gin.H{}) +} + +func (w *WebPanel) EditMarquee(c *gin.Context) { + marquee_text := c.PostForm("marquee_text") + + err := os.WriteFile(fmt.Sprintf("%s/marquee/marquee.txt", w.Config.AssetsPath), []byte(marquee_text), 0666) + if err != nil { + c.HTML(http.StatusInternalServerError, "error.html", gin.H{ + "error": err, + }) + return + } + + c.Redirect(http.StatusTemporaryRedirect, "/panel/marquee") +} From 07eb04c6c308314c06d29f8fbfebc139adea0de9 Mon Sep 17 00:00:00 2001 From: Alex Date: Sun, 18 Aug 2024 18:27:03 +0200 Subject: [PATCH 2/3] feat: Updated marquee updater UI --- assets/output.css | 52 ++++++++++++++++++++------ templates/marquee.html | 85 +++++++++++++++++++++++++++++++++++++----- 2 files changed, 117 insertions(+), 20 deletions(-) diff --git a/assets/output.css b/assets/output.css index f52ff5f..c195149 100644 --- a/assets/output.css +++ b/assets/output.css @@ -1,5 +1,5 @@ /* -! tailwindcss v3.4.7 | MIT License | https://tailwindcss.com +! tailwindcss v3.4.10 | MIT License | https://tailwindcss.com */ /* @@ -691,6 +691,10 @@ h1 { margin: 0.5rem; } +.mb-10 { + margin-bottom: 2.5rem; +} + .mb-3 { margin-bottom: 0.75rem; } @@ -763,10 +767,6 @@ h1 { margin-top: 1.5rem; } -.mb-10 { - margin-bottom: 2.5rem; -} - .\!block { display: block !important; } @@ -1016,6 +1016,26 @@ h1 { border-bottom-right-radius: 0.5rem; } +.rounded-l-xl { + border-top-left-radius: 0.75rem; + border-bottom-left-radius: 0.75rem; +} + +.rounded-r-sm { + border-top-right-radius: 0.125rem; + border-bottom-right-radius: 0.125rem; +} + +.rounded-l-sm { + border-top-left-radius: 0.125rem; + border-bottom-left-radius: 0.125rem; +} + +.rounded-r-xl { + border-top-right-radius: 0.75rem; + border-bottom-right-radius: 0.75rem; +} + .border { border-width: 1px; } @@ -1127,6 +1147,11 @@ h1 { background-color: rgb(248 113 113 / var(--tw-bg-opacity)); } +.bg-red-500 { + --tw-bg-opacity: 1; + background-color: rgb(239 68 68 / var(--tw-bg-opacity)); +} + .bg-white { --tw-bg-opacity: 1; background-color: rgb(255 255 255 / var(--tw-bg-opacity)); @@ -1137,9 +1162,9 @@ h1 { background-color: rgb(250 204 21 / var(--tw-bg-opacity)); } -.bg-red-500 { +.bg-gray-600 { --tw-bg-opacity: 1; - background-color: rgb(239 68 68 / var(--tw-bg-opacity)); + background-color: rgb(75 85 99 / var(--tw-bg-opacity)); } .bg-\[url\(\'https\:\/\/rc24\.xyz\/goodies\/wallpapers\/CMO_Channel_BG_orange_1600x900\.png\'\)\] { @@ -1640,14 +1665,19 @@ h1 { background-color: rgb(239 68 68 / var(--tw-bg-opacity)); } -.hover\:bg-red-300:hover { +.hover\:bg-red-600:hover { --tw-bg-opacity: 1; - background-color: rgb(252 165 165 / var(--tw-bg-opacity)); + background-color: rgb(220 38 38 / var(--tw-bg-opacity)); } -.hover\:bg-red-600:hover { +.hover\:bg-gray-700:hover { --tw-bg-opacity: 1; - background-color: rgb(220 38 38 / var(--tw-bg-opacity)); + background-color: rgb(55 65 81 / var(--tw-bg-opacity)); +} + +.hover\:bg-gray-400:hover { + --tw-bg-opacity: 1; + background-color: rgb(156 163 175 / var(--tw-bg-opacity)); } .hover\:underline:hover { diff --git a/templates/marquee.html b/templates/marquee.html index 9ef4592..7f18e66 100644 --- a/templates/marquee.html +++ b/templates/marquee.html @@ -1,16 +1,83 @@ - + + - - - Marquee Editor + Edit Marquee | CMOC Control Panel + + + + + + + + + + + + + + - -
-
- - + + +
+
+ +

CMOC
Control Panel

+
+
+
+

+ CMOC Edit Marquee +

+
+

Write down below the text you want to display on the Check Mii Out Channel Marquee. +

+ + + +
+
+

©2020 - 2024 WiiLink Team

+ + \ No newline at end of file From d03709daa141dd9909f7e176a8a0d91e83cf7690 Mon Sep 17 00:00:00 2001 From: Alex Date: Sun, 18 Aug 2024 18:28:46 +0200 Subject: [PATCH 3/3] Update marquee.html --- templates/marquee.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/marquee.html b/templates/marquee.html index 7f18e66..93c3c00 100644 --- a/templates/marquee.html +++ b/templates/marquee.html @@ -56,7 +56,7 @@

CMOC
Control Panel