@umituz/web-virtual 1.1.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +97 -8
- package/package.json +1 -1
- package/src/components/DigitalHQView.tsx +91 -52
- package/src/components/EntityInspector.tsx +8 -8
- package/src/components/VirtualCommandBar.tsx +10 -10
- package/src/components/VirtualEntityDrawer.tsx +15 -15
- package/src/components/VirtualReportModal.tsx +7 -6
- package/src/components/VirtualRoster.tsx +12 -11
- package/src/components/VirtualWorld.tsx +170 -35
- package/src/components/WorldControls.tsx +12 -12
- package/src/core/environment.test.ts +100 -16
- package/src/core/environment.ts +93 -7
- package/src/core/types.ts +53 -2
- package/src/engine/renderer.ts +58 -2
- package/src/entities/people/AvatarBuilder.test.ts +75 -0
- package/src/entities/people/AvatarBuilder.ts +23 -3
- package/src/presets/factoryPreset.ts +13 -44
- package/src/presets/farmPreset.ts +13 -44
- package/src/presets/hospitalPreset.ts +12 -33
- package/src/presets/officePreset.ts +65 -356
- package/src/presets/schoolPreset.ts +12 -33
- package/src/styles/virtual.css +215 -0
package/README.md
CHANGED
|
@@ -4,22 +4,41 @@ Universal 3D Virtual Environment Engine for Web and React.
|
|
|
4
4
|
|
|
5
5
|
Build realistic, high-performance, interactive 3D virtual offices, farms, industrial factories, schools, and hospitals with locked 60fps rendering, raycasting, and contextual inspectors.
|
|
6
6
|
|
|
7
|
+
All UI strings are **English** so the package drops into any product without locale friction. Consumer-supplied data (entity names, missions, roles) is rendered verbatim.
|
|
8
|
+
|
|
9
|
+
## Architecture vs. data
|
|
10
|
+
|
|
11
|
+
The package ships **architecture only** — buildings, rooms (zones), lighting, and anchor **slots** (where someone *can* sit). All occupant and org data is **yours**, passed in as props:
|
|
12
|
+
|
|
13
|
+
| Package provides | Consumer provides |
|
|
14
|
+
|---|---|
|
|
15
|
+
| 3D engine, camera, raycasting, labels/pins | `entities` — who/what occupies the world |
|
|
16
|
+
| Presets: floorplan geometry, furniture, zones | `departments` — org grouping (else derived from zones) |
|
|
17
|
+
| Anchor `slots` (position, zone, pin number) | `zones` override — localized zone labels |
|
|
18
|
+
| Digital HQ chrome (roster, ops, command center) | Missions, projects, activities, metrics |
|
|
19
|
+
|
|
20
|
+
Entities without an explicit `position` are auto-placed onto preset slots — by `slotId`, by matching `id`, or the next free slot — inheriting position, rotation, zone and pin number from the architecture. You only ever describe **who**, never **where**.
|
|
21
|
+
|
|
7
22
|
---
|
|
8
23
|
|
|
9
24
|
## Features
|
|
10
25
|
|
|
11
26
|
- **Universal Engine**: Agnostic to domain (Corporate Offices, Agriculture, Automation Factories, Campus, Healthcare).
|
|
27
|
+
- **Hot-Synced Entities (1.2.0)**: When the `world` prop changes (e.g. a status poll), entities are diffed and updated **in place** — the scene, camera position, lights and cached GLB models are never rebuilt. No flicker, no reloads, no lost camera angle.
|
|
28
|
+
- **WebGL Resilience (1.2.0)**: Graceful fallback UI when WebGL is unavailable, and a one-click restore overlay if the GPU context is lost mid-session.
|
|
29
|
+
- **Battery Friendly (1.2.0)**: The render loop pauses automatically while the tab is hidden.
|
|
12
30
|
- **Locked 60 FPS Performance**: Direct GPU CSS `translate3d` projection for floating labels and pins without React state re-rendering overhead during orbit/zoom.
|
|
13
31
|
- **Interactive Entities & Raycasting**: Click and hover directly on 3D desks, monitors, robots, or avatars.
|
|
14
|
-
- **Architectural Presets
|
|
15
|
-
- `officePreset`: 17-desk architectural floorplan with executive suite, meeting room, and glass partitions.
|
|
16
|
-
- `farmPreset`: Greenhouses, crops, barns, tractors.
|
|
17
|
-
- `factoryPreset`: Conveyor belts, robotic arms, storage racks.
|
|
18
|
-
- `schoolPreset`: Lecture halls, interactive smartboards, science labs.
|
|
19
|
-
- `hospitalPreset`: Triage rooms, consultation suites, patient monitoring.
|
|
20
|
-
- **
|
|
32
|
+
- **Architectural Presets** (occupant-free — slots only):
|
|
33
|
+
- `officePreset`: 17-desk architectural floorplan with executive suite, meeting room, and glass partitions (`OFFICE_SLOTS`).
|
|
34
|
+
- `farmPreset`: Greenhouses, crops, barns, tractors (`FARM_SLOTS`).
|
|
35
|
+
- `factoryPreset`: Conveyor belts, robotic arms, storage racks (`FACTORY_SLOTS`).
|
|
36
|
+
- `schoolPreset`: Lecture halls, interactive smartboards, science labs (`SCHOOL_SLOTS`).
|
|
37
|
+
- `hospitalPreset`: Triage rooms, consultation suites, patient monitoring (`HOSPITAL_SLOTS`).
|
|
38
|
+
- **DigitalHQView**: A complete, embeddable "digital headquarters" screen — 3D office floor, operations dashboard, and an AI command center wired through a single `onDispatchMission` callback. Departments default to a neutral zone-based grouping when the consumer passes none.
|
|
39
|
+
- **Contextual Inspector & Profile Drawer**: Role, status, metrics, latest task, and custom application actions.
|
|
21
40
|
- **Day & Night Simulation**: One-click smooth lighting transitions.
|
|
22
|
-
- **Pin & Label Modes**: Minimal
|
|
41
|
+
- **Pin & Label Modes**: Minimal circular pins (`#1`..`#17`) with status indicators, expandable chips, or hidden mode.
|
|
23
42
|
|
|
24
43
|
---
|
|
25
44
|
|
|
@@ -57,6 +76,76 @@ export function MyOfficePage() {
|
|
|
57
76
|
}
|
|
58
77
|
```
|
|
59
78
|
|
|
79
|
+
### Live status updates (hot-sync)
|
|
80
|
+
|
|
81
|
+
Poll or stream your data and pass a fresh `world` object — the engine diffs entities and updates status rings, animations and transforms in place. Poll every few seconds without penalty:
|
|
82
|
+
|
|
83
|
+
```tsx
|
|
84
|
+
const world = useMemo(
|
|
85
|
+
() => createEnvironment({ preset: officePreset, name: 'HQ', entities: liveEntities }),
|
|
86
|
+
[liveEntities],
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
return <VirtualWorld world={world} preset={officePreset} />
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Your occupants, your language (any preset)
|
|
93
|
+
|
|
94
|
+
Occupants carry no positions — they are auto-placed onto the preset's slots. Pin someone to a specific desk with `slotId`, or let them fill slots in order. Same API for every preset:
|
|
95
|
+
|
|
96
|
+
```tsx
|
|
97
|
+
import { createEnvironment, farmPreset } from '@umituz/web-virtual'
|
|
98
|
+
|
|
99
|
+
const world = createEnvironment({
|
|
100
|
+
preset: farmPreset,
|
|
101
|
+
name: 'Agromera Çiftlik',
|
|
102
|
+
zones: TurkishZoneLabels, // optional: localize room names
|
|
103
|
+
entities: [
|
|
104
|
+
{ slotId: 'slot-1', type: 'person', name: 'Ahmet', role: 'Sera operatörü', status: 'working' },
|
|
105
|
+
{ slotId: 'slot-2', type: 'vehicle', name: 'Traktör Alpha', status: 'running' },
|
|
106
|
+
],
|
|
107
|
+
})
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Full digital HQ screen
|
|
111
|
+
|
|
112
|
+
```tsx
|
|
113
|
+
import { DigitalHQView, createEnvironment, officePreset } from '@umituz/web-virtual'
|
|
114
|
+
|
|
115
|
+
<DigitalHQView
|
|
116
|
+
world={world}
|
|
117
|
+
preset={officePreset}
|
|
118
|
+
deskCapacity={17}
|
|
119
|
+
onDispatchMission={async ({ prompt, targetId, isDemo }) => {
|
|
120
|
+
await fetch('/api/office/dispatch', {
|
|
121
|
+
method: 'POST',
|
|
122
|
+
body: JSON.stringify({ prompt, targetId, demo: isDemo }),
|
|
123
|
+
})
|
|
124
|
+
}}
|
|
125
|
+
getEntityLatestTask={(id) => latestTaskById.get(id) ?? null}
|
|
126
|
+
/>
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## Key props
|
|
132
|
+
|
|
133
|
+
### `VirtualWorld`
|
|
134
|
+
|
|
135
|
+
| Prop | Type | Notes |
|
|
136
|
+
|---|---|---|
|
|
137
|
+
| `world` | `WorldDefinition` | Hot-synced: changes update the scene in place. |
|
|
138
|
+
| `preset` | `WorldPreset` | Scene is built once per preset instance. |
|
|
139
|
+
| `pinMode` | `'pins' \| 'labels' \| 'off'` | Controlled or uncontrolled label display. |
|
|
140
|
+
| `nightMode` | `boolean` | Smooth day/night lighting transition. |
|
|
141
|
+
| `onSelectEntity` / `onHoverEntity` | callback | Fired from 3D raycast hits and pins. |
|
|
142
|
+
|
|
143
|
+
Ref API (`VirtualWorldRef`): `focusOnEntity`, `setCameraPreset`, `resetCamera`, `setNightMode`, `resize`.
|
|
144
|
+
|
|
145
|
+
### `DigitalHQView`
|
|
146
|
+
|
|
147
|
+
Everything `VirtualWorld` renders plus an operations dashboard and AI command center. Notable props: `departments` (consumer org data; neutral zone-based groups when omitted), `projects`, `activities`, `presetMissions`, `deskCapacity` (defaults to the world's entity count), `getEntityMetrics`, `getEntityLatestTask`, `onDispatchMission({ prompt, targetId, isDemo })`, `onSeedSquad`.
|
|
148
|
+
|
|
60
149
|
---
|
|
61
150
|
|
|
62
151
|
## License
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/web-virtual",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Universal 3D Virtual Environment Engine for Web & React — Offices, Farms, Factories, Schools, Hospitals with 60fps performance, raycasting and interactive entities.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -30,14 +30,15 @@ import {
|
|
|
30
30
|
Moon,
|
|
31
31
|
Sun,
|
|
32
32
|
RotateCcw,
|
|
33
|
+
Users,
|
|
33
34
|
} from 'lucide-react'
|
|
34
|
-
import type { WorldDefinition, WorldEntity, WorldPreset, PinDisplayMode } from '../core/types'
|
|
35
|
+
import type { WorldDefinition, WorldEntity, WorldPreset, PinDisplayMode, DepartmentInfo } from '../core/types'
|
|
36
|
+
import { deriveDepartmentsFromZones } from '../core/environment'
|
|
35
37
|
import { VirtualWorld, type VirtualWorldRef } from './VirtualWorld'
|
|
36
38
|
import { VirtualCommandBar, type PresetMission } from './VirtualCommandBar'
|
|
37
39
|
import { VirtualRoster } from './VirtualRoster'
|
|
38
40
|
import { VirtualEntityDrawer, type EntityRunMetrics, type EntityLatestTask } from './VirtualEntityDrawer'
|
|
39
41
|
import { VirtualReportModal, type VirtualReportData } from './VirtualReportModal'
|
|
40
|
-
import { DEFAULT_OFFICE_DEPARTMENTS, type DepartmentInfo } from '../presets/officePreset'
|
|
41
42
|
|
|
42
43
|
export type OperationalMode = 'office' | 'operations' | 'command_center'
|
|
43
44
|
|
|
@@ -73,6 +74,8 @@ export interface DigitalHQViewProps {
|
|
|
73
74
|
onSelectEntity?: (entity: WorldEntity | null) => void
|
|
74
75
|
getEntityMetrics?: (entityId: string) => EntityRunMetrics | undefined
|
|
75
76
|
getEntityLatestTask?: (entityId: string) => EntityLatestTask | null
|
|
77
|
+
/** Total number of desks in the office layout (defaults to the world's entity count). */
|
|
78
|
+
deskCapacity?: number
|
|
76
79
|
returnUrl?: string
|
|
77
80
|
standaloneUrl?: string
|
|
78
81
|
className?: string
|
|
@@ -81,7 +84,7 @@ export interface DigitalHQViewProps {
|
|
|
81
84
|
export function DigitalHQView({
|
|
82
85
|
world,
|
|
83
86
|
preset,
|
|
84
|
-
departments
|
|
87
|
+
departments: departmentsProp,
|
|
85
88
|
presetMissions = [],
|
|
86
89
|
projects = [],
|
|
87
90
|
activities = [],
|
|
@@ -96,6 +99,7 @@ export function DigitalHQView({
|
|
|
96
99
|
onSelectEntity,
|
|
97
100
|
getEntityMetrics,
|
|
98
101
|
getEntityLatestTask,
|
|
102
|
+
deskCapacity,
|
|
99
103
|
returnUrl = '/app/office',
|
|
100
104
|
standaloneUrl = '/digital-hq',
|
|
101
105
|
className = '',
|
|
@@ -190,10 +194,20 @@ export function DigitalHQView({
|
|
|
190
194
|
return world.entities.filter((e) => e.status === 'running' || e.status === 'working').length
|
|
191
195
|
}, [world.entities])
|
|
192
196
|
|
|
197
|
+
// Departments are consumer org data. When none are supplied, derive a
|
|
198
|
+
// neutral grouping from the preset's architectural zones instead.
|
|
199
|
+
const departments = useMemo<DepartmentInfo[]>(() => {
|
|
200
|
+
if (departmentsProp && departmentsProp.length > 0) return departmentsProp
|
|
201
|
+
return deriveDepartmentsFromZones(world.zones, preset?.slots ?? [])
|
|
202
|
+
}, [departmentsProp, world.zones, preset])
|
|
203
|
+
|
|
193
204
|
const pendingApprovalsCount = useMemo(() => {
|
|
194
205
|
return world.entities.filter((e) => e.status === 'awaiting_approval').length
|
|
195
206
|
}, [world.entities])
|
|
196
207
|
|
|
208
|
+
// Total desks in the office layout (defaults to the world's entity count)
|
|
209
|
+
const capacity = deskCapacity ?? world.entities.length
|
|
210
|
+
|
|
197
211
|
return (
|
|
198
212
|
<div className={`wv-hq-container ${nightMode ? 'is-night' : ''} ${className}`}>
|
|
199
213
|
{/* 1. Header Toolbar */}
|
|
@@ -208,25 +222,25 @@ export function DigitalHQView({
|
|
|
208
222
|
<h1 className="wv-hq-brand-title">{world.name}</h1>
|
|
209
223
|
<span className="wv-hq-badge">Universal 3D</span>
|
|
210
224
|
</div>
|
|
211
|
-
<p className="wv-hq-brand-desc">
|
|
225
|
+
<p className="wv-hq-brand-desc">AI-powered virtual headquarters</p>
|
|
212
226
|
</div>
|
|
213
227
|
</div>
|
|
214
228
|
|
|
215
229
|
<div className="wv-hq-stats-row">
|
|
216
230
|
<span className="wv-hq-stat-pill is-green">
|
|
217
231
|
<span className="wv-hq-pip" />
|
|
218
|
-
{world.entities.length} /
|
|
232
|
+
{world.entities.length} / {capacity} desks staffed
|
|
219
233
|
</span>
|
|
220
234
|
{activeWorkersCount > 0 && (
|
|
221
235
|
<span className="wv-hq-stat-pill is-purple">
|
|
222
236
|
<Zap size={12} />
|
|
223
|
-
{activeWorkersCount}
|
|
237
|
+
{activeWorkersCount} on a mission
|
|
224
238
|
</span>
|
|
225
239
|
)}
|
|
226
240
|
{pendingApprovalsCount > 0 && (
|
|
227
241
|
<span className="wv-hq-stat-pill is-amber">
|
|
228
242
|
<Clock size={12} />
|
|
229
|
-
{pendingApprovalsCount}
|
|
243
|
+
{pendingApprovalsCount} awaiting approval
|
|
230
244
|
</span>
|
|
231
245
|
)}
|
|
232
246
|
</div>
|
|
@@ -240,7 +254,7 @@ export function DigitalHQView({
|
|
|
240
254
|
className={`wv-hq-mode-tab ${activeMode === 'office' ? 'is-active' : ''}`}
|
|
241
255
|
>
|
|
242
256
|
<Compass size={14} color="#3b82f6" />
|
|
243
|
-
<span>
|
|
257
|
+
<span>Office floor (3D)</span>
|
|
244
258
|
</button>
|
|
245
259
|
|
|
246
260
|
<button
|
|
@@ -249,7 +263,7 @@ export function DigitalHQView({
|
|
|
249
263
|
className={`wv-hq-mode-tab ${activeMode === 'operations' ? 'is-active' : ''}`}
|
|
250
264
|
>
|
|
251
265
|
<LayoutDashboard size={14} color="#06b6d4" />
|
|
252
|
-
<span>
|
|
266
|
+
<span>Operations</span>
|
|
253
267
|
{projects.length > 0 && (
|
|
254
268
|
<span className="wv-hq-tab-count">{projects.length}</span>
|
|
255
269
|
)}
|
|
@@ -261,7 +275,7 @@ export function DigitalHQView({
|
|
|
261
275
|
className={`wv-hq-mode-tab ${activeMode === 'command_center' ? 'is-active' : ''}`}
|
|
262
276
|
>
|
|
263
277
|
<Terminal size={14} color="#a855f7" />
|
|
264
|
-
<span>AI
|
|
278
|
+
<span>AI command center</span>
|
|
265
279
|
{pendingApprovalsCount > 0 && (
|
|
266
280
|
<span className="wv-hq-tab-badge">{pendingApprovalsCount}</span>
|
|
267
281
|
)}
|
|
@@ -270,7 +284,7 @@ export function DigitalHQView({
|
|
|
270
284
|
|
|
271
285
|
{/* Header Right Actions */}
|
|
272
286
|
<div className="wv-hq-header-right">
|
|
273
|
-
{onSeedSquad && world.entities.length <
|
|
287
|
+
{onSeedSquad && world.entities.length < capacity && (
|
|
274
288
|
<button
|
|
275
289
|
type="button"
|
|
276
290
|
onClick={onSeedSquad}
|
|
@@ -278,7 +292,7 @@ export function DigitalHQView({
|
|
|
278
292
|
className="wv-hq-action-btn is-seed"
|
|
279
293
|
>
|
|
280
294
|
{isSeeding ? <Loader2 size={13} className="wv-spin" /> : <Sparkles size={13} />}
|
|
281
|
-
<span>
|
|
295
|
+
<span>Build squad ({capacity})</span>
|
|
282
296
|
</button>
|
|
283
297
|
)}
|
|
284
298
|
|
|
@@ -289,11 +303,11 @@ export function DigitalHQView({
|
|
|
289
303
|
type="button"
|
|
290
304
|
onClick={handleCyclePinMode}
|
|
291
305
|
className={`wv-hq-action-btn ${pinMode !== 'off' ? 'is-active' : ''}`}
|
|
292
|
-
title="
|
|
306
|
+
title="Cycle labels: off ➔ numbers (#) ➔ names"
|
|
293
307
|
>
|
|
294
308
|
<Tag size={14} />
|
|
295
309
|
<span>
|
|
296
|
-
{pinMode === 'off' ? '
|
|
310
|
+
{pinMode === 'off' ? 'Labels: off' : pinMode === 'pins' ? 'Desk no. (#)' : 'Names'}
|
|
297
311
|
</span>
|
|
298
312
|
</button>
|
|
299
313
|
|
|
@@ -302,10 +316,10 @@ export function DigitalHQView({
|
|
|
302
316
|
type="button"
|
|
303
317
|
onClick={() => setShowCommandBar((prev) => !prev)}
|
|
304
318
|
className={`wv-hq-action-btn ${showCommandBar ? 'is-active' : ''}`}
|
|
305
|
-
title={showCommandBar ? '
|
|
319
|
+
title={showCommandBar ? 'Hide mission panel' : 'Show mission panel'}
|
|
306
320
|
>
|
|
307
321
|
<Terminal size={14} />
|
|
308
|
-
<span className="wv-hide-mobile">
|
|
322
|
+
<span className="wv-hide-mobile">Mission panel</span>
|
|
309
323
|
</button>
|
|
310
324
|
|
|
311
325
|
{/* Roster Sidebar Toggle */}
|
|
@@ -313,10 +327,10 @@ export function DigitalHQView({
|
|
|
313
327
|
type="button"
|
|
314
328
|
onClick={handleToggleRoster}
|
|
315
329
|
className={`wv-hq-action-btn ${showRoster ? 'is-active' : ''}`}
|
|
316
|
-
title={showRoster ? '
|
|
330
|
+
title={showRoster ? 'Hide roster panel' : 'Show roster panel'}
|
|
317
331
|
>
|
|
318
332
|
{showRoster ? <PanelRightClose size={15} /> : <PanelRightOpen size={15} />}
|
|
319
|
-
<span className="wv-hide-mobile">
|
|
333
|
+
<span className="wv-hide-mobile">Roster ({world.entities.length})</span>
|
|
320
334
|
</button>
|
|
321
335
|
|
|
322
336
|
{/* Lighting Toggle */}
|
|
@@ -328,7 +342,7 @@ export function DigitalHQView({
|
|
|
328
342
|
virtualWorldRef.current?.setNightMode(next)
|
|
329
343
|
}}
|
|
330
344
|
className="wv-hq-icon-btn"
|
|
331
|
-
title={nightMode ? '
|
|
345
|
+
title={nightMode ? 'Switch to day mode (bright studio)' : 'Switch to night mode (evening lights)'}
|
|
332
346
|
>
|
|
333
347
|
{nightMode ? <Sun size={15} color="#f59e0b" /> : <Moon size={15} />}
|
|
334
348
|
</button>
|
|
@@ -338,7 +352,7 @@ export function DigitalHQView({
|
|
|
338
352
|
type="button"
|
|
339
353
|
onClick={() => virtualWorldRef.current?.resetCamera()}
|
|
340
354
|
className="wv-hq-icon-btn"
|
|
341
|
-
title="
|
|
355
|
+
title="Reset camera to the default isometric angle"
|
|
342
356
|
>
|
|
343
357
|
<RotateCcw size={15} />
|
|
344
358
|
</button>
|
|
@@ -351,16 +365,16 @@ export function DigitalHQView({
|
|
|
351
365
|
target="_blank"
|
|
352
366
|
rel="noreferrer"
|
|
353
367
|
className="wv-hq-action-btn"
|
|
354
|
-
title="
|
|
368
|
+
title="Open as a standalone fullscreen page"
|
|
355
369
|
>
|
|
356
370
|
<ExternalLink size={14} />
|
|
357
|
-
<span className="wv-hide-mobile">
|
|
371
|
+
<span className="wv-hide-mobile">Open standalone</span>
|
|
358
372
|
</a>
|
|
359
373
|
) : (
|
|
360
374
|
<a
|
|
361
375
|
href={returnUrl}
|
|
362
376
|
className="wv-hq-action-btn"
|
|
363
|
-
title="
|
|
377
|
+
title="Back to dashboard"
|
|
364
378
|
>
|
|
365
379
|
<ArrowRight size={14} style={{ transform: 'rotate(180deg)' }} />
|
|
366
380
|
<span className="wv-hide-mobile">Dashboard</span>
|
|
@@ -371,7 +385,7 @@ export function DigitalHQView({
|
|
|
371
385
|
type="button"
|
|
372
386
|
onClick={handleToggleFullscreen}
|
|
373
387
|
className="wv-hq-icon-btn"
|
|
374
|
-
title={isFullscreen ? '
|
|
388
|
+
title={isFullscreen ? 'Exit fullscreen' : 'Fullscreen'}
|
|
375
389
|
>
|
|
376
390
|
{isFullscreen ? <Minimize2 size={15} /> : <Maximize2 size={15} />}
|
|
377
391
|
</button>
|
|
@@ -382,7 +396,7 @@ export function DigitalHQView({
|
|
|
382
396
|
onClick={onRefresh}
|
|
383
397
|
disabled={refreshing}
|
|
384
398
|
className="wv-hq-icon-btn"
|
|
385
|
-
title="
|
|
399
|
+
title="Refresh data"
|
|
386
400
|
>
|
|
387
401
|
<RefreshCw size={15} className={refreshing ? 'wv-spin' : ''} />
|
|
388
402
|
</button>
|
|
@@ -401,14 +415,14 @@ export function DigitalHQView({
|
|
|
401
415
|
{loading && (
|
|
402
416
|
<div className="wv-hq-loading-overlay">
|
|
403
417
|
<Loader2 size={32} className="wv-spin" color="#3b82f6" />
|
|
404
|
-
<p>
|
|
418
|
+
<p>Loading the 3D office floor...</p>
|
|
405
419
|
</div>
|
|
406
420
|
)}
|
|
407
421
|
|
|
408
422
|
{/* Navigation Hint */}
|
|
409
423
|
<div className="wv-hq-nav-hint">
|
|
410
424
|
<Compass size={14} color="#3b82f6" />
|
|
411
|
-
<span>3D
|
|
425
|
+
<span>Click a 3D desk to open its profile • Left drag: orbit • Right drag: pan • Wheel: zoom</span>
|
|
412
426
|
</div>
|
|
413
427
|
|
|
414
428
|
{/* 3D Viewport */}
|
|
@@ -429,6 +443,31 @@ export function DigitalHQView({
|
|
|
429
443
|
showControls={false}
|
|
430
444
|
showInspector={false}
|
|
431
445
|
>
|
|
446
|
+
{/* Friendly empty state when no occupants are placed yet */}
|
|
447
|
+
{world.entities.length === 0 && (
|
|
448
|
+
<div className="wv-hq-empty-floor">
|
|
449
|
+
<div className="wv-hq-empty-floor-card">
|
|
450
|
+
<Users size={28} />
|
|
451
|
+
<h3>The floor is ready — nobody is in yet</h3>
|
|
452
|
+
<p>
|
|
453
|
+
All {capacity} desks are installed and waiting. Bring your team in and they
|
|
454
|
+
will take their seats here in 3D.
|
|
455
|
+
</p>
|
|
456
|
+
{onSeedSquad && (
|
|
457
|
+
<button
|
|
458
|
+
type="button"
|
|
459
|
+
onClick={onSeedSquad}
|
|
460
|
+
disabled={isSeeding}
|
|
461
|
+
className="wv-hq-empty-floor-btn"
|
|
462
|
+
>
|
|
463
|
+
{isSeeding ? <Loader2 size={14} className="wv-spin" /> : <Sparkles size={14} />}
|
|
464
|
+
<span>Build the squad ({capacity})</span>
|
|
465
|
+
</button>
|
|
466
|
+
)}
|
|
467
|
+
</div>
|
|
468
|
+
</div>
|
|
469
|
+
)}
|
|
470
|
+
|
|
432
471
|
{/* Floating Bottom Command Bar Overlay */}
|
|
433
472
|
<VirtualCommandBar
|
|
434
473
|
presetMissions={presetMissions}
|
|
@@ -503,38 +542,38 @@ export function DigitalHQView({
|
|
|
503
542
|
<div className="wv-hq-ops-metrics-grid">
|
|
504
543
|
<div className="wv-hq-ops-metric-card">
|
|
505
544
|
<div className="wv-ops-metric-header">
|
|
506
|
-
<span>
|
|
545
|
+
<span>Total projects</span>
|
|
507
546
|
<FolderKanban size={16} color="#3b82f6" />
|
|
508
547
|
</div>
|
|
509
548
|
<div className="wv-ops-metric-num">{projects.length}</div>
|
|
510
|
-
<p className="wv-ops-metric-sub">
|
|
549
|
+
<p className="wv-ops-metric-sub">Active work portfolio</p>
|
|
511
550
|
</div>
|
|
512
551
|
|
|
513
552
|
<div className="wv-hq-ops-metric-card">
|
|
514
553
|
<div className="wv-ops-metric-header">
|
|
515
|
-
<span>
|
|
554
|
+
<span>Departments</span>
|
|
516
555
|
<Building2 size={16} color="#06b6d4" />
|
|
517
556
|
</div>
|
|
518
557
|
<div className="wv-ops-metric-num">{departments.length}</div>
|
|
519
|
-
<p className="wv-ops-metric-sub">
|
|
558
|
+
<p className="wv-ops-metric-sub">Functional work cells</p>
|
|
520
559
|
</div>
|
|
521
560
|
|
|
522
561
|
<div className="wv-hq-ops-metric-card">
|
|
523
562
|
<div className="wv-ops-metric-header">
|
|
524
|
-
<span>
|
|
563
|
+
<span>Active staff</span>
|
|
525
564
|
<Zap size={16} color="#a855f7" />
|
|
526
565
|
</div>
|
|
527
|
-
<div className="wv-ops-metric-num">{activeWorkersCount} /
|
|
528
|
-
<p className="wv-ops-metric-sub">
|
|
566
|
+
<div className="wv-ops-metric-num">{activeWorkersCount} / {capacity}</div>
|
|
567
|
+
<p className="wv-ops-metric-sub">Specialists working at their desks</p>
|
|
529
568
|
</div>
|
|
530
569
|
|
|
531
570
|
<div className="wv-hq-ops-metric-card">
|
|
532
571
|
<div className="wv-ops-metric-header">
|
|
533
|
-
<span>
|
|
572
|
+
<span>Awaiting approval</span>
|
|
534
573
|
<Clock size={16} color="#f59e0b" />
|
|
535
574
|
</div>
|
|
536
575
|
<div className="wv-ops-metric-num">{pendingApprovalsCount}</div>
|
|
537
|
-
<p className="wv-ops-metric-sub">
|
|
576
|
+
<p className="wv-ops-metric-sub">Missions pending a manager approval</p>
|
|
538
577
|
</div>
|
|
539
578
|
</div>
|
|
540
579
|
|
|
@@ -543,12 +582,12 @@ export function DigitalHQView({
|
|
|
543
582
|
<div className="wv-hq-ops-dept-col">
|
|
544
583
|
<h2 className="wv-hq-section-heading">
|
|
545
584
|
<Building2 size={16} color="#3b82f6" />
|
|
546
|
-
<span>
|
|
585
|
+
<span>Department rooms & desks</span>
|
|
547
586
|
</h2>
|
|
548
587
|
|
|
549
588
|
<div className="wv-hq-dept-cards-grid">
|
|
550
589
|
{departments.map((dept) => {
|
|
551
|
-
const deptEntities = world.entities.filter((e) => dept.slotIds.includes(e.id))
|
|
590
|
+
const deptEntities = world.entities.filter((e) => (dept.slotIds ?? []).includes(e.id))
|
|
552
591
|
const isDeptBusy = deptEntities.some((e) => e.status === 'running' || e.status === 'working')
|
|
553
592
|
|
|
554
593
|
return (
|
|
@@ -556,23 +595,23 @@ export function DigitalHQView({
|
|
|
556
595
|
<div>
|
|
557
596
|
<div className="wv-dept-card-top">
|
|
558
597
|
<span className="wv-dept-color-pip" style={{ backgroundColor: dept.color }} />
|
|
559
|
-
{isDeptBusy && <span className="wv-dept-busy-badge">⚡
|
|
598
|
+
{isDeptBusy && <span className="wv-dept-busy-badge">⚡ Working</span>}
|
|
560
599
|
</div>
|
|
561
600
|
<h3 className="wv-dept-name">{dept.name}</h3>
|
|
562
601
|
<p className="wv-dept-desc">{dept.description}</p>
|
|
563
602
|
</div>
|
|
564
603
|
|
|
565
604
|
<div className="wv-dept-card-bottom">
|
|
566
|
-
<span>{deptEntities.length}
|
|
605
|
+
<span>{deptEntities.length} {deptEntities.length === 1 ? 'desk' : 'desks'}</span>
|
|
567
606
|
<button
|
|
568
607
|
type="button"
|
|
569
608
|
onClick={() => {
|
|
570
|
-
setSelectedCategory(dept.slug)
|
|
609
|
+
setSelectedCategory(dept.slug ?? dept.id)
|
|
571
610
|
setActiveMode('office')
|
|
572
611
|
}}
|
|
573
612
|
className="wv-dept-link-btn"
|
|
574
613
|
>
|
|
575
|
-
<span>
|
|
614
|
+
<span>Go to room</span>
|
|
576
615
|
<ArrowRight size={13} />
|
|
577
616
|
</button>
|
|
578
617
|
</div>
|
|
@@ -586,14 +625,14 @@ export function DigitalHQView({
|
|
|
586
625
|
<div className="wv-hq-ops-act-col">
|
|
587
626
|
<h2 className="wv-hq-section-heading">
|
|
588
627
|
<Activity size={16} color="#3b82f6" />
|
|
589
|
-
<span>
|
|
628
|
+
<span>System activity feed</span>
|
|
590
629
|
</h2>
|
|
591
630
|
|
|
592
631
|
<div className="wv-hq-act-box">
|
|
593
632
|
{activities.length === 0 ? (
|
|
594
633
|
<div className="wv-hq-empty-act">
|
|
595
634
|
<Clock size={24} style={{ opacity: 0.4, margin: '0 auto 8px' }} />
|
|
596
|
-
<p>
|
|
635
|
+
<p>No recorded system activity yet.</p>
|
|
597
636
|
</div>
|
|
598
637
|
) : (
|
|
599
638
|
activities.slice(0, 8).map((act) => (
|
|
@@ -628,9 +667,9 @@ export function DigitalHQView({
|
|
|
628
667
|
<Terminal size={20} />
|
|
629
668
|
</div>
|
|
630
669
|
<div>
|
|
631
|
-
<h2 className="wv-dispatch-title">
|
|
670
|
+
<h2 className="wv-dispatch-title">AI command & orchestration</h2>
|
|
632
671
|
<p className="wv-dispatch-sub">
|
|
633
|
-
|
|
672
|
+
Dispatch missions to every department automatically through the general manager.
|
|
634
673
|
</p>
|
|
635
674
|
</div>
|
|
636
675
|
</div>
|
|
@@ -640,7 +679,7 @@ export function DigitalHQView({
|
|
|
640
679
|
value={promptText}
|
|
641
680
|
onChange={(e) => setPromptText(e.target.value)}
|
|
642
681
|
rows={3}
|
|
643
|
-
placeholder="
|
|
682
|
+
placeholder="Describe a company goal or a complex project... (e.g. Build the strategy, visual briefs and budget plan for our new digital marketing campaign)"
|
|
644
683
|
className="wv-dispatch-textarea"
|
|
645
684
|
/>
|
|
646
685
|
<div className="wv-dispatch-actions-row">
|
|
@@ -650,7 +689,7 @@ export function DigitalHQView({
|
|
|
650
689
|
className={`wv-demo-toggle-btn ${isDemoMode ? 'is-demo' : 'is-ai'}`}
|
|
651
690
|
>
|
|
652
691
|
{isDemoMode ? <Sparkles size={14} /> : <Bot size={14} />}
|
|
653
|
-
<span>{isDemoMode ? '
|
|
692
|
+
<span>{isDemoMode ? 'Fast demo simulation' : 'Real LLM API'}</span>
|
|
654
693
|
</button>
|
|
655
694
|
|
|
656
695
|
<button
|
|
@@ -660,7 +699,7 @@ export function DigitalHQView({
|
|
|
660
699
|
className="wv-dispatch-submit-big-btn"
|
|
661
700
|
>
|
|
662
701
|
{isLaunching ? <Loader2 size={16} className="wv-spin" /> : <Send size={15} />}
|
|
663
|
-
<span>
|
|
702
|
+
<span>Start orchestration</span>
|
|
664
703
|
</button>
|
|
665
704
|
</div>
|
|
666
705
|
</div>
|
|
@@ -670,13 +709,13 @@ export function DigitalHQView({
|
|
|
670
709
|
<div className="wv-hq-review-section">
|
|
671
710
|
<h3 className="wv-hq-section-heading">
|
|
672
711
|
<Clock size={16} color="#f59e0b" />
|
|
673
|
-
<span>
|
|
712
|
+
<span>Missions awaiting review & approval</span>
|
|
674
713
|
</h3>
|
|
675
714
|
|
|
676
715
|
<div className="wv-hq-review-feed">
|
|
677
716
|
{world.entities.filter((e) => getEntityLatestTask && getEntityLatestTask(e.id)).length === 0 ? (
|
|
678
717
|
<div className="wv-hq-empty-feed">
|
|
679
|
-
|
|
718
|
+
No completed or approval-pending missions yet.
|
|
680
719
|
</div>
|
|
681
720
|
) : (
|
|
682
721
|
world.entities
|
|
@@ -709,7 +748,7 @@ export function DigitalHQView({
|
|
|
709
748
|
className="wv-review-view-btn"
|
|
710
749
|
>
|
|
711
750
|
<Eye size={14} />
|
|
712
|
-
<span>
|
|
751
|
+
<span>View report</span>
|
|
713
752
|
</button>
|
|
714
753
|
</div>
|
|
715
754
|
)
|
|
@@ -91,7 +91,7 @@ export function EntityInspector({
|
|
|
91
91
|
justifyContent: 'center',
|
|
92
92
|
borderRadius: 6,
|
|
93
93
|
}}
|
|
94
|
-
title="
|
|
94
|
+
title="Close (Esc)"
|
|
95
95
|
>
|
|
96
96
|
<X size={16} />
|
|
97
97
|
</button>
|
|
@@ -101,10 +101,10 @@ export function EntityInspector({
|
|
|
101
101
|
<div style={{ padding: 14, overflowY: 'auto', display: 'flex', flexDirection: 'column', gap: 12 }}>
|
|
102
102
|
{/* Role & Department */}
|
|
103
103
|
<div>
|
|
104
|
-
<div style={{ fontSize: 13, fontWeight: 500, color: '#e2e8f0' }}>{entity.role || '
|
|
104
|
+
<div style={{ fontSize: 13, fontWeight: 500, color: '#e2e8f0' }}>{entity.role || 'Entity'}</div>
|
|
105
105
|
{entity.department && (
|
|
106
106
|
<div style={{ fontSize: 11, color: '#94a3b8', marginTop: 2 }}>
|
|
107
|
-
|
|
107
|
+
Department: {entity.department}
|
|
108
108
|
</div>
|
|
109
109
|
)}
|
|
110
110
|
</div>
|
|
@@ -132,10 +132,10 @@ export function EntityInspector({
|
|
|
132
132
|
}}
|
|
133
133
|
>
|
|
134
134
|
{entity.status === 'running' || entity.status === 'working'
|
|
135
|
-
? '
|
|
135
|
+
? 'Working on a mission'
|
|
136
136
|
: entity.status === 'awaiting_approval'
|
|
137
|
-
? '
|
|
138
|
-
: '
|
|
137
|
+
? 'Awaiting approval'
|
|
138
|
+
: 'Ready / idle'}
|
|
139
139
|
</span>
|
|
140
140
|
</div>
|
|
141
141
|
|
|
@@ -160,7 +160,7 @@ export function EntityInspector({
|
|
|
160
160
|
fontSize: 11,
|
|
161
161
|
}}
|
|
162
162
|
>
|
|
163
|
-
<div style={{ fontWeight: 600, color: '#94a3b8', marginBottom: 6 }}
|
|
163
|
+
<div style={{ fontWeight: 600, color: '#94a3b8', marginBottom: 6 }}>ATTRIBUTES</div>
|
|
164
164
|
{Object.entries(entity.metadata).map(([k, v]) => (
|
|
165
165
|
<div
|
|
166
166
|
key={k}
|
|
@@ -212,7 +212,7 @@ export function EntityInspector({
|
|
|
212
212
|
}}
|
|
213
213
|
>
|
|
214
214
|
<Focus size={14} />
|
|
215
|
-
3D
|
|
215
|
+
Focus 3D camera
|
|
216
216
|
</button>
|
|
217
217
|
)}
|
|
218
218
|
|