feat: Update TurtleCard to display turtle label instead of ID
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import React from 'react';
|
import React, { useState, useCallback } from 'react';
|
||||||
import { useTurtleStore } from '../store/turtleStore';
|
import { useTurtleStore } from '../store/turtleStore';
|
||||||
import './ControlPanel.css';
|
import './ControlPanel.css';
|
||||||
|
|
||||||
@@ -6,6 +6,7 @@ function TurtleCard({ turtle, isSelected, onSelect }) {
|
|||||||
const activeState = turtle.state || turtle.mode || 'idle';
|
const activeState = turtle.state || turtle.mode || 'idle';
|
||||||
const fuel = turtle.fuel === 'unlimited' ? '∞' : (turtle.fuel || '?');
|
const fuel = turtle.fuel === 'unlimited' ? '∞' : (turtle.fuel || '?');
|
||||||
const inventoryCount = turtle.inventory?.length || 0;
|
const inventoryCount = turtle.inventory?.length || 0;
|
||||||
|
const displayName = turtle.label || `Turtle ${turtle.turtleID}`;
|
||||||
|
|
||||||
const modeColors = {
|
const modeColors = {
|
||||||
mining: '#4ade80',
|
mining: '#4ade80',
|
||||||
@@ -33,7 +34,7 @@ function TurtleCard({ turtle, isSelected, onSelect }) {
|
|||||||
style={{ borderColor: modeColors[activeState] || modeColors.unknown }}
|
style={{ borderColor: modeColors[activeState] || modeColors.unknown }}
|
||||||
>
|
>
|
||||||
<div className="turtle-header">
|
<div className="turtle-header">
|
||||||
<h3>Turtle {turtle.turtleID}</h3>
|
<h3>{displayName}</h3>
|
||||||
<span className="mode-badge" style={{ background: modeColors[activeState] || modeColors.unknown }}>
|
<span className="mode-badge" style={{ background: modeColors[activeState] || modeColors.unknown }}>
|
||||||
{activeState}
|
{activeState}
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
Reference in New Issue
Block a user