event.gno

2.83 Kb · 80 lines
 1package event
 2
 3import (
 4	zenaov1 "gno.land/p/zenao/zenao/v1"
 5	"gno.land/p/zenao/events"
 6	"gno.land/p/zenao/basedao"
 7	"gno.land/p/zenao/daokit"
 8	"gno.land/p/zenao/daocond"
 9	"gno.land/r/demo/profile"
10	"gno.land/r/zenao/eventreg"
11	"gno.land/r/zenao/social_feed"
12)
13
14var (
15	DAO      daokit.DAO
16	localDAO daokit.DAO
17
18	event  *events.Event // XXX: needed for backward compatibility with frontend queries
19	feedId string        // XXX: workaround for "unexpected zero object id" issue
20)
21
22func init() {
23	// XXX: workaround for "unexpected zero object id" issue
24	feedId = social_feed.NewFeed(cross, "main", false, feedAuth)
25}
26
27func init() {
28	conf := events.Config{
29		Organizers: []string{"gno.land/r/zenao/users/u377"},
30		Gatekeepers: []string{},
31		Title: "La Maison Perchée à Flux présente : Le Goûter",
32		Description: "## La Maison Perchée à Flux\n\nRejoignez-nous pour un moment convivial et bienveillant dans un espace dédié à l'inclusion ! \n\nLa Maison Perchée en Finistère vous invite à partager un goûter où chacun·e peut être pleinement soi-même, dans le respect et la célébration de toutes les zinzineries\n\n## Un espace sécurisant et inclusif\n\nCe temps de rencontre s'adresse aux personnes souhaitant évoluer dans un environnement où le trouble psychique est accepté et pas tabou.\n\nQue vous soyez en questionnement, en affirmation ou simplement en recherche d'un lieu accueillant, vous êtes les bienvenu·e·s.\n\n## Informations\n\n- 🤗 La Maison Perchée à Flux présente : Le Goûter\n-  📆 Vendredi  14 novembre, de 17h à 19h\n- 📍 Flux, 3 rue du Cosquer, 29000 Quimper",
33		ImageURI: "ipfs://bafybeieiig4pmklcab524ccqc3zirqz4p2lwoc5v3mks422lgrq7mq2tbm",
34		StartDate: 1763136000,
35		EndDate: 1763143200,
36		Capacity: 12,
37		Discoverable: true,
38		GetProfileString: profile.GetStringField,
39		SetProfileString: profile.SetStringField,
40		ZenaoAdminAddr: "g1djrkw9tf4px658j85cc6fhsvm50uf9s0g6kfsm",
41		Location: &zenaov1.EventLocation{
42			Address: &zenaov1.AddressCustom{
43				Address: "Flux, 3 rue du Cosquer, 29000 Quimper",
44				Timezone: "Europe/Paris",
45			},
46		},
47		ParticipationPubkey: "",
48		CrossFn: crossFn,
49		SetImplemFn: setImplem,
50		FeedId: feedId,
51		PrivateVarName: "event",
52	}
53	event = events.NewEvent(&conf)
54	eventreg.Register(cross, func() *zenaov1.EventInfo { return event.Info() })
55}
56
57func Vote(_ realm, proposalID uint64, vote daocond.Vote) {
58	localDAO.Vote(proposalID, vote)
59}
60
61func Execute(_ realm, proposalID uint64) {
62	localDAO.Execute(proposalID)
63}
64
65func Render(path string) string {
66	return localDAO.Render(path)
67}
68
69func feedAuth() (string, bool) {
70	caller := event.DAOPrivate.CallerID() // XXX: this should be upgradable
71	return caller, basedao.MustGetMembersViewExtension(localDAO).IsMember(caller)
72}
73
74func crossFn(_ realm, cb func()) {
75	cb()
76}
77
78func setImplem(newLocalDAO daokit.DAO, newDAO daokit.DAO) {
79	localDAO, DAO = newLocalDAO, newDAO
80}