event.gno
3.26 Kb · 81 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: "Goûter Perché au Beaj Kafé",
32 Description: "## Salut !\n\nÇa te dit de venir prendre le goûter avec nous ? On organise une petite rencontre entre neurozinzins qui vivent des trucs similaires côté santé mentale.\n\n### Qui sommes-nous ?\nNous, les volontaires de La Maison Perchée en Finistère, le 1er chapitre Breton de La Maison Perchée !\n\n### Infos pratiques\n\n- 📆 Le samedi 09 août à partir de 16h et jusqu'à 18h\n- 📍 Le Beaj Kafé, 51 Rue Branda, 29200 Brest\n- ⏲️ 2h environ, mais tu peux partir quand tu veux\n\n### Ce qu'on propose\n\n- Un endroit cool et safe où on peut parler librement\n- Des discussions détendues, sans pression\n- Chacun fait comme il se sent\n- Une ambiance décontractée\n\n### Juste pour que tu saches\n\n- Tu viens si tu en as envie, aucune obligation !\n- Même si tu as une mauvaise passe, tu es le/la bienvenu(e)\n- Pas besoin de raconter ta vie si tu n'en as pas envie\n- Ce qui se dit entre nous reste entre nous\n- Si tu as des besoins particuliers, dis-le nous, on s'adapte\n\n### One more thing\n\nSi tu as des questions ou des doutes, n'hésite pas à nous écrire. On veut juste que tu te sentes à l'aise :)\n\nOn espère te voir bientôt !\n\n---\n\nMathieu, et les volontaires de La Maison Perchée en Finistère",
33 ImageURI: "ipfs://bafybeidvhxx5rlusis7etlv4g2otrdf5n5yemzxnr6jqitmcy4luv3icoe",
34 StartDate: 1754748000,
35 EndDate: 1754755200,
36 Capacity: 10,
37 Discoverable: true,
38 GetProfileString: profile.GetStringField,
39 SetProfileString: profile.SetStringField,
40 ZenaoAdminAddr: "g1djrkw9tf4px658j85cc6fhsvm50uf9s0g6kfsm",
41 Location: &zenaov1.EventLocation{
42 Address: &zenaov1.AddressGeo{
43 Address: "Beaj Kafé - 51 Rue Branda, 29200 Brest, France",
44 Lat: 48.392975,
45 Lng: -4.480546,
46 },
47 },
48 ParticipationPubkey: "",
49 CrossFn: crossFn,
50 SetImplemFn: setImplem,
51 FeedId: feedId,
52 PrivateVarName: "event",
53 }
54 event = events.NewEvent(&conf)
55 eventreg.Register(cross, func() *zenaov1.EventInfo { return event.Info() })
56}
57
58func Vote(_ realm, proposalID uint64, vote daocond.Vote) {
59 localDAO.Vote(proposalID, vote)
60}
61
62func Execute(_ realm, proposalID uint64) {
63 localDAO.Execute(proposalID)
64}
65
66func Render(path string) string {
67 return localDAO.Render(path)
68}
69
70func feedAuth() (string, bool) {
71 caller := event.DAOPrivate.CallerID() // XXX: this should be upgradable
72 return caller, basedao.MustGetMembersViewExtension(localDAO).IsMember(caller)
73}
74
75func crossFn(_ realm, cb func()) {
76 cb()
77}
78
79func setImplem(newLocalDAO daokit.DAO, newDAO daokit.DAO) {
80 localDAO, DAO = newLocalDAO, newDAO
81}