Skip to content

Commit 5baf33f

Browse files
committed
Clean up robot PR surface
1 parent ee68707 commit 5baf33f

3 files changed

Lines changed: 6 additions & 54 deletions

File tree

packages/editor/src/components/ui/item-catalog/catalog-items.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import type { AssetInput } from '@pascal-app/core'
2-
import { PASCAL_TRUCK_ASSET } from '../../../lib/pascal-truck'
32

43
export const CATALOG_ITEMS: AssetInput[] = [
54
{
@@ -14,7 +13,6 @@ export const CATALOG_ITEMS: AssetInput[] = [
1413
rotation: [0, 0, 0],
1514
dimensions: [2, 1.7, 5],
1615
},
17-
PASCAL_TRUCK_ASSET,
1816
{
1917
id: 'ev-wall-charger',
2018
category: 'appliance',

packages/editor/src/components/ui/panels/navigation-panel.tsx

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,19 @@
22

33
import { emitter } from '@pascal-app/core'
44
import { useViewer } from '@pascal-app/viewer'
5-
import { Bot, Copy, Move, Power, Shield, Trash2, Wrench } from 'lucide-react'
5+
import { Copy, Move, Power, Trash2, Wrench } from 'lucide-react'
66
import { type PointerEvent as ReactPointerEvent, useEffect, useMemo, useRef, useState } from 'react'
77
import { useShallow } from 'zustand/react/shallow'
88
import { cn } from '../../../lib/utils'
99
import useEditor from '../../../store/use-editor'
10-
import type { NavigationQueuedTask, NavigationRobotModel } from '../../../store/use-navigation'
10+
import type { NavigationQueuedTask } from '../../../store/use-navigation'
1111
import useNavigation from '../../../store/use-navigation'
1212
import navigationVisualsStore from '../../../store/use-navigation-visuals'
1313
import { Tooltip, TooltipContent, TooltipTrigger } from '../primitives/tooltip'
1414

1515
const PANEL_BUTTON_CLASS =
1616
'flex h-10 w-10 items-center justify-center rounded-xl border border-border/60 bg-background/70 text-muted-foreground transition-colors hover:border-border hover:bg-background hover:text-foreground disabled:cursor-not-allowed disabled:opacity-45'
1717

18-
const ROBOT_MODEL_LABELS: Record<NavigationRobotModel, string> = {
19-
armored: 'Armored robot',
20-
pascal: 'Pascal robot',
21-
}
22-
2318
type TaskDragState = {
2419
clientX: number
2520
clientY: number
@@ -181,10 +176,8 @@ export function NavigationPanel() {
181176
itemMoveControllers,
182177
moveQueuedTask,
183178
removeQueuedTask,
184-
robotModel,
185179
robotMode,
186180
setActiveTask,
187-
setRobotModel,
188181
setRobotMode,
189182
taskQueue,
190183
} = useNavigation(
@@ -193,10 +186,8 @@ export function NavigationPanel() {
193186
itemMoveControllers: state.itemMoveControllers,
194187
moveQueuedTask: state.moveQueuedTask,
195188
removeQueuedTask: state.removeQueuedTask,
196-
robotModel: state.robotModel,
197189
robotMode: state.robotMode,
198190
setActiveTask: state.setActiveTask,
199-
setRobotModel: state.setRobotModel,
200191
setRobotMode: state.setRobotMode,
201192
taskQueue: state.taskQueue,
202193
})),
@@ -384,9 +375,6 @@ export function NavigationPanel() {
384375

385376
const robotTooltip =
386377
robotMode === 'normal' ? 'Turn robot off (manual mode).' : 'Turn robot off (task mode).'
387-
const nextRobotModel = robotModel === 'pascal' ? 'armored' : 'pascal'
388-
const RobotModelIcon = robotModel === 'pascal' ? Bot : Shield
389-
const modelTooltip = `${ROBOT_MODEL_LABELS[robotModel]}. Switch to ${ROBOT_MODEL_LABELS[nextRobotModel]}.`
390378

391379
return (
392380
<div data-testid="navigation-panel" ref={rootRef}>
@@ -410,24 +398,6 @@ export function NavigationPanel() {
410398
</TooltipTrigger>
411399
<TooltipContent side="left">{robotTooltip}</TooltipContent>
412400
</Tooltip>
413-
<Tooltip>
414-
<TooltipTrigger asChild>
415-
<button
416-
aria-label={`Switch to ${ROBOT_MODEL_LABELS[nextRobotModel]}`}
417-
className={cn(
418-
PANEL_BUTTON_CLASS,
419-
robotModel === 'armored' &&
420-
'border-cyan-300/50 bg-cyan-500/15 text-cyan-100 hover:border-cyan-200 hover:bg-cyan-500/20 hover:text-white',
421-
)}
422-
data-testid="navigation-robot-model-toggle"
423-
onClick={() => setRobotModel(nextRobotModel)}
424-
type="button"
425-
>
426-
<RobotModelIcon className="h-4 w-4" />
427-
</button>
428-
</TooltipTrigger>
429-
<TooltipContent side="left">{modelTooltip}</TooltipContent>
430-
</Tooltip>
431401
</div>
432402
</div>
433403

packages/editor/src/lib/pascal-truck.ts

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import type { SceneGraph } from './scene'
44

55
export const PASCAL_TRUCK_ASSET_ID = 'pascal-truck'
66
export const PASCAL_TRUCK_ITEM_NODE_ID = 'item_pascal_truck_seed'
7-
export const PASCAL_TRUCK_DEFAULT_LEVEL_ID = 'level_9zq0a3e17uf8an2u'
87

98
export const PASCAL_TRUCK_ASSET: AssetInput = {
109
id: PASCAL_TRUCK_ASSET_ID,
@@ -19,8 +18,8 @@ export const PASCAL_TRUCK_ASSET: AssetInput = {
1918
dimensions: [4.42, 2.5, 2.28],
2019
}
2120

22-
export const PASCAL_TRUCK_SCENE_POSITION: [number, number, number] = [7.25, 0, -11.25]
23-
export const PASCAL_TRUCK_SCENE_ROTATION: [number, number, number] = [0, Math.PI / 2, 0]
21+
export const PASCAL_TRUCK_SCENE_POSITION: [number, number, number] = [0, 0, 0]
22+
export const PASCAL_TRUCK_SCENE_ROTATION: [number, number, number] = [0, 0, 0]
2423
export const PASCAL_TRUCK_SCENE_SCALE: [number, number, number] = [1, 1, 1]
2524

2625
export const PASCAL_TRUCK_ENTRY_CLIP_NAME = 'Jumping_Down'
@@ -82,16 +81,7 @@ function isRecord(value: unknown): value is Record<string, unknown> {
8281

8382
function shouldPreservePascalTruckPlacement(sourceTruckNode?: ItemNode | null) {
8483
const metadata = isRecord(sourceTruckNode?.metadata) ? sourceTruckNode.metadata : null
85-
if (metadata?.manualPlacement !== true) {
86-
return false
87-
}
88-
89-
const seededBy = typeof metadata.seededBy === 'string' ? metadata.seededBy : null
90-
if (seededBy === 'apps/editor/app/page.tsx') {
91-
return false
92-
}
93-
94-
return true
84+
return metadata?.manualPlacement === true
9585
}
9686

9787
function getScaledItemDimensions(node: Record<string, unknown>): [number, number, number] | null {
@@ -498,11 +488,6 @@ function resolvePascalTruckLevelId(
498488
return preferredLevelId
499489
}
500490

501-
const preferredLevel = sceneGraph.nodes[PASCAL_TRUCK_DEFAULT_LEVEL_ID]
502-
if (isRecord(preferredLevel) && preferredLevel.type === 'level') {
503-
return PASCAL_TRUCK_DEFAULT_LEVEL_ID
504-
}
505-
506491
let fallbackLevelId: string | null = null
507492
for (const node of Object.values(sceneGraph.nodes)) {
508493
if (!isRecord(node) || node.type !== 'level' || typeof node.id !== 'string') {
@@ -605,11 +590,10 @@ export function buildPascalTruckNodeForScene(
605590
id: PASCAL_TRUCK_ITEM_NODE_ID,
606591
metadata: {
607592
manualPlacement: false,
608-
seededBy: 'packages/editor/src/components/editor/index.tsx',
609593
},
610594
name: PASCAL_TRUCK_ASSET.name,
611595
object: 'node',
612-
parentId: parentId ?? PASCAL_TRUCK_DEFAULT_LEVEL_ID,
596+
parentId,
613597
position: seededTransform.position,
614598
rotation: seededTransform.rotation,
615599
scale: seededTransform.scale,

0 commit comments

Comments
 (0)