mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 20:19:49 +02:00
feat: new layout
This commit is contained in:
1 parent
281549add3
commit
9f2ced6bfd
5 files changed
+37
-39
No files matched your search
@@ -5,7 +5,7 @@ import { theme } from '../../../../../../../stitches.config';
|
|||||||
interface InfoProps {
|
interface InfoProps {
|
||||||
name: string;
|
name: string;
|
||||||
children: ReactNode;
|
children: ReactNode;
|
||||||
unit: string;
|
unit?: string;
|
||||||
indent?: boolean;
|
indent?: boolean;
|
||||||
highlight?: boolean;
|
highlight?: boolean;
|
||||||
}
|
}
|
||||||
@@ -24,10 +24,15 @@ export function Info({
|
|||||||
gap="4"
|
gap="4"
|
||||||
>
|
>
|
||||||
<Text color={highlight ? 'amber' : undefined}>
|
<Text color={highlight ? 'amber' : undefined}>
|
||||||
{name}{' '}
|
{name}
|
||||||
|
{unit != undefined && (
|
||||||
|
<>
|
||||||
|
{' '}
|
||||||
<Text color="gray" size="1">
|
<Text color="gray" size="1">
|
||||||
{unit}
|
{unit}
|
||||||
</Text>
|
</Text>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</Text>
|
</Text>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
|
|||||||
@@ -1,18 +1,15 @@
|
|||||||
import { Flex, Heading, Tabs } from '@radix-ui/themes';
|
import { Flex, Heading } from '@radix-ui/themes';
|
||||||
import { use } from 'react';
|
import { use } from 'react';
|
||||||
import { resolveNearPenetration } from '../../../../../../core/blitz/resolveNearPenetration';
|
import { resolveNearPenetration } from '../../../../../../core/blitz/resolveNearPenetration';
|
||||||
import { modelDefinitions } from '../../../../../../core/blitzkrieg/modelDefinitions';
|
import { modelDefinitions } from '../../../../../../core/blitzkrieg/modelDefinitions';
|
||||||
import { normalizeBoundingBox } from '../../../../../../core/blitzkrieg/normalizeBoundingBox';
|
import { normalizeBoundingBox } from '../../../../../../core/blitzkrieg/normalizeBoundingBox';
|
||||||
import { SHELL_NAMES } from '../../../../../../core/blitzkrieg/tankDefinitions';
|
import {
|
||||||
|
GUN_TYPE_NAMES,
|
||||||
|
SHELL_NAMES,
|
||||||
|
} from '../../../../../../core/blitzkrieg/tankDefinitions';
|
||||||
import { unionBoundingBox } from '../../../../../../core/blitzkrieg/unionBoundingBox';
|
import { unionBoundingBox } from '../../../../../../core/blitzkrieg/unionBoundingBox';
|
||||||
import { useDuel } from '../../../../../../stores/duel';
|
import { useDuel } from '../../../../../../stores/duel';
|
||||||
import { Camouflage } from './components/Camouflage';
|
|
||||||
import { Consumables } from './components/Consumables';
|
|
||||||
import { Crew } from './components/Crew';
|
|
||||||
import { Equipments } from './components/Equipments';
|
|
||||||
import { Info } from './components/Info';
|
import { Info } from './components/Info';
|
||||||
import { Modules } from './components/Modules';
|
|
||||||
import { Provisions } from './components/Provisions';
|
|
||||||
|
|
||||||
export function Characteristics() {
|
export function Characteristics() {
|
||||||
const awaitedModelDefinitions = use(modelDefinitions);
|
const awaitedModelDefinitions = use(modelDefinitions);
|
||||||
@@ -47,14 +44,6 @@ export function Characteristics() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Tabs.Root defaultValue="configure" style={{ width: '100%' }}>
|
|
||||||
<Flex gap="4" direction="column">
|
|
||||||
<Tabs.List>
|
|
||||||
<Tabs.Trigger value="configure">Configure</Tabs.Trigger>
|
|
||||||
<Tabs.Trigger value="statistics">Statistics</Tabs.Trigger>
|
|
||||||
</Tabs.List>
|
|
||||||
|
|
||||||
<Tabs.Content value="statistics">
|
|
||||||
<Flex direction="column" gap="4">
|
<Flex direction="column" gap="4">
|
||||||
<Flex direction="column" gap="2">
|
<Flex direction="column" gap="2">
|
||||||
<Heading size="5">Survivability</Heading>
|
<Heading size="5">Survivability</Heading>
|
||||||
@@ -89,6 +78,7 @@ export function Characteristics() {
|
|||||||
|
|
||||||
<Flex direction="column" gap="2">
|
<Flex direction="column" gap="2">
|
||||||
<Heading size="5">Fire</Heading>
|
<Heading size="5">Fire</Heading>
|
||||||
|
<Info name="Gun type">{GUN_TYPE_NAMES[gun.type]}</Info>
|
||||||
<Info name="Damage per minute" unit="hp / min">
|
<Info name="Damage per minute" unit="hp / min">
|
||||||
{dpm.toFixed(0)}
|
{dpm.toFixed(0)}
|
||||||
</Info>
|
</Info>
|
||||||
@@ -106,9 +96,7 @@ export function Characteristics() {
|
|||||||
gun.reload.map((reload, index) => (
|
gun.reload.map((reload, index) => (
|
||||||
<Info
|
<Info
|
||||||
indent={index > 0}
|
indent={index > 0}
|
||||||
name={
|
name={index > 0 ? `Shell ${index + 1}` : 'Reload on shell 1'}
|
||||||
index > 0 ? `Shell ${index + 1}` : 'Reload on shell 1'
|
|
||||||
}
|
|
||||||
unit="s"
|
unit="s"
|
||||||
>
|
>
|
||||||
{reload.toFixed(2)}
|
{reload.toFixed(2)}
|
||||||
@@ -204,8 +192,7 @@ export function Characteristics() {
|
|||||||
)}
|
)}
|
||||||
{turretModelDefinition.yaw && (
|
{turretModelDefinition.yaw && (
|
||||||
<Info indent name="Azimuth" unit="°">
|
<Info indent name="Azimuth" unit="°">
|
||||||
{-turretModelDefinition.yaw.min},{' '}
|
{-turretModelDefinition.yaw.min}, {turretModelDefinition.yaw.max}
|
||||||
{turretModelDefinition.yaw.max}
|
|
||||||
</Info>
|
</Info>
|
||||||
)}
|
)}
|
||||||
</Flex>
|
</Flex>
|
||||||
@@ -244,19 +231,5 @@ export function Characteristics() {
|
|||||||
</Info>
|
</Info>
|
||||||
</Flex>
|
</Flex>
|
||||||
</Flex>
|
</Flex>
|
||||||
</Tabs.Content>
|
|
||||||
|
|
||||||
<Tabs.Content value="configure">
|
|
||||||
<Flex direction="column" gap="4">
|
|
||||||
<Modules />
|
|
||||||
<Equipments />
|
|
||||||
<Crew />
|
|
||||||
<Consumables />
|
|
||||||
<Provisions />
|
|
||||||
<Camouflage />
|
|
||||||
</Flex>
|
|
||||||
</Tabs.Content>
|
|
||||||
</Flex>
|
|
||||||
</Tabs.Root>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -8,6 +8,12 @@ import { mutateDuel, useDuel } from '../../../../stores/duel';
|
|||||||
import { mutateTankopediaTemporary } from '../../../../stores/tankopedia';
|
import { mutateTankopediaTemporary } from '../../../../stores/tankopedia';
|
||||||
import { AntagonistBar } from './components/AntagonistBar';
|
import { AntagonistBar } from './components/AntagonistBar';
|
||||||
import { Characteristics } from './components/Characteristics';
|
import { Characteristics } from './components/Characteristics';
|
||||||
|
import { Camouflage } from './components/Characteristics/components/Camouflage';
|
||||||
|
import { Consumables } from './components/Characteristics/components/Consumables';
|
||||||
|
import { Crew } from './components/Characteristics/components/Crew';
|
||||||
|
import { Equipments } from './components/Characteristics/components/Equipments';
|
||||||
|
import { Modules } from './components/Characteristics/components/Modules';
|
||||||
|
import { Provisions } from './components/Characteristics/components/Provisions';
|
||||||
import { TankSandbox } from './components/Model/TankSandbox';
|
import { TankSandbox } from './components/Model/TankSandbox';
|
||||||
import { Title } from './components/Title';
|
import { Title } from './components/Title';
|
||||||
|
|
||||||
@@ -92,13 +98,21 @@ export default function Page({ params }: { params: { id: string } }) {
|
|||||||
direction="column"
|
direction="column"
|
||||||
style={{
|
style={{
|
||||||
flex: 1,
|
flex: 1,
|
||||||
position: wideFormat ? 'sticky' : undefined,
|
|
||||||
width: '100%',
|
width: '100%',
|
||||||
top: 64,
|
top: 64,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<TankSandbox />
|
<TankSandbox />
|
||||||
<AntagonistBar />
|
<AntagonistBar />
|
||||||
|
|
||||||
|
<Flex direction="column" gap="4">
|
||||||
|
<Modules />
|
||||||
|
<Equipments />
|
||||||
|
<Crew />
|
||||||
|
<Consumables />
|
||||||
|
<Provisions />
|
||||||
|
<Camouflage />
|
||||||
|
</Flex>
|
||||||
</Flex>
|
</Flex>
|
||||||
|
|
||||||
<Flex style={{ width: wideFormat ? 320 : '100%' }}>
|
<Flex style={{ width: wideFormat ? 320 : '100%' }}>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ export class EventManager<Type> {
|
|||||||
this.callbacks.add(callback);
|
this.callbacks.add(callback);
|
||||||
}
|
}
|
||||||
off(callback: (data: Type) => void) {
|
off(callback: (data: Type) => void) {
|
||||||
this.callbacks.delete(callback);
|
return this.callbacks.delete(callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
emit(data: Type) {
|
emit(data: Type) {
|
||||||
|
|||||||
@@ -91,6 +91,12 @@ export type ShellDefinition = {
|
|||||||
explosionRadius?: number;
|
explosionRadius?: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const GUN_TYPE_NAMES: Record<GunDefinition['type'], string> = {
|
||||||
|
regular: 'Regular',
|
||||||
|
auto_loader: 'Auto loader',
|
||||||
|
auto_reloader: 'Auto reloader',
|
||||||
|
};
|
||||||
|
|
||||||
export const tankDefinitions = fetch(asset('definitions/tanks.json'), {
|
export const tankDefinitions = fetch(asset('definitions/tanks.json'), {
|
||||||
cache: 'no-cache',
|
cache: 'no-cache',
|
||||||
}).then(async (response) => response.json() as Promise<TankDefinitions>);
|
}).then(async (response) => response.json() as Promise<TankDefinitions>);
|
||||||
|
|||||||
Reference in new issue
Block a user