mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 10:47:04 +02:00
feat: avatars
This commit is contained in:
1 parent
1551dc50fd
commit
b96f925d9a
5 files changed
+48
No files matched your search
Vendored
+1
@@ -194,6 +194,7 @@
|
||||
"Smri",
|
||||
"Specularity",
|
||||
"SSAO",
|
||||
"stackable",
|
||||
"startcase",
|
||||
"statkit",
|
||||
"statsfull",
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import type { CatalogItemAccessor } from "@blitzkit/closed";
|
||||
import type { Tank } from "../../protos/tank";
|
||||
import type { TankList } from "../../protos/tank_list";
|
||||
import type { Tanks } from "../../protos/tanks";
|
||||
@@ -13,4 +14,6 @@ export abstract class AbstractAPI {
|
||||
): Promise<Record<string, string>>;
|
||||
|
||||
abstract tank(id: string): Promise<Tank>;
|
||||
|
||||
abstract avatars(): Promise<CatalogItemAccessor[]>;
|
||||
}
|
||||
@@ -145,4 +145,8 @@ export class ServerAPI extends AbstractAPI {
|
||||
const tankList = await this.tankList();
|
||||
return this._tank(id, tankList);
|
||||
}
|
||||
|
||||
async avatars() {
|
||||
return this.metadata.group("ProfileAvatarEntity");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
---
|
||||
import { ProfileAvatarComponent_Category } from "@protos/blitz_static_profile_avatar_component";
|
||||
import { Grade } from "@protos/blitz_static_standard_grades_enum";
|
||||
import { api } from "../../core/api/dynamic";
|
||||
import BaseLayout from "../../layouts/BaseLayout.astro";
|
||||
|
||||
const avatars = await api.avatars();
|
||||
---
|
||||
|
||||
<BaseLayout accent="gold">
|
||||
{
|
||||
avatars.map((avatar) => {
|
||||
const ui = avatar.StuffUI("UIComponent");
|
||||
const profileAvatar = avatar.ProfileAvatar();
|
||||
|
||||
return (
|
||||
<>
|
||||
<h3>
|
||||
{ui.display_name} {Grade[ui.grade]}{" "}
|
||||
{ProfileAvatarComponent_Category[profileAvatar.category]}
|
||||
</h3>
|
||||
|
||||
{ui.description && <p>{ui.description}</p>}
|
||||
{ui.obtaining_methods && <p>{ui.obtaining_methods}</p>}
|
||||
{ui.features && <p>{ui.features}</p>}
|
||||
|
||||
<img width="128" src={profileAvatar.avatar} />
|
||||
|
||||
{avatar.components.sellableComponent && (
|
||||
<pre>{JSON.stringify(avatar.Sellable(), null, 2)}</pre>
|
||||
)}
|
||||
|
||||
<br />
|
||||
</>
|
||||
);
|
||||
})
|
||||
}
|
||||
</BaseLayout>
|
||||
@@ -11,5 +11,7 @@ import BaseLayout from "../layouts/BaseLayout.astro";
|
||||
|
||||
<p><a href="/tanks">/tanks</a></p>
|
||||
|
||||
<p><a href="/avatars">/avatars</a></p>
|
||||
|
||||
<p><a href="/api">/api</a></p>
|
||||
</BaseLayout>
|
||||
Reference in new issue
Block a user