Update StorageActionProps to make max optional; adjust MaterialAnimator padding for improved layout consistency.

This commit is contained in:
Vishnu 2025-05-10 19:05:06 +05:30
parent 5369a97105
commit d30668e723
4 changed files with 5 additions and 6 deletions

View File

@ -6,7 +6,7 @@ interface StorageActionProps {
type: "store" | "spawn" | "default"; type: "store" | "spawn" | "default";
value: string; value: string;
min: number; min: number;
max: number; max?: number;
defaultValue: string; defaultValue: string;
currentMaterialType: string; currentMaterialType: string;
handleCapacityChange: (value: string) => void; handleCapacityChange: (value: string) => void;

View File

@ -244,7 +244,6 @@ function StorageMechanics() {
value={currentCapacity} value={currentCapacity}
defaultValue="0" defaultValue="0"
min={0} min={0}
max={20}
currentMaterialType={currentMaterialType} currentMaterialType={currentMaterialType}
handleCapacityChange={handleCapacityChange} handleCapacityChange={handleCapacityChange}
handleMaterialTypeChange={handleMaterialTypeChange} handleMaterialTypeChange={handleMaterialTypeChange}

View File

@ -1,5 +1,5 @@
import { useFrame } from '@react-three/fiber'; import { useFrame } from '@react-three/fiber';
import React, { useEffect, useRef, useState } from 'react'; import { useEffect, useRef, useState } from 'react';
import * as THREE from 'three'; import * as THREE from 'three';
import { MaterialModel } from '../../../materials/instances/material/materialModel'; import { MaterialModel } from '../../../materials/instances/material/materialModel';
@ -9,7 +9,7 @@ type MaterialAnimatorProps = {
currentPhase: string; currentPhase: string;
}; };
export default function MaterialAnimator({ ikSolver, armBot, currentPhase }: MaterialAnimatorProps) { export default function MaterialAnimator({ ikSolver, armBot, currentPhase }: Readonly<MaterialAnimatorProps>) {
const sphereRef = useRef<any>(null); const sphereRef = useRef<any>(null);
const [isRendered, setIsRendered] = useState<boolean>(false); const [isRendered, setIsRendered] = useState<boolean>(false);
@ -58,7 +58,7 @@ export default function MaterialAnimator({ ikSolver, armBot, currentPhase }: Mat
{isRendered && ( {isRendered && (
<MaterialModel <MaterialModel
matRef={sphereRef} matRef={sphereRef}
materialType={armBot.currentAction?.materialType || 'Default material'} materialType={armBot.currentAction?.materialType ?? 'Default material'}
/> />
)} )}
</> </>

View File

@ -9,7 +9,7 @@ const MaterialAnimator = ({
const meshRef = useRef<any>(null!); const meshRef = useRef<any>(null!);
const [hasLoad, setHasLoad] = useState(false); const [hasLoad, setHasLoad] = useState(false);
const { scene } = useThree(); const { scene } = useThree();
const padding = 0; const padding = 0.1;
useEffect(() => { useEffect(() => {
setHasLoad(storage.currentLoad > 0); setHasLoad(storage.currentLoad > 0);