2023-07-22 16:19:42 -04:00
import { ComponentChildren , toChildArray } from "preact" ;
import { Main , render_and_copy , shuffle , n_of } from "./common.tsx" ;
2023-07-27 12:20:58 -04:00
const tag_link = ( tag : string ) = > ` https://cohost.org/rc/tagged/ ${ tag } ` ;
2023-07-22 16:19:42 -04:00
const Tag = ( { tag } : { tag : string } ) = > (
2023-07-27 12:20:58 -04:00
< a href = { tag_link ( tag ) } > { ` # ${ tag } ` } < / a >
2023-07-22 16:19:42 -04:00
) ;
2023-07-24 16:17:00 -04:00
const tags = [
"CSS Crimes" ,
"borgesposting" ,
"NEISVoid" ,
"circling the square" ,
"retrocomputing" ,
"cats of cohost" ,
"coho film club" ,
"cohost crafts" ,
"the cohost plural feed" ,
"cohost summer mixtape" ,
"trans trucks" ,
"The Cohost Local Feed (Minnesota)" ,
"cohost draws" ,
"tv head" ,
"make up a mech pilot" ,
"frasierposting" ,
"cohost utilities" ,
"alt text request" ,
"meepismonday" ,
2023-07-27 12:20:58 -04:00
"rats" ,
"worldwide music wednesday" ,
"chaos magick" ,
2023-07-31 17:07:27 -04:00
"tea" ,
"journaling" ,
"digital collage" ,
"gamedev" ,
2023-08-19 20:30:42 -04:00
"manga recs" ,
"doll posting" ,
"comics on cohost" ,
"he is only carbon now" ,
"trickcircle" ,
"Cohost Mixtape Club" ,
"mashup" ,
"girlposting" ,
"jewhost" ,
"musicians on cohost" ,
"ooak" ,
"The Cohost Gimmick Feed" ,
"gardening" ,
"dogs of cohost" ,
"cheeseposting" ,
"love" ,
"little guy respect zone" ,
"gunpla" ,
2023-07-24 16:17:00 -04:00
] ;
2023-07-22 16:19:42 -04:00
2023-08-19 20:30:42 -04:00
const default_repeat = 2 ;
2023-07-27 12:20:58 -04:00
2023-08-19 20:30:42 -04:00
// repeating makes it seem more random, but adds a lot of weight to an increasingly heavy post
2023-07-22 16:19:42 -04:00
export const PseudoRandom = ( {
children ,
2023-07-27 12:20:58 -04:00
repeat = default_repeat ,
2023-07-22 16:19:42 -04:00
} : {
children : ComponentChildren ;
repeat? : number ;
} ) = > (
< div
class = "pseudo-random"
style = { {
2023-07-23 01:13:16 -04:00
display : "flex" ,
2023-07-22 19:51:31 -04:00
backgroundColor : "#008282" ,
borderRadius : "0.5rem" ,
height : "3rem" ,
2023-07-22 16:19:42 -04:00
} }
>
{ . . . n_of ( repeat , toChildArray ( children ) )
. map ( shuffle )
. flat ( )
. map ( child = > < Choice > { child } < / Choice > ) }
< / div >
) ;
/// width is 0-1
export const Choice = ( { children } : { children : ComponentChildren } ) = > (
< details
style = { {
width : "100%" ,
2023-07-23 01:13:16 -04:00
display : "flex" ,
flex : 1 ,
2023-07-22 16:19:42 -04:00
cursor : "pointer" ,
} }
class = "choice"
>
< summary
style = { { listStyle : "none" , width : "100%" , height : "100%" } }
> < / summary >
2023-07-22 19:51:31 -04:00
< div
class = "result"
style = { {
position : "absolute" ,
top : "1.5rem" ,
left : 0 ,
right : 0 ,
width : "100%" ,
2023-07-24 16:17:00 -04:00
height : "fit-content" ,
2023-07-22 19:51:31 -04:00
display : "flex" ,
alignContent : "center" ,
justifyContent : "center" ,
verticalAlign : "center" ,
color : "white" ,
} }
>
{ children }
< / div >
2023-07-22 16:19:42 -04:00
< / details >
) ;
render_and_copy (
< Main >
< PseudoRandom > { . . . tags . map ( tag = > < Tag tag = { tag } / > ) } < / PseudoRandom >
2023-07-22 19:51:31 -04:00
Some notes :
< ul >
< li > all tags are from @TagOfTheDay < / li >
< li > i ' ll do my best to keep this up to date < / li >
2023-07-27 12:20:58 -04:00
< li >
you can also go { " " }
< a
href = { ` https://pyrope.net/randirect# ${ tags
. map ( tag_link )
. join ( "::" ) } ` }
>
here
< / a > { " " }
to be redirected to a random tag
< / li >
2023-07-22 19:51:31 -04:00
< ul >
< li >
it would be helpful if you could pester me in the comments
when this tag list is out of date ( most recent first ) : ( also
you can just like . use this tag list )
< / li >
< ul >
{ . . . tags . toReversed ( ) . map ( tag = > (
< li >
< Tag tag = { tag } / >
< / li >
) ) }
< / ul >
< / ul >
< li >
if there 's enough interest, i' ll hack together a little
generator for these ( it would be easy to make one for tags , but
one for other stuff would require a bit more work )
< / li >
2023-08-19 20:30:42 -04:00
< li >
a lot of these tags are bad tags . not their content , but , like , the actual tag . this drives me up the wall but i know there 's nothing i can do. i really wish everyone cared about good tagging as much as i do, but i know that will never happen. it' s frustrating that only boorus seem to have good tags ( sometimes ) ( implications and stuff help )
< / li >
2023-07-24 16:17:00 -04:00
< li >
this was generated on { new Date ( ) . toDateString ( ) } at { " " }
{ new Date ( ) . toTimeString ( ) }
< / li >
2023-07-22 19:51:31 -04:00
< / ul >
2023-07-22 16:19:42 -04:00
< / Main >
) ;