mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-06-02 22:26:57 -05:00
Extract WeaponImageSelector component
This commit is contained in:
parent
f81451b0c0
commit
df7a48fd6f
|
|
@ -31,7 +31,7 @@ const BLUEPRINTS_AVAILABLE: Partial<Record<ModeShort, Array<StageId>>> = {
|
|||
};
|
||||
|
||||
export default function Planner() {
|
||||
const { t } = useTranslation(["common", "weapons"]);
|
||||
const { t } = useTranslation(["common"]);
|
||||
const { i18n } = useTranslation();
|
||||
const appRef = React.useRef<TldrawApp>();
|
||||
const app = appRef.current!;
|
||||
|
|
@ -126,25 +126,7 @@ export default function Planner() {
|
|||
return (
|
||||
<>
|
||||
<StageBackgroundSelector onAddBackground={handleAddBackgroundImage} />
|
||||
<div className="plans__weapons-section">
|
||||
{mainWeaponIds.map((weaponId) => {
|
||||
return (
|
||||
<Button
|
||||
key={weaponId}
|
||||
variant="minimal"
|
||||
onClick={() => handleAddWeapon(weaponId)}
|
||||
>
|
||||
<Image
|
||||
alt={t(`weapons:MAIN_${weaponId}`)}
|
||||
title={t(`weapons:MAIN_${weaponId}`)}
|
||||
path={mainWeaponImageUrl(weaponId)}
|
||||
width={36}
|
||||
height={36}
|
||||
/>
|
||||
</Button>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
<WeaponImageSelector handleAddWeapon={handleAddWeapon} />
|
||||
<div className="plans__powered-by">
|
||||
<a href={TLDRAW_URL} target="_blank" rel="noreferrer">
|
||||
{t("common:plans.poweredBy", { name: "tldraw" })}
|
||||
|
|
@ -155,6 +137,35 @@ export default function Planner() {
|
|||
);
|
||||
}
|
||||
|
||||
function WeaponImageSelector({
|
||||
handleAddWeapon,
|
||||
}: {
|
||||
handleAddWeapon: (weaponId: MainWeaponId) => void;
|
||||
}) {
|
||||
const { t } = useTranslation(["weapons"]);
|
||||
return (
|
||||
<div className="plans__weapons-section">
|
||||
{mainWeaponIds.map((weaponId) => {
|
||||
return (
|
||||
<Button
|
||||
key={weaponId}
|
||||
variant="minimal"
|
||||
onClick={() => handleAddWeapon(weaponId)}
|
||||
>
|
||||
<Image
|
||||
alt={t(`weapons:MAIN_${weaponId}`)}
|
||||
title={t(`weapons:MAIN_${weaponId}`)}
|
||||
path={mainWeaponImageUrl(weaponId)}
|
||||
width={36}
|
||||
height={36}
|
||||
/>
|
||||
</Button>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function StageBackgroundSelector({
|
||||
onAddBackground,
|
||||
}: {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user