mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 12:09:51 +02:00
feat: docs
This commit is contained in:
1 parent
7e11c1e5ce
commit
6a21c9aaac
8 files changed
+76
-7
No files matched your search
@@ -4,3 +4,6 @@
|
|||||||
[submodule "submodules/CUE4Parse"]
|
[submodule "submodules/CUE4Parse"]
|
||||||
path = submodules/CUE4Parse
|
path = submodules/CUE4Parse
|
||||||
url = https://github.com/FabianFG/CUE4Parse
|
url = https://github.com/FabianFG/CUE4Parse
|
||||||
|
[submodule "submodules/blitzkit-internal"]
|
||||||
|
path = submodules/blitzkit-internal
|
||||||
|
url = https://github.com/blitzkit/internal
|
||||||
Vendored
+1
@@ -51,6 +51,7 @@
|
|||||||
"CUBEMAP",
|
"CUBEMAP",
|
||||||
"CUBETEXCOORD",
|
"CUBETEXCOORD",
|
||||||
"customperiod",
|
"customperiod",
|
||||||
|
"Datacard",
|
||||||
"datasource",
|
"datasource",
|
||||||
"Dava",
|
"Dava",
|
||||||
"dbid",
|
"dbid",
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { BlitzKitAvatar } from '@protos/blitzkit_static_all_avatars_component';
|
import type { BlitzKitAvatar } from '@protos/blitzkit';
|
||||||
import { Dialog } from '@radix-ui/themes';
|
import { Dialog } from '@radix-ui/themes';
|
||||||
import type { MaybeSkeletonComponentProps } from '../../types/maybeSkeletonComponentProps';
|
import type { MaybeSkeletonComponentProps } from '../../types/maybeSkeletonComponentProps';
|
||||||
import { Content } from './Content';
|
import { Content } from './Content';
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import {
|
|||||||
import { Badge, Box, Button, Dialog, Flex, Link, Text } from '@radix-ui/themes';
|
import { Badge, Box, Button, Dialog, Flex, Link, Text } from '@radix-ui/themes';
|
||||||
import { Var } from '../../core/radix/var';
|
import { Var } from '../../core/radix/var';
|
||||||
import { useLocale } from '../../hooks/useLocale';
|
import { useLocale } from '../../hooks/useLocale';
|
||||||
|
import { RewardBadge } from '../RewardBadge';
|
||||||
import { GRADE_COLORS } from './Colors';
|
import { GRADE_COLORS } from './Colors';
|
||||||
import type { AvatarGroupProps } from './Group';
|
import type { AvatarGroupProps } from './Group';
|
||||||
|
|
||||||
@@ -79,11 +80,11 @@ export function Popup({ name, avatars }: AvatarGroupProps) {
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
{avatar.sale && (
|
{avatar.sale && (
|
||||||
<Badge>
|
<RewardBadge
|
||||||
{JSON.stringify(
|
reward={avatar.sale}
|
||||||
avatar.sale.reward_list[0].currency_reward?.amount,
|
color="gray"
|
||||||
)}
|
variant="surface"
|
||||||
</Badge>
|
/>
|
||||||
)}
|
)}
|
||||||
</Flex>
|
</Flex>
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
import type { StandardReward } from '@protos/blitz_static_standard_reward';
|
||||||
|
import { Badge, type BadgeProps } from '@radix-ui/themes';
|
||||||
|
import { useLocale } from '../hooks/useLocale';
|
||||||
|
|
||||||
|
interface RewardBadgeProps {
|
||||||
|
reward: StandardReward;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function RewardBadge({
|
||||||
|
reward,
|
||||||
|
...props
|
||||||
|
}: RewardBadgeProps & BadgeProps) {
|
||||||
|
const { locale } = useLocale();
|
||||||
|
|
||||||
|
if (reward.reward_list.length !== 1) {
|
||||||
|
throw new Error('reward_list must be length 1');
|
||||||
|
}
|
||||||
|
|
||||||
|
const reward0 = reward.reward_list[0];
|
||||||
|
|
||||||
|
Object.entries(reward0).forEach(([key, value]) => {
|
||||||
|
if (key !== 'currency_reward' && value !== undefined) {
|
||||||
|
throw new Error(`unsupported reward type: ${key}`);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Badge {...props}>
|
||||||
|
{reward0.currency_reward && (
|
||||||
|
<>
|
||||||
|
<img
|
||||||
|
src={`/api/currencies/${reward0.currency_reward.currency_catalog_id.replace(
|
||||||
|
'CurrencyEntity.',
|
||||||
|
'',
|
||||||
|
)}.webp`}
|
||||||
|
/>
|
||||||
|
{reward0.currency_reward.amount.toLocaleString(locale)}
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</Badge>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
import { StuffUIComponent } from '@protos/blitz_static_stuff_ui_component';
|
||||||
|
import type { APIRoute, GetStaticPaths } from 'astro';
|
||||||
|
import { api } from 'packages/website-ue/src/core/blitzkit/api';
|
||||||
|
|
||||||
|
export const getStaticPaths: GetStaticPaths = () => {
|
||||||
|
return api.metadata
|
||||||
|
.filter((item) => item.startsWith('CurrencyEntity.'))
|
||||||
|
.map((item) => ({
|
||||||
|
params: { currency: item.undiscriminatedId() },
|
||||||
|
props: { ui: item.get(StuffUIComponent, 'UIComponent') },
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
|
||||||
|
export const GET: APIRoute<{ ui: StuffUIComponent }> = async ({ props }) => {
|
||||||
|
console.log(props.ui.icon);
|
||||||
|
|
||||||
|
const response = await fetch(props.ui.icon);
|
||||||
|
const buffer = await response.arrayBuffer();
|
||||||
|
|
||||||
|
return new Response(buffer, { headers: response.headers });
|
||||||
|
};
|
||||||
Submodule submodules/blitzkit-closed updated: cba6a7bfab...ef77594716.
Submodule
+1
Submodule submodules/blitzkit-internal added at 14adb2e456.
Reference in new issue
Block a user