-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add miscellaneous stats section with virtual list support (#31)
* feat: add svelte-tiny-virtual-list dependency * feat: add miscellaneous stats section and related components * feat: enhance AdditionStat component with rarity color support * feat: update Items component title style to be font-semibold * feat: add styles for virtual list wrapper and inner components
- Loading branch information
Showing
22 changed files
with
518 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<script lang="ts"> | ||
import type { Stats as StatsType } from "$types/stats"; | ||
import { getContext, setContext } from "svelte"; | ||
import Auctions from "./misc/auctions.svelte"; | ||
import Claimed from "./misc/claimed.svelte"; | ||
import Damage from "./misc/damage.svelte"; | ||
import Dragons from "./misc/dragons.svelte"; | ||
import Endstone from "./misc/endstone.svelte"; | ||
import Essence from "./misc/essence.svelte"; | ||
import Gifts from "./misc/gifts.svelte"; | ||
import Jerry from "./misc/jerry.svelte"; | ||
import Kills from "./misc/kills.svelte"; | ||
import Mythological from "./misc/mythological.svelte"; | ||
import Pet from "./misc/pet.svelte"; | ||
import Potions from "./misc/potions.svelte"; | ||
import Races from "./misc/races.svelte"; | ||
import Uncategorized from "./misc/uncategorized.svelte"; | ||
import Upgrades from "./misc/upgrades.svelte"; | ||
const profile = getContext<StatsType>("profile"); | ||
setContext("misc", profile.misc); | ||
console.log(profile.misc); | ||
</script> | ||
|
||
<h3 class="text-2xl capitalize">Miscellaneous</h3> | ||
|
||
<Essence /> | ||
<!-- TODO: Essence Shop --> | ||
<Kills /> | ||
<Races /> | ||
<Gifts /> | ||
<Jerry /> | ||
<Dragons /> | ||
<Endstone /> | ||
<Damage /> | ||
<Pet /> | ||
<Mythological /> | ||
<Potions /> | ||
<Upgrades /> | ||
<Auctions /> | ||
<Claimed /> | ||
<Uncategorized /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<script lang="ts"> | ||
import AdditionStat from "$lib/components/AdditionStat.svelte"; | ||
import Items from "$lib/layouts/stats/Items.svelte"; | ||
import type { Stats as StatsType } from "$types/stats"; | ||
import { format } from "numerable"; | ||
import { getContext } from "svelte"; | ||
const misc = getContext<StatsType["misc"]>("misc"); | ||
</script> | ||
|
||
<Items title="Auctions Sold"> | ||
<div slot="text"> | ||
<AdditionStat text="Fees" data={format(misc.auctions.fees)} /> | ||
<AdditionStat text="Coins Earned" data={format(misc.auctions.gold_earned)} /> | ||
<AdditionStat text="Items Sold" data={format(misc.auctions.total_sold.total)} asterisk={true}> | ||
{#each Object.entries(misc.auctions.total_sold) as [rarity, amount]} | ||
{#if rarity !== "total"} | ||
<AdditionStat text={rarity} data={amount} textRarityColor={rarity.toLowerCase()} /> | ||
{/if} | ||
{/each} | ||
</AdditionStat> | ||
</div> | ||
</Items> | ||
|
||
<Items title="Auctions Bought"> | ||
<div slot="text"> | ||
<AdditionStat text="Bids" data={format(misc.auctions.bids)} /> | ||
<AdditionStat text="Highest Bid" data={format(misc.auctions.highest_bid)} /> | ||
<AdditionStat text="Won" data={format(misc.auctions.won)} /> | ||
<AdditionStat text="Coins Spent" data={format(misc.auctions.gold_spent)} /> | ||
<AdditionStat text="Items Bought" data={format(misc.auctions.total_bought.total)} asterisk={true}> | ||
{#each Object.entries(misc.auctions.total_bought) as [rarity, amount]} | ||
{#if rarity !== "total"} | ||
<AdditionStat text={rarity} data={amount} textRarityColor={rarity.toLowerCase()} /> | ||
{/if} | ||
{/each} | ||
</AdditionStat> | ||
</div> | ||
</Items> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<script lang="ts"> | ||
import AdditionStat from "$lib/components/AdditionStat.svelte"; | ||
import Items from "$lib/layouts/stats/Items.svelte"; | ||
import type { Stats as StatsType } from "$types/stats"; | ||
import { formatDate, formatDistanceToNowStrict } from "date-fns"; | ||
import { getContext } from "svelte"; | ||
const misc = getContext<StatsType["misc"]>("misc"); | ||
</script> | ||
|
||
<Items title="Claimed Items"> | ||
<div slot="text"> | ||
{#each Object.entries(misc.claimed_items) as [item, time]} | ||
<AdditionStat | ||
text={item.replaceAll("_", " ")} | ||
data={formatDistanceToNowStrict(time, { | ||
addSuffix: true | ||
})} | ||
asterisk={true}> | ||
{formatDate(time, "'Claimed on' dd MMMM yyyy 'at' HH:mm")} | ||
</AdditionStat> | ||
{/each} | ||
</div> | ||
</Items> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<script lang="ts"> | ||
import AdditionStat from "$lib/components/AdditionStat.svelte"; | ||
import Items from "$lib/layouts/stats/Items.svelte"; | ||
import type { Stats as StatsType } from "$types/stats"; | ||
import { format } from "numerable"; | ||
import { getContext } from "svelte"; | ||
const misc = getContext<StatsType["misc"]>("misc"); | ||
</script> | ||
|
||
<Items title="Damage"> | ||
<div slot="text"> | ||
{#each Object.entries(misc.damage) as [text, data]} | ||
<AdditionStat text={text.replaceAll("_", " ")} data={format(data.toFixed(3))} /> | ||
{/each} | ||
</div> | ||
</Items> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<script lang="ts"> | ||
import AdditionStat from "$lib/components/AdditionStat.svelte"; | ||
import Items from "$lib/layouts/stats/Items.svelte"; | ||
import type { Stats as StatsType } from "$types/stats"; | ||
import { format } from "numerable"; | ||
import { getContext } from "svelte"; | ||
const misc = getContext<StatsType["misc"]>("misc"); | ||
</script> | ||
|
||
<Items title="Dragons"> | ||
<div slot="text"> | ||
<AdditionStat text="Most Damage" data={format(misc.dragons.most_damage.best.toFixed(0))} asterisk={true}> | ||
{#each Object.entries(misc.dragons.most_damage) as [text, data]} | ||
{#if text !== "best"} | ||
<AdditionStat {text} data={format(data.toFixed(0))} /> | ||
{/if} | ||
{/each} | ||
</AdditionStat> | ||
<AdditionStat text="Fastest Kill" data={misc.dragons.fastest_kill.best} asterisk={true}> | ||
{#each Object.entries(misc.dragons.fastest_kill) as [text, data]} | ||
{#if text !== "best"} | ||
<AdditionStat {text} {data} /> | ||
{/if} | ||
{/each} | ||
</AdditionStat> | ||
<!-- TODO: Last Hits --> | ||
<AdditionStat text="Deats" data={format(misc.dragons.deaths.total)} asterisk={true}> | ||
{#each Object.entries(misc.dragons.deaths) as [text, data]} | ||
{#if text !== "total"} | ||
<AdditionStat {text} data={format(data)} /> | ||
{/if} | ||
{/each} | ||
</AdditionStat> | ||
</div> | ||
</Items> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<script lang="ts"> | ||
import AdditionStat from "$lib/components/AdditionStat.svelte"; | ||
import Items from "$lib/layouts/stats/Items.svelte"; | ||
import type { Stats as StatsType } from "$types/stats"; | ||
import { format } from "numerable"; | ||
import { getContext } from "svelte"; | ||
const misc = getContext<StatsType["misc"]>("misc"); | ||
</script> | ||
|
||
<Items title="Endstone Protector"> | ||
<div slot="text"> | ||
{#each Object.entries(misc.endstone_protector) as [text, data]} | ||
<AdditionStat text={text.replaceAll("_", " ")} data={format(data)} /> | ||
{/each} | ||
</div> | ||
</Items> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<script lang="ts"> | ||
import Chip from "$lib/components/Chip.svelte"; | ||
import { cn } from "$lib/utils"; | ||
import type { Stats as StatsType } from "$types/stats"; | ||
import { format } from "numerable"; | ||
import { getContext } from "svelte"; | ||
const misc = getContext<StatsType["misc"]>("misc"); | ||
</script> | ||
|
||
<div class="space-y-4"> | ||
<h3 class="text-xl font-semibold">Essence</h3> | ||
<div class="flex flex-wrap gap-4"> | ||
{#each misc.essence as essence} | ||
{@const hasUnlocked = essence.amount} | ||
<Chip image={{ src: essence.texture }} class={cn("h-fit w-fit", { "opacity-50": !hasUnlocked })}> | ||
<div class={cn("flex flex-col")}> | ||
<div class="font-bold"> | ||
<span class="opacity-60">{essence.name}</span> | ||
<div class="text-sm"> | ||
<span class="opacity-60">Amount:</span> | ||
<span class="text-text">{format(essence.amount)}</span> | ||
</div> | ||
</div> | ||
</div> | ||
</Chip> | ||
{/each} | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<script lang="ts"> | ||
import AdditionStat from "$lib/components/AdditionStat.svelte"; | ||
import Items from "$lib/layouts/stats/Items.svelte"; | ||
import type { Stats as StatsType } from "$types/stats"; | ||
import { format } from "numerable"; | ||
import { getContext } from "svelte"; | ||
const misc = getContext<StatsType["misc"]>("misc"); | ||
</script> | ||
|
||
<Items title="Gifts"> | ||
<div slot="text"> | ||
{#each Object.entries(misc.gifts) as [text, data]} | ||
<AdditionStat text={text.replaceAll("_", " ")} data={format(data)} /> | ||
{/each} | ||
</div> | ||
</Items> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<script lang="ts"> | ||
import AdditionStat from "$lib/components/AdditionStat.svelte"; | ||
import Items from "$lib/layouts/stats/Items.svelte"; | ||
import type { Stats as StatsType } from "$types/stats"; | ||
import { format } from "numerable"; | ||
import { getContext } from "svelte"; | ||
const misc = getContext<StatsType["misc"]>("misc"); | ||
</script> | ||
|
||
<Items title="Season of Jerry"> | ||
<div slot="text"> | ||
{#each Object.entries(misc.season_of_jerry) as [text, data]} | ||
<AdditionStat text={text.replaceAll("_", " ")} data={format(data)} /> | ||
{/each} | ||
</div> | ||
</Items> |
Oops, something went wrong.