1package home
2
3import (
4 "std"
5 "strings"
6
7 "gno.land/p/demo/ufmt"
8 "gno.land/p/moul/md"
9 "gno.land/r/leon/hof"
10)
11
12var (
13 pfp string // link to profile picture
14 pfpCaption string // profile picture caption
15 abtMe string
16
17 modernVotes int64
18 classicVotes int64
19 minimalVotes int64
20 currentTheme string
21
22 modernLink string
23 classicLink string
24 minimalLink string
25)
26
27func init() {
28 pfp = "https://static.artzone.ai/media/38734/conversions/IPF9dR7ro7n05CmMLLrXIojycr1qdLFxgutaaanG-w768.webp"
29 pfpCaption = "My profile picture - Tarantula Nebula"
30 abtMe = `Motivated Computer Science student with strong
31 analytical and problem-solving skills. Proficient in
32 programming and version control, with a high level of
33 focus and attention to detail. Eager to apply academic
34 knowledge to real-world projects and contribute to
35 innovative technology solutions.
36 In addition to my academic pursuits,
37 I enjoy traveling and staying active through weightlifting.
38 I have a keen interest in electronic music and often explore various genres.
39 I believe in maintaining a balanced lifestyle that complements my professional development.`
40
41 modernVotes = 0
42 classicVotes = 0
43 minimalVotes = 0
44 currentTheme = "classic"
45 modernLink = "https://www.google.com"
46 classicLink = "https://www.google.com"
47 minimalLink = "https://www.google.com"
48 hof.Register()
49}
50
51func UpdatePFP(url, caption string) {
52 AssertAuthorized()
53 pfp = url
54 pfpCaption = caption
55}
56
57func UpdateAboutMe(col1 string) {
58 AssertAuthorized()
59 abtMe = col1
60}
61
62func maxOfThree(a, b, c int64) int64 {
63 max := a
64 if b > max {
65 max = b
66 }
67 if c > max {
68 max = c
69 }
70 return max
71}
72
73func VoteModern() {
74 ugnotAmount := std.GetOrigSend().AmountOf("ugnot")
75 votes := ugnotAmount
76 modernVotes += votes
77 updateCurrentTheme()
78}
79
80func VoteClassic() {
81 ugnotAmount := std.GetOrigSend().AmountOf("ugnot")
82 votes := ugnotAmount
83 classicVotes += votes
84 updateCurrentTheme()
85}
86
87func VoteMinimal() {
88 ugnotAmount := std.GetOrigSend().AmountOf("ugnot")
89 votes := ugnotAmount
90 minimalVotes += votes
91 updateCurrentTheme()
92}
93
94func updateCurrentTheme() {
95 maxVotes := maxOfThree(modernVotes, classicVotes, minimalVotes)
96
97 if maxVotes == modernVotes {
98 currentTheme = "modern"
99 } else if maxVotes == classicVotes {
100 currentTheme = "classic"
101 } else {
102 currentTheme = "minimal"
103 }
104}
105
106func CollectBalance() {
107 AssertAuthorized()
108
109 banker := std.GetBanker(std.BankerTypeRealmSend)
110 ownerAddr := Address()
111
112 banker.SendCoins(std.CurrentRealm().Addr(), ownerAddr, banker.GetCoins(std.CurrentRealm().Addr()))
113}
114
115func Render(path string) string {
116 var sb strings.Builder
117
118 // Theme-specific header styling
119 switch currentTheme {
120 case "modern":
121 // Modern theme - Clean and minimalist with emojis
122 sb.WriteString(md.H1("๐ Matija's Space"))
123 sb.WriteString(md.Image(pfpCaption, pfp))
124 sb.WriteString("\n")
125 sb.WriteString(md.Italic(pfpCaption))
126 sb.WriteString("\n")
127 sb.WriteString(md.HorizontalRule())
128 sb.WriteString(abtMe)
129 sb.WriteString("\n")
130
131 case "minimal":
132 // Minimal theme - No emojis, minimal formatting
133 sb.WriteString(md.H1("Matija Marjanovic"))
134 sb.WriteString("\n")
135 sb.WriteString(abtMe)
136 sb.WriteString("\n")
137 sb.WriteString(md.Image(pfpCaption, pfp))
138 sb.WriteString("\n")
139 sb.WriteString(pfpCaption)
140 sb.WriteString("\n")
141
142 default: // classic
143 // Classic theme - Traditional blog style with decorative elements
144 sb.WriteString(md.H1("โจ Welcome to Matija's Homepage โจ"))
145 sb.WriteString("\n")
146 sb.WriteString(md.Image(pfpCaption, pfp))
147 sb.WriteString("\n")
148 sb.WriteString(pfpCaption)
149 sb.WriteString("\n")
150 sb.WriteString(md.HorizontalRule())
151 sb.WriteString(md.H2("About me"))
152 sb.WriteString("\n")
153 sb.WriteString(abtMe)
154 sb.WriteString("\n")
155 }
156
157 // Theme-specific voting section
158 switch currentTheme {
159 case "modern":
160 sb.WriteString(md.HorizontalRule())
161 sb.WriteString(md.H2("๐จ Theme Selector"))
162 sb.WriteString("Choose your preferred viewing experience:\n")
163 items := []string{
164 md.Link(ufmt.Sprintf("Modern Design (%d votes)", modernVotes), modernLink),
165 md.Link(ufmt.Sprintf("Classic Style (%d votes)", classicVotes), classicLink),
166 md.Link(ufmt.Sprintf("Minimal Look (%d votes)", minimalVotes), minimalLink),
167 }
168 sb.WriteString(md.BulletList(items))
169
170 case "minimal":
171 sb.WriteString("\n")
172 sb.WriteString(md.H3("Theme Selection"))
173 sb.WriteString(ufmt.Sprintf("Current theme: %s\n", currentTheme))
174 sb.WriteString(ufmt.Sprintf("Votes - Modern: %d | Classic: %d | Minimal: %d\n",
175 modernVotes, classicVotes, minimalVotes))
176 sb.WriteString(md.Link("Modern", modernLink))
177 sb.WriteString(" | ")
178 sb.WriteString(md.Link("Classic", classicLink))
179 sb.WriteString(" | ")
180 sb.WriteString(md.Link("Minimal", minimalLink))
181 sb.WriteString("\n")
182
183 default: // classic
184 sb.WriteString(md.HorizontalRule())
185 sb.WriteString(md.H2("โจ Theme Customization โจ"))
186 sb.WriteString(md.Bold("Choose Your Preferred Theme:"))
187 sb.WriteString("\n\n")
188 items := []string{
189 ufmt.Sprintf("Modern ๐ (%d votes) - %s", modernVotes, md.Link("Vote", modernLink)),
190 ufmt.Sprintf("Classic โจ (%d votes) - %s", classicVotes, md.Link("Vote", classicLink)),
191 ufmt.Sprintf("Minimal โก (%d votes) - %s", minimalVotes, md.Link("Vote", minimalLink)),
192 }
193 sb.WriteString(md.BulletList(items))
194 }
195
196 // Theme-specific footer/links section
197 switch currentTheme {
198 case "modern":
199 sb.WriteString(md.HorizontalRule())
200 sb.WriteString(md.Link("GitHub", "https://github.com/matijamarjanovic"))
201 sb.WriteString(" | ")
202 sb.WriteString(md.Link("LinkedIn", "https://www.linkedin.com/in/matijamarjanovic"))
203 sb.WriteString("\n")
204
205 case "minimal":
206 sb.WriteString("\n")
207 sb.WriteString(md.Link("GitHub", "https://github.com/matijamarjanovic"))
208 sb.WriteString(" | ")
209 sb.WriteString(md.Link("LinkedIn", "https://www.linkedin.com/in/matijamarjanovic"))
210 sb.WriteString("\n")
211
212 default: // classic
213 sb.WriteString(md.HorizontalRule())
214 sb.WriteString(md.H3("โจ Connect With Me"))
215 items := []string{
216 md.Link("๐ GitHub", "https://github.com/matijamarjanovic"),
217 md.Link("๐ผ LinkedIn", "https://www.linkedin.com/in/matijamarjanovic"),
218 }
219 sb.WriteString(md.BulletList(items))
220 }
221
222 return sb.String()
223}
224
225func UpdateModernLink(link string) {
226 AssertAuthorized()
227 modernLink = link
228}
229
230func UpdateClassicLink(link string) {
231 AssertAuthorized()
232 classicLink = link
233}
234
235func UpdateMinimalLink(link string) {
236 AssertAuthorized()
237 minimalLink = link
238}
home.gno
6.44 Kb ยท 238 lines