Search Apps Documentation Source Content File Folder Download Copy Actions Download

view_home_page.gno

1.17 Kb · 37 lines
 1package basedao
 2
 3import (
 4	"gno.land/p/moul/md"
 5	"gno.land/p/nt/ufmt/v0"
 6)
 7
 8func (d *DAOPrivate) HomePageView(path string) string {
 9	pkgPath := d.Realm.PkgPath()
10	linkPath := getLinkPath(pkgPath)
11	return d.HomeProfileHeaderView(path == HOME_NO_PROFILE_PATH) +
12		md.Link("> Go to Members", linkPath+":"+MEMBERS_PATH) + "\n\n" +
13		md.Link("> Go to Proposals", linkPath+":"+PROPOSALS_PATH) + "\n"
14}
15
16func (d *DAOPrivate) HomeProfileHeaderView(noprofile bool) string {
17	s := ""
18	name := d.GetProfileString(d.Realm.Address(), "DisplayName", "DAO")
19	description := d.GetProfileString(d.Realm.Address(), "Bio", "Created with daokit")
20	pkgPath := d.Realm.PkgPath()
21	linkPath := getLinkPath(pkgPath)
22
23	if !noprofile {
24		s += ufmt.Sprintf("# %s\n\n", name)
25		imageURI := d.GetProfileString(d.Realm.Address(), "Avatar", "")
26		if imageURI != "" {
27			s += ufmt.Sprintf("![Image](%s)\n\n", imageURI)
28		}
29		s += ufmt.Sprintf("%s\n\n", description)
30	}
31
32	s += ufmt.Sprintf("> Realm address: %s\n\n", d.Realm.Address())
33	s += ufmt.Sprintf("Discover more about this DAO on the [configuration page ⚙️](%s:%s)\n\n", linkPath, CONFIG_PATH)
34	s += ufmt.Sprintf("\n--------------------------------\n")
35
36	return s
37}