feat: upgrade tankopediaEphemeral

This commit is contained in:
TrèsAbhi committed 2025-09-01 18:51:04 -05:00
1 parent b6c3fdc4e9
commit ac29d1ead0
28 files changed
+165 -168

No files matched your search

@@ -13,7 +13,6 @@ export function CompareOptions(props: FlexProps) {
(state) => state.relativeAgainst,
);
const tank = Duel.use((state) => state.protagonist.tank);
const mutateTankopediaEphemeral = TankopediaEphemeral.useMutation();
const { strings } = useLocale();
return (
@@ -33,7 +32,7 @@ export function CompareOptions(props: FlexProps) {
size="1"
value={`${relativeAgainst}`}
onValueChange={(value) => {
mutateTankopediaEphemeral((draft) => {
TankopediaEphemeral.mutate((draft) => {
draft.relativeAgainst = Number(value) as TankopediaRelativeAgainst;
});
}}
@@ -10,7 +10,6 @@ export function StatSearch(props: FlexProps) {
const { strings } = useLocale();
const [searching, setSearching] = useState(false);
const input = useRef<HTMLInputElement>(null);
const mutateTankopediaEphemeral = TankopediaEphemeral.useMutation();
const count = useRef<HTMLDivElement>(null);
const [index, setIndex] = useState(0);
const search = useCallback(() => {
@@ -34,14 +33,14 @@ export function StatSearch(props: FlexProps) {
count.current.textContent = '';
setSearching(false);
mutateTankopediaEphemeral((draft) => {
TankopediaEphemeral.mutate((draft) => {
draft.statSearch = undefined;
});
return;
}
setSearching(false);
mutateTankopediaEphemeral((draft) => {
TankopediaEphemeral.mutate((draft) => {
draft.statSearch = input.current!.value;
});
}, 500),
@@ -14,7 +14,6 @@ import { ConfigurationChildWrapper } from './ConfigurationChildWrapper';
export function Skills() {
const skillLevels = TankopediaEphemeral.use((state) => state.skills);
const mutateTankopediaTemporary = TankopediaEphemeral.useMutation();
const { strings } = useLocale();
return (
@@ -46,7 +45,7 @@ export function Skills() {
variant="ghost"
color="red"
onClick={() => {
mutateTankopediaTemporary((draft) => {
TankopediaEphemeral.mutate((draft) => {
Object.keys(draft.skills).forEach((skill) => {
draft.skills[skill] = 0;
});
@@ -58,7 +57,7 @@ export function Skills() {
<Button
variant="ghost"
onClick={() => {
mutateTankopediaTemporary((draft) => {
TankopediaEphemeral.mutate((draft) => {
Object.keys(draft.skills).forEach((skill) => {
draft.skills[skill] = 7;
});
@@ -72,7 +71,7 @@ export function Skills() {
<CrewSkillManager
skillLevels={skillLevels}
onChange={(skills) => {
mutateTankopediaTemporary((draft) => {
TankopediaEphemeral.mutate((draft) => {
draft.skills = skills;
});
}}