This commit is contained in:
vilmibm 2024-09-01 23:05:25 +00:00
parent c46e8806d0
commit d950aaead2
2 changed files with 122 additions and 0 deletions

View File

@ -160,6 +160,110 @@ func rsvp(o opts) error {
return sendRSVPEmail(rd)
}
type submitData struct {
Username string
Live bool
When string
Desc string
Length string
Interactive bool
Freeform string
}
func sendSubmitEmail(sd submitData) error {
bs, err := yaml.Marshal(sd)
if err != nil {
return err
}
return email.SendLocalEmail("vilmibm", "SUBMISSION TOWNCON24", string(bs))
}
func submit(o opts) error {
submitContent, err := md.ReadFile("md/submit.md")
if err != nil {
return err
}
out, err := glamour.Render(string(submitContent), "dracula")
if err != nil {
return err
}
fmt.Println(out)
submitting := true
var live bool
var talkWhen string
var length string
var desc string
var freeform string
var interactive bool
notSubmitting := func() bool {
return !submitting
}
form := huh.NewForm(
huh.NewGroup(
huh.NewConfirm().Title("So...wanna submit a thing?").Value(&submitting),
),
huh.NewGroup(
huh.NewConfirm().Title("Excellent. Is it a live talk?").Value(&live),
).WithHideFunc(notSubmitting),
huh.NewGroup(
huh.NewInput().Title("During what time frame can you give the talk").
Description("please include relevant time zone information!").Value(&talkWhen),
).WithHideFunc(func() bool { return !live || !submitting }),
huh.NewGroup(
huh.NewText().Title("Please describe your submission").
Description("Include details like media format, topic, whether it's text or browser based.").Value(&desc),
).WithHideFunc(notSubmitting),
huh.NewGroup(
huh.NewInput().TitleFunc(func() string {
if live {
return "About how long is your talk?"
} else {
return "If your piece has a duration (eg audio/video), approximately what is it?"
}
}, &live).Value(&length),
).WithHideFunc(notSubmitting),
huh.NewGroup(
huh.NewConfirm().Title("Is your submission interactive?").
Description("for example a game or website").
Value(&interactive),
).WithHideFunc(func() bool { return !submitting || live }),
huh.NewGroup(
huh.NewText().Title("Anything else I should know?").Value(&freeform),
).WithHideFunc(notSubmitting),
)
if err := form.Run(); err != nil {
return err
}
if !submitting {
fmt.Println("ok! just run the command again if you change your mind~")
return nil
}
sd := submitData{
Username: o.Username,
Live: live,
When: talkWhen,
Length: length,
Desc: desc,
Freeform: freeform,
Interactive: interactive,
}
if err = sendSubmitEmail(sd); err != nil {
return err
}
fmt.Println("THANK YOU!! I'll be in touch~")
return sendSubmitEmail(sd)
}
type opts struct {
Username string
}
@ -201,6 +305,7 @@ func _main() error {
case "rsvp":
return rsvp(o)
case "submit":
return submit(o)
case "jam":
case "quit":
default:

17
cmd/towncon/md/submit.md Normal file
View File

@ -0,0 +1,17 @@
_every_ townie is encouraged to submit something (or multiple things) to town con. Seriously: please submit anything that can be consumed via a computer in under 60 minutes. Some ideas:
- a pre-recorded talk
- a live talk to be transmitted over a video call
- a web page
- an essay, short story, or poem
- some ascii art
- a soft ware
- a game for us all to play right then and there
- some XML
- a picture of a cool rock you found
- a picture of your cat
- a picture of someone else's cat
**The whole purpose of this event is to reflect and celebrate the town's vibrant and idiosyncratic community.** No work is too small.
**The DEADLINE to submit is October 8th, 2024.** I am downright excited to talk to you about ideas and offer suggestions! Please reach out to `vilmibm` via email or come chat about it in `town chat`.