From 63ab31668a12d7f2ac93f26a7d4dab20c0ba15bc Mon Sep 17 00:00:00 2001 From: ellielle <40385743+ellielle@users.noreply.github.com> Date: Fri, 14 Jun 2024 13:20:49 -0400 Subject: [PATCH 1/5] fix kill screen and inactive screens for boss --- .../src/components/content/BossBattle.svelte | 143 ++++++++++++------ 1 file changed, 93 insertions(+), 50 deletions(-) diff --git a/frontend/src/components/content/BossBattle.svelte b/frontend/src/components/content/BossBattle.svelte index 31e5a25..2c3f359 100644 --- a/frontend/src/components/content/BossBattle.svelte +++ b/frontend/src/components/content/BossBattle.svelte @@ -4,6 +4,9 @@ let boss = {}; + // The boss's defeat date is encoded as the zero date in ISO 8601 format + const undefeated = new Date("0001-01-01T00:00:00Z"); + function fetchBossUpdate() { BossBattle().then((result) => (boss = result)); } @@ -23,11 +26,18 @@
{#if Object.keys(boss).length === 0}

Loading...

- {:else} - - {#if new Date(boss.Event.ExpiresAt) < new Date(Date.now())} - -
+ {:else if new Date(boss.Event.DefeatedAt) > undefeated} + +
+ Boss fight +
+
+

has been defeated! -

+ +
+ +

You gained {boss.XPUser} XP during the fight.

The final blow was dealt on {new Date( boss.Event.DefeatedAt, ).toLocaleDateString()}.

- {:else} - -
- Boss fight -
-

{boss.Event.Boss.Name}

+
+ {:else if new Date(boss.Event.ExpiresAt) < new Date(Date.now())} + +
+ Boss fight +
+
+

+ + {boss.Event.Boss.Name} + + has escaped! +

+
+
+

You gained {boss.XPUser} XP during the fight.

- {boss.Event.Boss.Description} + They managed to escape the Arcanum on {new Date( + boss.Event.DefeatedAt, + ).toLocaleDateString()}.

-

- The battle against {boss.Event.Boss.Name} has begun! -

-
-
-
-
- {( - 100 - - (boss.XPTotal / boss.Event.Boss.HealthPoints) * 100 - ).toFixed(0)}% -
+
+ {:else} + +
+ Boss fight +
+

{boss.Event.Boss.Name}

+

+ {boss.Event.Boss.Description} +

+

+ The battle against {boss.Event.Boss.Name} has begun! +

+
+
+
+
+ {( + 100 - + (boss.XPTotal / boss.Event.Boss.HealthPoints) * 100 + ).toFixed(0)}%
-
+
+
-
-
- Damage dealt by the arcanum: {boss.XPTotal} -
+
+
+ Damage dealt by the arcanum: {boss.XPTotal} +
+
+ Damage dealt by you: {boss.XPUser} / 5000 required to qualify. +
+ {#each boss.Event.Boss.Rewards as reward (reward.UUID)}
- Damage dealt by you: {boss.XPUser} / 5000 required to qualify. + Reward at {reward.UnlockedAt} damage: {boss.XPTotal > + reward.UnlockedAt + ? "✓" + : "✗"}
- {#each boss.Event.Boss.Rewards as reward (reward.UUID)} -
- Reward at {reward.UnlockedAt} damage: {boss.XPTotal > - reward.UnlockedAt - ? "✓" - : "✗"} -
- {/each} -
- {/if} + {/each} +
{/if}
From d66df5b754315d75ab546d7ef63c6028f3ce1367 Mon Sep 17 00:00:00 2001 From: ellielle <40385743+ellielle@users.noreply.github.com> Date: Fri, 14 Jun 2024 14:21:33 -0400 Subject: [PATCH 2/5] change to limit the number queried to 10 --- internal/bootdevapi/bootdevapi.go | 4 ++-- internal/bootdevapi/bootdevapi_test.go | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/internal/bootdevapi/bootdevapi.go b/internal/bootdevapi/bootdevapi.go index 6b8ea59..a0a4f70 100644 --- a/internal/bootdevapi/bootdevapi.go +++ b/internal/bootdevapi/bootdevapi.go @@ -11,9 +11,9 @@ func BootDevAPIMap(URL string) (string, error) { // general global stats endpoint api["stats"] = "https://api.boot.dev/v1/leaderboard_stats" // daily stats endpoint - api["daily"] = "https://api.boot.dev/v1/leaderboard_xp/day?limit=30" + api["daily"] = "https://api.boot.dev/v1/leaderboard_xp/day?limit=10" // discord / community karma endpoint - api["karma"] = "https://api.boot.dev/v1/leaderboard_karma/alltime?limit=30" + api["karma"] = "https://api.boot.dev/v1/leaderboard_karma/alltime?limit=10" // live course finish feed api["feed"] = "https://api.boot.dev/v1/lesson_completion_feed" // user data endpoint diff --git a/internal/bootdevapi/bootdevapi_test.go b/internal/bootdevapi/bootdevapi_test.go index e87fd9f..b656fa8 100644 --- a/internal/bootdevapi/bootdevapi_test.go +++ b/internal/bootdevapi/bootdevapi_test.go @@ -6,8 +6,6 @@ import ( "github.com/google/go-cmp/cmp" ) -// TODO: add more tests as API develops - // Tests that the proper url is returned // and that the function works itself func TestMain(t *testing.T) { @@ -17,8 +15,8 @@ func TestMain(t *testing.T) { }{ "archmage": {input: "archmage", want: "https://api.boot.dev/v1/leaderboard_archmage"}, "stats": {input: "stats", want: "https://api.boot.dev/v1/leaderboard_stats"}, - "daily": {input: "daily", want: "https://api.boot.dev/v1/leaderboard_xp/day?limit=30"}, - "karma": {input: "karma", want: "https://api.boot.dev/v1/leaderboard_karma/alltime?limit=30"}, + "daily": {input: "daily", want: "https://api.boot.dev/v1/leaderboard_xp/day?limit=10"}, + "karma": {input: "karma", want: "https://api.boot.dev/v1/leaderboard_karma/alltime?limit=10"}, "user": {input: "user", want: "https://api.boot.dev/v1/users"}, "achievements": {input: "achievements", want: "https://api.boot.dev/v1/users/achievements"}, "feed": {input: "feed", want: "https://api.boot.dev/v1/lesson_completion_feed"}, From a5373433e747df1293132ffea491bd85cece662b Mon Sep 17 00:00:00 2001 From: ellielle <40385743+ellielle@users.noreply.github.com> Date: Fri, 14 Jun 2024 14:22:04 -0400 Subject: [PATCH 3/5] change the theme --- frontend/index.html | 2 +- frontend/src/style.css | 5 ++++- frontend/tailwind.config.js | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/frontend/index.html b/frontend/index.html index 44f14dd..0856459 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -7,7 +7,7 @@ Boot.dev Buddy - +
diff --git a/frontend/src/style.css b/frontend/src/style.css index 71538ac..ee00c82 100644 --- a/frontend/src/style.css +++ b/frontend/src/style.css @@ -1,6 +1,5 @@ html, body { - background-color: rgba(31, 31, 35, 1); color: white; margin: 0; padding: 0; @@ -25,3 +24,7 @@ body { #app { height: 100%; } + +.dark body { + background-color: white; +} diff --git a/frontend/tailwind.config.js b/frontend/tailwind.config.js index 3f9cd95..9705634 100644 --- a/frontend/tailwind.config.js +++ b/frontend/tailwind.config.js @@ -24,7 +24,7 @@ export default { // 4. Append the Skeleton plugin (after other plugins) skeleton({ themes: { - preset: ["crimson"], + preset: [{ name: "gold-nouveau", enhancements: true }], custom: [bootDevTheme], }, }), From 6fab260540acd29aec39d91e64ac236557fa1e92 Mon Sep 17 00:00:00 2001 From: ellielle <40385743+ellielle@users.noreply.github.com> Date: Fri, 14 Jun 2024 14:22:34 -0400 Subject: [PATCH 4/5] add a clarification on the courses pages --- frontend/src/components/content/Courses.svelte | 2 ++ 1 file changed, 2 insertions(+) diff --git a/frontend/src/components/content/Courses.svelte b/frontend/src/components/content/Courses.svelte index 0b46abd..50b0a96 100644 --- a/frontend/src/components/content/Courses.svelte +++ b/frontend/src/components/content/Courses.svelte @@ -112,6 +112,8 @@ {#if !init} Loading... {:else} +

Course List:

+ (clicking will take you to where you left off) {#each sortedCourses as course (course.UUID)}
From 7ecf1aaa8070de6a13b58c99e4cb9ee40f8bf055 Mon Sep 17 00:00:00 2001 From: ellielle <40385743+ellielle@users.noreply.github.com> Date: Fri, 14 Jun 2024 14:22:47 -0400 Subject: [PATCH 5/5] re-enable stats page, with stats --- frontend/src/components/content/Stats.svelte | 70 ++++++++++++++------ 1 file changed, 51 insertions(+), 19 deletions(-) diff --git a/frontend/src/components/content/Stats.svelte b/frontend/src/components/content/Stats.svelte index c041369..b5e3719 100644 --- a/frontend/src/components/content/Stats.svelte +++ b/frontend/src/components/content/Stats.svelte @@ -13,6 +13,21 @@ // Holds the top 30 leaderboard users let leaders = []; + // skeletonUI color palette numbers, reversed so I don't have to do anything + // funky in the HTML + const skeletonUINum = [ + "900", + "800", + "700", + "600", + "500", + "400", + "300", + "200", + "100", + "50", + ]; + // Because separating the keys with regex is worse const generalStats = { LessonCompletions: "Lessons Completed", @@ -46,26 +61,43 @@ getTopCommunity(); getGlobalStats(); }); + + // TODO: split arcanum stats and leaderboard stats into their own components with refresh timers
- {#if false} - {#each Object.entries(stats) as stat} -
- {generalStats[stat[0]] + ": " + stat[1]} -
- {/each} - {#each archons as sage} -
- {sage?.Handle} -
- {/each} - {#each leaders as lead} -
- {lead?.Handle} -
- {/each} - {:else} - Under work - {/if} +
+
    +

    Arcanum Stats

    + {#each Object.entries(stats) as stat} +
  • + + {generalStats[stat[0]] + ": " + stat[1]} + +
  • + {/each} +
+ +
+

Archon Leaderboard

+
    + {#each archons as sage, index} +
    + {sage?.Handle} +
    + {/each} +
+
+ +
+

Daily Leaderboard

+
    + {#each leaders as lead} +
    + {lead?.Handle} +
    + {/each} +
+
+