From 776265c301e9994613ccaa4606e63c0a48d797e6 Mon Sep 17 00:00:00 2001 From: LLLL Colonq Date: Thu, 12 Dec 2024 05:48:49 -0500 Subject: Greencircle site --- flake.nix | 17 +++ main.css | 13 ++- src/Main/Greencircle.purs | 45 ++++++++ src/Utils.purs | 3 + templates/greencircle/index.html | 225 ++++++++++++++++++++++++++++++++++++++- 5 files changed, 299 insertions(+), 4 deletions(-) diff --git a/flake.nix b/flake.nix index e8249ea..a5c4d87 100644 --- a/flake.nix +++ b/flake.nix @@ -65,6 +65,21 @@ cp -r dist/auth/deploy/* $out/ ''; }; + bundleGreencircle = pkgs.stdenv.mkDerivation { + name = "bundt-bundle-greencircle"; + src = ./.; + buildInputs = [ + (purescript.command {}) + pkgs.m4 + ]; + buildPhase = " + make deploy_greencircle + "; + installPhase = '' + mkdir -p $out + cp -r dist/greencircle/deploy/* $out/ + ''; + }; in { devShells.x86_64-linux.default = pkgs.mkShell { buildInputs = [ @@ -83,6 +98,7 @@ inherit bundleAPI bundleAuth + bundleGreencircle ; }; overlay = self: super: { @@ -90,6 +106,7 @@ inherit bundleAPI bundleAuth + bundleGreencircle ; }; }; diff --git a/main.css b/main.css index 612f69c..6dd2b89 100644 --- a/main.css +++ b/main.css @@ -460,8 +460,8 @@ a.lcolonq-button-link :active { margin-right: 1rem; margin-bottom: 1rem; display: grid; - grid-auto-flow: dense; - grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); + justify-content: center; + grid-template-columns: repeat(auto-fit, 20rem); grid-auto-rows: minmax(10rem, auto); gap: 1rem; } @@ -469,6 +469,15 @@ a.lcolonq-button-link :active { .lcolonq-gc-panel { border: solid black; padding: 1rem; + /* display: none; */ +} + +.lcolonq-gc-panel:hover { + background-color: #eeeeee; +} + +.lcolonq-gc-visible { + display: block; } .lcolonq-gc-panel h2 { diff --git a/src/Main/Greencircle.purs b/src/Main/Greencircle.purs index 17f3e0c..1fa434c 100644 --- a/src/Main/Greencircle.purs +++ b/src/Main/Greencircle.purs @@ -2,10 +2,55 @@ module Main.Greencircle where import Prelude +import Config as Config +import Data.Array as Array +import Data.HTTP.Method (Method(..)) +import Data.Maybe (Maybe(..)) +import Data.String as String +import Data.String.Pattern as String +import Data.Traversable (for, for_) import Effect (Effect) +import Effect.Aff (launchAff_) import Effect.Class (liftEffect) import Effect.Console (log) +import Fetch (fetch) +import UI as UI +import Utils as Utils + +adjective :: Int -> String +adjective x + | x == 0 = "sleepy" + | x == 1 = "singular" + | x == 2 = "double trouble" + | x == 3 = "triplicate" + | otherwise = "relentless" + +updateLive :: Effect Unit +updateLive = launchAff_ do + { text: resp } <- fetch (Config.apiServer <> "/circle") {} + res <- resp + let names = + Array.filter (not <<< String.null) + $ String.split (String.Pattern " ") + $ String.replaceAll (String.Pattern "\"") (String.Replacement "") + $ String.replaceAll (String.Pattern "(") (String.Replacement "") + $ String.replaceAll (String.Pattern ")") (String.Replacement "") res + adj <- Utils.byId "lcolonq-gc-adjective" + Utils.setText adj $ adjective $ Array.length names + for_ names \n -> do + liftEffect $ log n + p <- Utils.byId $ "lcolonq-gc-panel-" <> n + Utils.addClass "lcolonq-gc-visible" p main :: Effect Unit main = do liftEffect $ log "hello it is greencircle" + panels <- Utils.queryAll ".lcolonq-gc-panel" + for_ panels \p -> do + pid <- Utils.getId p + case String.stripPrefix (String.Pattern "lcolonq-gc-panel-") pid of + Nothing -> pure unit + Just user -> do + Utils.listen p "click" \_ev -> do + UI.redirect $ "https://twitch.tv/" <> user + updateLive diff --git a/src/Utils.purs b/src/Utils.purs index 4755436..8c530ef 100644 --- a/src/Utils.purs +++ b/src/Utils.purs @@ -54,6 +54,9 @@ query q = do Nothing -> liftEffect $ throw $ "could not find element matching query: " <> q Just x -> pure x +getId :: forall m. MonadEffect m => DOM.Element -> m String +getId e = liftEffect $ DOM.El.id e + listen :: forall m. MonadEffect m => DOM.Element -> String -> (Ev.Event -> Effect Unit) -> m Unit listen e ev f = do l <- liftEffect $ Ev.Tar.eventListener f diff --git a/templates/greencircle/index.html b/templates/greencircle/index.html index 0e02871..64ecbaf 100644 --- a/templates/greencircle/index.html +++ b/templates/greencircle/index.html @@ -57,17 +57,18 @@ CONFIG_SUBST

-

"greencircle" is relentless

+

"greencircle" is

LCOLONQ

- little ffreak. online now. + little ffreak. online.

prodzpod

cool guy (they). creatureform. gizmo development and game development also. inconceivably powerful. also they're live right now btw you should go say hi. + they're insane at tetris.

Tyumici

@@ -77,6 +78,226 @@ CONFIG_SUBST if you were wondering, they're streaming now. you are encouraged to investigate this.
+
+

ellg

+ world's premiere video game ost enthusiast. + very skilled programmer. + funny (for real). + they're a gamer, too, from time to time. + you should go and enjoy their company immediately. +
+
+

JakeCreatesStuff

+ his name is jake and he creates stuff. + robotics enjoyer. + plays games on "unconventional" peripherals. + a real sweetheart, and they're live right now! +
+
+

badcop_

+ neither a cop nor bad. + frequently enjoys web programming in bash. + makes cool games, too. + you should learn more, here, now. +
+
+

basie

+ indie game developer. + he is a kiwi. i recently learned this means from new zealand. + they're cool and nice and talented. + they deserve many accolades. + or perhaps just a hello, since they're doing the thing now. +
+
+

Hexadigital

+ a plant in the shape of a friend. + a committed gamer, but they've been known to do a bit of programming. + makes stuff for retroachievements, a cool project that you should look up if you don't know it already. + they're up to something right now check it out! + +
+
+

Venorrak

+ a television man. + builds many fun things on the web. + curator of the Joel archive, and a dear friend. + consider investigating: they are broadcasting! + you will not regret this. +
+
+

zulleyy3

+ comfortable and relaxed. + zulleyy3 often broadcasts planning their day, getting work done, or reading wikipedia. + a good place to relax. they have cool hibike euphonium pictures. + maybe you will also like going there. + it is now. +
+
+

vasher_1025

+ enigmatic puzzle enjoyer. + international being of mystery. + tends to stream advent of code in december, and sporadic interesting game stuff otherwise. + if they're live now (they are) you should catch them. + it's a rare treat. +
+
+

CR4ZYK1TTY

+ also known as numbers form. + extravagant godot slash strange device integration efforts. + a true Joeler, from way back. + pleasant to talk with and listen to. + a good friend of us all, and of you, soon. + they're streaming now. +
+
+

yellowberryHN

+ yellowberry hacker news. + yellowberry hungary. + yellowberry harpnet. + one of the coolest people i've ever met. + witness, you'll get it. + owns and develops software for multiple (multiple) arcade machines. + a man of many interests and talents. +
+
+

KotaruComplex

+ the ideal mix of cool gaming and gamer cool. + has a cool workshop. + has streamed welding in the past, among other things. + they're around! + maybe you will find something you enjoy! +
+
+

yiffweed

+ good at math and puzzles. + they like mazes a lot too. + developing a really cool roguelike. + also arpg gaming. + they're up to something. + you should check it out! +
+
+

BigGayMikey

+ comfortable gaming and comfortable programming. + a constant and soothing presence. + they have a really cool cat on the screen that i like a lot. + they're doing something now live. + it's worth a look, perhaps you can make a new friend. +
+
+

37LN37

+ thirtyseven natural log thirtyseven. + they are an insanely talented artist. + you may think i'm just saying that. + click and you will see. + they're doing stuff live! + (probably drawing). + they are also a vocaloid enjoyer. +
+
+

vesdev

+ finnish game developer. + i went to their stream once and they had their editor open aongside both warframe and osrs. + actively interacting with all of the above. + they have a cool keyboard and a camera for it too. + consider: it's vesdev now, begin. +
+
+

bvnanana

+ artist and game developer. + aesthetically pleasing twitch redeems and overall setup. + wonderful banana creature. + banana! +
+
+

YukieVT

+ cat (sometimes also worm). + programming, often for dos. + also circuits and hardware and music and many other things besides. + yook does it all. + you ought to check it out, go. + try throwing the cheese. +
+
+

Colinahscopy_

+ programmer and real human man. + a cool and chill guy. + newspaper archival enthusiast. + excellent! + you should look: here! +
+
+

NovaLiminal

+ game developer and retro mmo enjoyer. + comfortable vibrations. + pleasant times online. + also factory type gameplay? + it's a question that you can answer, once you find out here, now. +
+
+

Meisaka

+ programmer and factorio enthusiast. + has a very cool computer (false) connected to the broadcast. + frequently low-level stuff. + fox style. + sometimes they also like ffxiv too. + here, now. +
+
+

NineteenNinetyX

+ mother speedrunner. + neato television-based gaming. + a dear friend to many, and also now to you. +
+
+

Ricardo_Stryki

+ strange independent games. + some programming learning also. + in english and spanish, perhaps this is of interest. + if it is: it's going. +
+
+

exodrifter_

+ indie game developer (real). + runs a cool forum called tsuki. + board games exclamation point question mark!? + all of these things and more, right now, click. +
+
+

RayMarch

+ graphics programmer. + self-described infamous twitch chatter. + shaders! + shaders! + shaders! +
+
+

SaladForrest

+ cool creature with impeccable taste. + interactive stream technology development. + something about hershey. + they're streaming now btw. +
+
+

bigbookofbug

+ huge tome of insect. + lisp programming in the bugzone. + good for the book fans and the bug fans. + occasional gaming, too. + it is happening! +
+
+

CipherLunis

+ mobile app development. + also gaming? gaming! + a pleasant fox type character. + you will not regret: here. +
+
+

imgeiser

+ he is geiser. + he is live. +
-- cgit v1.2.3