summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2025-04-25 10:38:11 -0600
committermo khan <mo@mokhan.ca>2025-04-25 10:38:11 -0600
commitdc508adae977d632570e88631e829b8143bc0d2d (patch)
tree7e1c0ebfdd5487f90fa39e2125588993aabe0f00
parent470d99d532a6a9c48f051a2c49db6bc5f4cc3834 (diff)
feat: display author information
-rw-r--r--app/views/dashboard/show.html.tmpl18
-rw-r--r--pkg/domain/user_test.go2
-rw-r--r--public/index.html18
3 files changed, 26 insertions, 12 deletions
diff --git a/app/views/dashboard/show.html.tmpl b/app/views/dashboard/show.html.tmpl
index 899b798..da8552f 100644
--- a/app/views/dashboard/show.html.tmpl
+++ b/app/views/dashboard/show.html.tmpl
@@ -10,7 +10,7 @@
<script src="/application.js"></script>
</head>
<body>
- <main id="app" class="container">
+ <header class="container">
<nav>
<ul>
<li><strong>SparkleLab✨</strong></li>
@@ -23,7 +23,9 @@
</li>
</ul>
</nav>
+ </header>
+ <main id="app" class="container">
<form v-on:submit.prevent="submitSparkle">
<label>/sparkle <input type="text" placeholder="@tanuki for helping me with my homework!" v-model="sparkle" /> </label>
<button type="submit" v-bind:disabled="isDisabled">✨ Sparkle</button>
@@ -31,12 +33,14 @@
<span class="error">${ errorMessage }</span>
<h1>${ heading }</h1>
- <div v-for="sparkle in recentSparkles">
- <p> <strong>${ sparkle.sparklee }</strong> ${ sparkle.reason } </p>
- </div>
- {{range .Sparkles}}
- <div>{{ . }}</div>
- {{end}}
+ <article v-for="sparkle in recentSparkles">
+ <header>
+ <a :href="sparkle.author.profile"><strong>@${ sparkle.author.username }</strong></a> says
+ </header>
+ <blockquote>
+ /sparkle <strong>${ sparkle.sparklee }</strong> ${ sparkle.reason }
+ </blockquote>
+ </article>
</main>
</body>
</html>
diff --git a/pkg/domain/user_test.go b/pkg/domain/user_test.go
index 7bcd9d3..1576d6d 100644
--- a/pkg/domain/user_test.go
+++ b/pkg/domain/user_test.go
@@ -10,7 +10,7 @@ import (
func TestUser(t *testing.T) {
t.Run("Sparkle", func(t *testing.T) {
t.Run("returns a new Sparkle", func(t *testing.T) {
- tanuki := &User{Username: "@tanuki"}
+ tanuki := &User{Username: "tanuki"}
user := &User{}
sparkle := user.Sparkle(tanuki.Username, "for helping me with my homework")
diff --git a/public/index.html b/public/index.html
index 03a393b..3200151 100644
--- a/public/index.html
+++ b/public/index.html
@@ -10,7 +10,7 @@
<script src="/application.js"></script>
</head>
<body>
- <main id="app" class="container">
+ <header class="container">
<nav>
<ul>
<li><strong>SparkleLab✨</strong></li>
@@ -19,11 +19,21 @@
<li><a href="/session/new">Login</a></li>
</ul>
</nav>
+ </header>
+ <main id="app" class="container">
<h1>${ heading }</h1>
- <div v-for="sparkle in recentSparkles">
- <p> <strong>${ sparkle.sparklee }</strong> ${ sparkle.reason } </p>
- </div>
+
+ <article v-for="sparkle in recentSparkles">
+ <header>
+ <a :href="sparkle.author.profile"><strong>@${ sparkle.author.username }</strong></a> says
+ </header>
+ <blockquote>
+ /sparkle <strong>${ sparkle.sparklee }</strong> ${ sparkle.reason }
+ </blockquote>
+ </article>
</main>
+
+ <footer></footer>
</body>
</html>