mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 11:39:50 +02:00
Feat: dev name
This commit is contained in:
1 parent
191843f972
commit
e6fcfdb514
5 files changed
+94
-4
No files matched your search
@@ -6,11 +6,13 @@ import {
|
||||
IconButton,
|
||||
Text,
|
||||
TextField,
|
||||
Tooltip,
|
||||
} from "@radix-ui/themes";
|
||||
import { Html } from "@react-three/drei";
|
||||
import { useRef } from "react";
|
||||
import { useRef, useState } from "react";
|
||||
import { radToDeg } from "three/src/math/MathUtils.js";
|
||||
import { resolveArmorIndex } from "../../../core/blitzkit/resolveArmorIndex";
|
||||
import { useLocale } from "../../../hooks/useLocale";
|
||||
import { App } from "../../../stores/app";
|
||||
import { Duel } from "../../../stores/duel";
|
||||
import { Tankopedia } from "../../../stores/tankopedia";
|
||||
@@ -21,6 +23,8 @@ export function ArmorPlateDisplay() {
|
||||
const highlightArmor = Tankopedia.use((state) => state.highlightArmor);
|
||||
const developerMode = App.useDeferred((state) => state.developerMode, false);
|
||||
const input = useRef<HTMLInputElement>(null);
|
||||
const { strings } = useLocale();
|
||||
const [copied, setCopied] = useState(false);
|
||||
|
||||
if (highlightArmor === undefined) return null;
|
||||
|
||||
@@ -60,7 +64,25 @@ export function ArmorPlateDisplay() {
|
||||
{developerMode && (
|
||||
<>
|
||||
<Text mt="2" color="gray" size="2">
|
||||
<b>DEV:</b> <Code>{highlightArmor.name}</Code>
|
||||
<b>DEV:</b>{" "}
|
||||
<Tooltip
|
||||
open={copied}
|
||||
content={strings.website.common.copy_button.copied}
|
||||
>
|
||||
<Code
|
||||
variant="soft"
|
||||
highContrast
|
||||
color="gray"
|
||||
style={{ cursor: "copy" }}
|
||||
onClick={() => {
|
||||
navigator.clipboard.writeText(highlightArmor.name);
|
||||
setCopied(true);
|
||||
}}
|
||||
onPointerLeave={() => setCopied(false)}
|
||||
>
|
||||
{highlightArmor.name}
|
||||
</Code>
|
||||
</Tooltip>
|
||||
</Text>
|
||||
</>
|
||||
)}
|
||||
|
||||
@@ -4,7 +4,8 @@ import {
|
||||
TankType,
|
||||
TIER_ROMAN_NUMERALS,
|
||||
} from '@blitzkit/core';
|
||||
import { Box, Code, Flex } from '@radix-ui/themes';
|
||||
import { Box, Code, Flex, Tooltip } from '@radix-ui/themes';
|
||||
import { useState } from 'react';
|
||||
import { Var } from '../../../core/radix/var';
|
||||
import { useLocale } from '../../../hooks/useLocale';
|
||||
import { App } from '../../../stores/app';
|
||||
@@ -23,6 +24,7 @@ export function MetaSection() {
|
||||
const protagonist = Duel.use((state) => state.protagonist.tank);
|
||||
const ClassIcon = classIcons[protagonist.class];
|
||||
const { locale, strings } = useLocale();
|
||||
const [copied, setCopied] = useState<null | 'id' | 'name'>(null);
|
||||
|
||||
return (
|
||||
<Flex justify="center" mt="-9">
|
||||
@@ -101,7 +103,53 @@ export function MetaSection() {
|
||||
<Listing
|
||||
label={strings.website.tools.tankopedia.meta.dev_id}
|
||||
>
|
||||
<Code>{protagonist.id}</Code>
|
||||
<Tooltip
|
||||
open={copied === 'id'}
|
||||
content={strings.website.common.copy_button.copied}
|
||||
>
|
||||
<Code
|
||||
variant="soft"
|
||||
highContrast
|
||||
color="gray"
|
||||
style={{ cursor: 'copy' }}
|
||||
onClick={() => {
|
||||
navigator.clipboard.writeText(`${protagonist.id}`);
|
||||
setCopied('id');
|
||||
}}
|
||||
onPointerLeave={() => {
|
||||
if (copied === 'id') setCopied(null);
|
||||
}}
|
||||
>
|
||||
{protagonist.id}
|
||||
</Code>
|
||||
</Tooltip>
|
||||
</Listing>
|
||||
)}
|
||||
{developerMode && (
|
||||
<Listing
|
||||
label={strings.website.tools.tankopedia.meta.dev_name}
|
||||
>
|
||||
<Tooltip
|
||||
open={copied === 'name'}
|
||||
content={strings.website.common.copy_button.copied}
|
||||
>
|
||||
<Code
|
||||
variant="soft"
|
||||
highContrast
|
||||
color="gray"
|
||||
style={{ cursor: 'copy' }}
|
||||
onClick={() => {
|
||||
if (!protagonist.dev_name) return;
|
||||
navigator.clipboard.writeText(protagonist.dev_name);
|
||||
setCopied('name');
|
||||
}}
|
||||
onPointerLeave={() => {
|
||||
if (copied === 'name') setCopied(null);
|
||||
}}
|
||||
>
|
||||
{protagonist.dev_name ?? '-'}
|
||||
</Code>
|
||||
</Tooltip>
|
||||
</Listing>
|
||||
)}
|
||||
{protagonist.type === TankType.PREMIUM && (
|
||||
|
||||
Reference in new issue
Block a user