@umituz/web-virtual 1.0.2 → 1.0.3
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/package.json +1 -1
- package/src/components/DigitalHQView.tsx +659 -0
- package/src/components/EntityInspector.tsx +1 -2
- package/src/components/EntityPins.tsx +1 -1
- package/src/components/VirtualCommandBar.tsx +157 -0
- package/src/components/VirtualEntityDrawer.tsx +195 -0
- package/src/components/VirtualReportModal.tsx +79 -0
- package/src/components/VirtualRoster.tsx +183 -0
- package/src/components/index.ts +5 -0
- package/src/engine/materials.ts +0 -1
- package/src/engine/raycaster.ts +0 -1
- package/src/engine/renderer.ts +1 -1
- package/src/presets/officePreset.ts +70 -1
- package/src/styles/virtual.css +1483 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/web-virtual",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
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",
|
|
@@ -0,0 +1,659 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type ReactNode,
|
|
3
|
+
useState,
|
|
4
|
+
useRef,
|
|
5
|
+
useCallback,
|
|
6
|
+
useMemo,
|
|
7
|
+
useEffect,
|
|
8
|
+
} from 'react'
|
|
9
|
+
import {
|
|
10
|
+
Building2,
|
|
11
|
+
Compass,
|
|
12
|
+
LayoutDashboard,
|
|
13
|
+
Terminal,
|
|
14
|
+
RefreshCw,
|
|
15
|
+
ExternalLink,
|
|
16
|
+
ArrowRight,
|
|
17
|
+
Maximize2,
|
|
18
|
+
Minimize2,
|
|
19
|
+
PanelRightClose,
|
|
20
|
+
PanelRightOpen,
|
|
21
|
+
Sparkles,
|
|
22
|
+
Zap,
|
|
23
|
+
Clock,
|
|
24
|
+
FolderKanban,
|
|
25
|
+
Activity,
|
|
26
|
+
Bot,
|
|
27
|
+
Send,
|
|
28
|
+
Loader2,
|
|
29
|
+
Eye,
|
|
30
|
+
} from 'lucide-react'
|
|
31
|
+
import type { WorldDefinition, WorldEntity, WorldPreset } from '../core/types'
|
|
32
|
+
import { VirtualWorld, type VirtualWorldRef } from './VirtualWorld'
|
|
33
|
+
import { VirtualCommandBar, type PresetMission } from './VirtualCommandBar'
|
|
34
|
+
import { VirtualRoster } from './VirtualRoster'
|
|
35
|
+
import { VirtualEntityDrawer, type EntityRunMetrics, type EntityLatestTask } from './VirtualEntityDrawer'
|
|
36
|
+
import { VirtualReportModal, type VirtualReportData } from './VirtualReportModal'
|
|
37
|
+
import { DEFAULT_OFFICE_DEPARTMENTS, type DepartmentInfo } from '../presets/officePreset'
|
|
38
|
+
|
|
39
|
+
export type OperationalMode = 'office' | 'operations' | 'command_center'
|
|
40
|
+
|
|
41
|
+
export interface DigitalHQProject {
|
|
42
|
+
id: string
|
|
43
|
+
name: string
|
|
44
|
+
description?: string
|
|
45
|
+
status?: string
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface DigitalHQActivity {
|
|
49
|
+
id: string
|
|
50
|
+
title: string
|
|
51
|
+
description?: string
|
|
52
|
+
createdAt: string
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface DigitalHQViewProps {
|
|
56
|
+
world: WorldDefinition
|
|
57
|
+
preset?: WorldPreset
|
|
58
|
+
departments?: DepartmentInfo[]
|
|
59
|
+
presetMissions?: PresetMission[]
|
|
60
|
+
projects?: DigitalHQProject[]
|
|
61
|
+
activities?: DigitalHQActivity[]
|
|
62
|
+
standalone?: boolean
|
|
63
|
+
loading?: boolean
|
|
64
|
+
refreshing?: boolean
|
|
65
|
+
onRefresh?: () => void
|
|
66
|
+
onSeedSquad?: () => void
|
|
67
|
+
isSeeding?: boolean
|
|
68
|
+
onDispatchMission: (data: { prompt: string; targetId: string; isDemo: boolean }) => Promise<void> | void
|
|
69
|
+
selectedEntityId?: string | null
|
|
70
|
+
onSelectEntity?: (entity: WorldEntity | null) => void
|
|
71
|
+
getEntityMetrics?: (entityId: string) => EntityRunMetrics | undefined
|
|
72
|
+
getEntityLatestTask?: (entityId: string) => EntityLatestTask | null
|
|
73
|
+
returnUrl?: string
|
|
74
|
+
standaloneUrl?: string
|
|
75
|
+
className?: string
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export function DigitalHQView({
|
|
79
|
+
world,
|
|
80
|
+
preset,
|
|
81
|
+
departments = DEFAULT_OFFICE_DEPARTMENTS,
|
|
82
|
+
presetMissions = [],
|
|
83
|
+
projects = [],
|
|
84
|
+
activities = [],
|
|
85
|
+
standalone = true,
|
|
86
|
+
loading = false,
|
|
87
|
+
refreshing = false,
|
|
88
|
+
onRefresh,
|
|
89
|
+
onSeedSquad,
|
|
90
|
+
isSeeding = false,
|
|
91
|
+
onDispatchMission,
|
|
92
|
+
selectedEntityId,
|
|
93
|
+
onSelectEntity,
|
|
94
|
+
getEntityMetrics,
|
|
95
|
+
getEntityLatestTask,
|
|
96
|
+
returnUrl = '/app/office',
|
|
97
|
+
standaloneUrl = '/digital-hq',
|
|
98
|
+
className = '',
|
|
99
|
+
}: DigitalHQViewProps): ReactNode {
|
|
100
|
+
// Navigation Mode
|
|
101
|
+
const [activeMode, setActiveMode] = useState<OperationalMode>('office')
|
|
102
|
+
|
|
103
|
+
// Layout / Sidebar
|
|
104
|
+
const virtualWorldRef = useRef<VirtualWorldRef>(null)
|
|
105
|
+
const [showRoster, setShowRoster] = useState(true)
|
|
106
|
+
const [isFullscreen, setIsFullscreen] = useState(false)
|
|
107
|
+
|
|
108
|
+
// Selection & Report
|
|
109
|
+
const [internalSelectedId, setInternalSelectedId] = useState<string | null>(null)
|
|
110
|
+
const [viewingReport, setViewingReport] = useState<VirtualReportData | null>(null)
|
|
111
|
+
|
|
112
|
+
const activeEntityId = selectedEntityId !== undefined ? selectedEntityId : internalSelectedId
|
|
113
|
+
const activeEntity = world.entities.find((e) => e.id === activeEntityId) || null
|
|
114
|
+
|
|
115
|
+
// Command Bar & Dispatch
|
|
116
|
+
const [targetId, setTargetId] = useState<string>('auto')
|
|
117
|
+
const [promptText, setPromptText] = useState('')
|
|
118
|
+
const [isDemoMode, setIsDemoMode] = useState(true)
|
|
119
|
+
const [isLaunching, setIsLaunching] = useState(false)
|
|
120
|
+
|
|
121
|
+
// Roster Search & Category
|
|
122
|
+
const [rosterSearch, setRosterSearch] = useState('')
|
|
123
|
+
const [selectedCategory, setSelectedCategory] = useState('all')
|
|
124
|
+
|
|
125
|
+
const handleSelect = useCallback(
|
|
126
|
+
(entity: WorldEntity | null) => {
|
|
127
|
+
setInternalSelectedId(entity ? entity.id : null)
|
|
128
|
+
if (onSelectEntity) onSelectEntity(entity)
|
|
129
|
+
if (entity) {
|
|
130
|
+
virtualWorldRef.current?.focusOnEntity(entity.id)
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
[onSelectEntity],
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
const handleToggleRoster = useCallback(() => {
|
|
137
|
+
setShowRoster((prev) => {
|
|
138
|
+
const next = !prev
|
|
139
|
+
setTimeout(() => virtualWorldRef.current?.resize(), 50)
|
|
140
|
+
return next
|
|
141
|
+
})
|
|
142
|
+
}, [])
|
|
143
|
+
|
|
144
|
+
const handleToggleFullscreen = useCallback(() => {
|
|
145
|
+
if (!document.fullscreenElement) {
|
|
146
|
+
void document.documentElement.requestFullscreen().then(() => {
|
|
147
|
+
setIsFullscreen(true)
|
|
148
|
+
setTimeout(() => virtualWorldRef.current?.resize(), 100)
|
|
149
|
+
})
|
|
150
|
+
} else {
|
|
151
|
+
void document.exitFullscreen().then(() => {
|
|
152
|
+
setIsFullscreen(false)
|
|
153
|
+
setTimeout(() => virtualWorldRef.current?.resize(), 100)
|
|
154
|
+
})
|
|
155
|
+
}
|
|
156
|
+
}, [])
|
|
157
|
+
|
|
158
|
+
const handleDispatch = useCallback(async () => {
|
|
159
|
+
if (!promptText.trim()) return
|
|
160
|
+
setIsLaunching(true)
|
|
161
|
+
try {
|
|
162
|
+
await onDispatchMission({
|
|
163
|
+
prompt: promptText.trim(),
|
|
164
|
+
targetId,
|
|
165
|
+
isDemo: isDemoMode,
|
|
166
|
+
})
|
|
167
|
+
setPromptText('')
|
|
168
|
+
} finally {
|
|
169
|
+
setIsLaunching(false)
|
|
170
|
+
}
|
|
171
|
+
}, [promptText, targetId, isDemoMode, onDispatchMission])
|
|
172
|
+
|
|
173
|
+
// Count active running workers
|
|
174
|
+
const activeWorkersCount = useMemo(() => {
|
|
175
|
+
return world.entities.filter((e) => e.status === 'running' || e.status === 'working').length
|
|
176
|
+
}, [world.entities])
|
|
177
|
+
|
|
178
|
+
const pendingApprovalsCount = useMemo(() => {
|
|
179
|
+
return world.entities.filter((e) => e.status === 'awaiting_approval').length
|
|
180
|
+
}, [world.entities])
|
|
181
|
+
|
|
182
|
+
return (
|
|
183
|
+
<div className={`wv-hq-container ${className}`}>
|
|
184
|
+
{/* 1. Header Toolbar */}
|
|
185
|
+
<header className="wv-hq-header">
|
|
186
|
+
<div className="wv-hq-header-left">
|
|
187
|
+
<div className="wv-hq-brand-group">
|
|
188
|
+
<div className="wv-hq-brand-icon">
|
|
189
|
+
<Building2 size={18} />
|
|
190
|
+
</div>
|
|
191
|
+
<div>
|
|
192
|
+
<div className="wv-hq-brand-title-row">
|
|
193
|
+
<h1 className="wv-hq-brand-title">{world.name}</h1>
|
|
194
|
+
<span className="wv-hq-badge">Universal 3D</span>
|
|
195
|
+
</div>
|
|
196
|
+
<p className="wv-hq-brand-desc">Yapay Zeka Destekli Sanal Karargah</p>
|
|
197
|
+
</div>
|
|
198
|
+
</div>
|
|
199
|
+
|
|
200
|
+
<div className="wv-hq-stats-row">
|
|
201
|
+
<span className="wv-hq-stat-pill is-green">
|
|
202
|
+
<span className="wv-hq-pip" />
|
|
203
|
+
{world.entities.length} / 17 Masa Dolu
|
|
204
|
+
</span>
|
|
205
|
+
{activeWorkersCount > 0 && (
|
|
206
|
+
<span className="wv-hq-stat-pill is-purple">
|
|
207
|
+
<Zap size={12} />
|
|
208
|
+
{activeWorkersCount} Görevde
|
|
209
|
+
</span>
|
|
210
|
+
)}
|
|
211
|
+
{pendingApprovalsCount > 0 && (
|
|
212
|
+
<span className="wv-hq-stat-pill is-amber">
|
|
213
|
+
<Clock size={12} />
|
|
214
|
+
{pendingApprovalsCount} Onay Bekliyor
|
|
215
|
+
</span>
|
|
216
|
+
)}
|
|
217
|
+
</div>
|
|
218
|
+
</div>
|
|
219
|
+
|
|
220
|
+
{/* Operational Mode Navigation Tabs */}
|
|
221
|
+
<div className="wv-hq-mode-tabs">
|
|
222
|
+
<button
|
|
223
|
+
type="button"
|
|
224
|
+
onClick={() => setActiveMode('office')}
|
|
225
|
+
className={`wv-hq-mode-tab ${activeMode === 'office' ? 'is-active' : ''}`}
|
|
226
|
+
>
|
|
227
|
+
<Compass size={14} color="#3b82f6" />
|
|
228
|
+
<span>Ofis Katı (3D)</span>
|
|
229
|
+
</button>
|
|
230
|
+
|
|
231
|
+
<button
|
|
232
|
+
type="button"
|
|
233
|
+
onClick={() => setActiveMode('operations')}
|
|
234
|
+
className={`wv-hq-mode-tab ${activeMode === 'operations' ? 'is-active' : ''}`}
|
|
235
|
+
>
|
|
236
|
+
<LayoutDashboard size={14} color="#06b6d4" />
|
|
237
|
+
<span>Operasyonlar</span>
|
|
238
|
+
{projects.length > 0 && (
|
|
239
|
+
<span className="wv-hq-tab-count">{projects.length}</span>
|
|
240
|
+
)}
|
|
241
|
+
</button>
|
|
242
|
+
|
|
243
|
+
<button
|
|
244
|
+
type="button"
|
|
245
|
+
onClick={() => setActiveMode('command_center')}
|
|
246
|
+
className={`wv-hq-mode-tab ${activeMode === 'command_center' ? 'is-active' : ''}`}
|
|
247
|
+
>
|
|
248
|
+
<Terminal size={14} color="#a855f7" />
|
|
249
|
+
<span>AI Komuta Merkezi</span>
|
|
250
|
+
{pendingApprovalsCount > 0 && (
|
|
251
|
+
<span className="wv-hq-tab-badge">{pendingApprovalsCount}</span>
|
|
252
|
+
)}
|
|
253
|
+
</button>
|
|
254
|
+
</div>
|
|
255
|
+
|
|
256
|
+
{/* Header Right Actions */}
|
|
257
|
+
<div className="wv-hq-header-right">
|
|
258
|
+
{onSeedSquad && world.entities.length < 17 && (
|
|
259
|
+
<button
|
|
260
|
+
type="button"
|
|
261
|
+
onClick={onSeedSquad}
|
|
262
|
+
disabled={isSeeding}
|
|
263
|
+
className="wv-hq-action-btn is-seed"
|
|
264
|
+
>
|
|
265
|
+
{isSeeding ? <Loader2 size={13} className="wv-spin" /> : <Sparkles size={13} />}
|
|
266
|
+
<span>Kadro Ekle (17)</span>
|
|
267
|
+
</button>
|
|
268
|
+
)}
|
|
269
|
+
|
|
270
|
+
{activeMode === 'office' && (
|
|
271
|
+
<button
|
|
272
|
+
type="button"
|
|
273
|
+
onClick={handleToggleRoster}
|
|
274
|
+
className={`wv-hq-action-btn ${showRoster ? 'is-active' : ''}`}
|
|
275
|
+
title={showRoster ? 'Kadro Panelini Gizle' : 'Kadro Panelini Aç'}
|
|
276
|
+
>
|
|
277
|
+
{showRoster ? <PanelRightClose size={15} /> : <PanelRightOpen size={15} />}
|
|
278
|
+
<span className="wv-hide-mobile">Kadro Paneli</span>
|
|
279
|
+
</button>
|
|
280
|
+
)}
|
|
281
|
+
|
|
282
|
+
{!standalone ? (
|
|
283
|
+
<a
|
|
284
|
+
href={standaloneUrl}
|
|
285
|
+
target="_blank"
|
|
286
|
+
rel="noreferrer"
|
|
287
|
+
className="wv-hq-action-btn"
|
|
288
|
+
title="Tam Ekran Bağımsız Sayfada Aç"
|
|
289
|
+
>
|
|
290
|
+
<ExternalLink size={14} />
|
|
291
|
+
<span className="wv-hide-mobile">Ayrı Sayfada Aç</span>
|
|
292
|
+
</a>
|
|
293
|
+
) : (
|
|
294
|
+
<a
|
|
295
|
+
href={returnUrl}
|
|
296
|
+
className="wv-hq-action-btn"
|
|
297
|
+
title="Dashboard'a Dön"
|
|
298
|
+
>
|
|
299
|
+
<ArrowRight size={14} style={{ transform: 'rotate(180deg)' }} />
|
|
300
|
+
<span className="wv-hide-mobile">Dashboard</span>
|
|
301
|
+
</a>
|
|
302
|
+
)}
|
|
303
|
+
|
|
304
|
+
<button
|
|
305
|
+
type="button"
|
|
306
|
+
onClick={handleToggleFullscreen}
|
|
307
|
+
className="wv-hq-icon-btn"
|
|
308
|
+
title={isFullscreen ? 'Tam Ekrandan Çık' : 'Tam Ekran'}
|
|
309
|
+
>
|
|
310
|
+
{isFullscreen ? <Minimize2 size={15} /> : <Maximize2 size={15} />}
|
|
311
|
+
</button>
|
|
312
|
+
|
|
313
|
+
{onRefresh && (
|
|
314
|
+
<button
|
|
315
|
+
type="button"
|
|
316
|
+
onClick={onRefresh}
|
|
317
|
+
disabled={refreshing}
|
|
318
|
+
className="wv-hq-icon-btn"
|
|
319
|
+
title="Verileri Yenile"
|
|
320
|
+
>
|
|
321
|
+
<RefreshCw size={15} className={refreshing ? 'wv-spin' : ''} />
|
|
322
|
+
</button>
|
|
323
|
+
)}
|
|
324
|
+
</div>
|
|
325
|
+
</header>
|
|
326
|
+
|
|
327
|
+
{/* 2. Main Content Viewport */}
|
|
328
|
+
<div className="wv-hq-main-viewport">
|
|
329
|
+
{/* ========================================================== */}
|
|
330
|
+
{/* MODE 1: 3D VIRTUAL WORLD VIEW */}
|
|
331
|
+
{/* ========================================================== */}
|
|
332
|
+
{activeMode === 'office' && (
|
|
333
|
+
<div className="wv-hq-office-layout">
|
|
334
|
+
<div className="wv-hq-canvas-wrapper">
|
|
335
|
+
{loading && (
|
|
336
|
+
<div className="wv-hq-loading-overlay">
|
|
337
|
+
<Loader2 size={32} className="wv-spin" color="#3b82f6" />
|
|
338
|
+
<p>3D Dijital Ofis Katı Yükleniyor...</p>
|
|
339
|
+
</div>
|
|
340
|
+
)}
|
|
341
|
+
|
|
342
|
+
{/* Navigation Hint */}
|
|
343
|
+
<div className="wv-hq-nav-hint">
|
|
344
|
+
<Compass size={14} color="#3b82f6" />
|
|
345
|
+
<span>3D Masaya Tıkla: Bilgiler Açılır • Sol Tık: Çevir • Sağ Tık: Kaydır • Tekerlek: Yakınlaş</span>
|
|
346
|
+
</div>
|
|
347
|
+
|
|
348
|
+
{/* 3D Viewport */}
|
|
349
|
+
<VirtualWorld
|
|
350
|
+
ref={virtualWorldRef}
|
|
351
|
+
world={world}
|
|
352
|
+
preset={preset}
|
|
353
|
+
selectedEntityId={activeEntity?.id}
|
|
354
|
+
onSelectEntity={handleSelect}
|
|
355
|
+
defaultPinMode="pins"
|
|
356
|
+
showControls={true}
|
|
357
|
+
showInspector={false}
|
|
358
|
+
>
|
|
359
|
+
{/* Floating Bottom Command Bar Overlay */}
|
|
360
|
+
<VirtualCommandBar
|
|
361
|
+
presetMissions={presetMissions}
|
|
362
|
+
entities={world.entities}
|
|
363
|
+
targetEntityId={targetId}
|
|
364
|
+
onChangeTarget={setTargetId}
|
|
365
|
+
prompt={promptText}
|
|
366
|
+
onChangePrompt={setPromptText}
|
|
367
|
+
onDispatch={handleDispatch}
|
|
368
|
+
isDemoMode={isDemoMode}
|
|
369
|
+
onToggleDemoMode={() => setIsDemoMode(!isDemoMode)}
|
|
370
|
+
isLaunching={isLaunching}
|
|
371
|
+
/>
|
|
372
|
+
</VirtualWorld>
|
|
373
|
+
</div>
|
|
374
|
+
|
|
375
|
+
{/* Collapsible Roster Sidebar */}
|
|
376
|
+
{showRoster && (
|
|
377
|
+
<VirtualRoster
|
|
378
|
+
entities={world.entities}
|
|
379
|
+
departments={departments}
|
|
380
|
+
selectedEntityId={activeEntity?.id}
|
|
381
|
+
onSelectEntity={(id) => {
|
|
382
|
+
const en = world.entities.find((e) => e.id === id) || null
|
|
383
|
+
handleSelect(en)
|
|
384
|
+
}}
|
|
385
|
+
onClose={handleToggleRoster}
|
|
386
|
+
searchQuery={rosterSearch}
|
|
387
|
+
onSearchChange={setRosterSearch}
|
|
388
|
+
selectedCategory={selectedCategory}
|
|
389
|
+
onSelectCategory={setSelectedCategory}
|
|
390
|
+
/>
|
|
391
|
+
)}
|
|
392
|
+
|
|
393
|
+
{/* Selected Entity Profile Drawer */}
|
|
394
|
+
{activeEntity && (
|
|
395
|
+
<VirtualEntityDrawer
|
|
396
|
+
entity={activeEntity}
|
|
397
|
+
onClose={() => handleSelect(null)}
|
|
398
|
+
metrics={getEntityMetrics ? getEntityMetrics(activeEntity.id) : undefined}
|
|
399
|
+
latestTask={getEntityLatestTask ? getEntityLatestTask(activeEntity.id) : null}
|
|
400
|
+
onViewReport={() => {
|
|
401
|
+
const task = getEntityLatestTask ? getEntityLatestTask(activeEntity.id) : null
|
|
402
|
+
if (task) {
|
|
403
|
+
setViewingReport({
|
|
404
|
+
prompt: task.prompt,
|
|
405
|
+
summary: task.summary,
|
|
406
|
+
status: task.status,
|
|
407
|
+
})
|
|
408
|
+
}
|
|
409
|
+
}}
|
|
410
|
+
dispatchPrompt={targetId === activeEntity.id ? promptText : ''}
|
|
411
|
+
onChangeDispatchPrompt={(val) => {
|
|
412
|
+
setTargetId(activeEntity.id)
|
|
413
|
+
setPromptText(val)
|
|
414
|
+
}}
|
|
415
|
+
onDispatch={handleDispatch}
|
|
416
|
+
isDispatching={isLaunching}
|
|
417
|
+
/>
|
|
418
|
+
)}
|
|
419
|
+
</div>
|
|
420
|
+
)}
|
|
421
|
+
|
|
422
|
+
{/* ========================================================== */}
|
|
423
|
+
{/* MODE 2: OPERATIONS DASHBOARD */}
|
|
424
|
+
{/* ========================================================== */}
|
|
425
|
+
{activeMode === 'operations' && (
|
|
426
|
+
<div className="wv-hq-operations-view">
|
|
427
|
+
{/* Metrics Grid */}
|
|
428
|
+
<div className="wv-hq-ops-metrics-grid">
|
|
429
|
+
<div className="wv-hq-ops-metric-card">
|
|
430
|
+
<div className="wv-ops-metric-header">
|
|
431
|
+
<span>Toplam Proje</span>
|
|
432
|
+
<FolderKanban size={16} color="#3b82f6" />
|
|
433
|
+
</div>
|
|
434
|
+
<div className="wv-ops-metric-num">{projects.length}</div>
|
|
435
|
+
<p className="wv-ops-metric-sub">Aktif iş geliştirme portföyü</p>
|
|
436
|
+
</div>
|
|
437
|
+
|
|
438
|
+
<div className="wv-hq-ops-metric-card">
|
|
439
|
+
<div className="wv-ops-metric-header">
|
|
440
|
+
<span>Departman Sayısı</span>
|
|
441
|
+
<Building2 size={16} color="#06b6d4" />
|
|
442
|
+
</div>
|
|
443
|
+
<div className="wv-ops-metric-num">{departments.length}</div>
|
|
444
|
+
<p className="wv-ops-metric-sub">Fonksiyonel çalışma hücresi</p>
|
|
445
|
+
</div>
|
|
446
|
+
|
|
447
|
+
<div className="wv-hq-ops-metric-card">
|
|
448
|
+
<div className="wv-ops-metric-header">
|
|
449
|
+
<span>Aktif Çalışan</span>
|
|
450
|
+
<Zap size={16} color="#a855f7" />
|
|
451
|
+
</div>
|
|
452
|
+
<div className="wv-ops-metric-num">{activeWorkersCount} / 17</div>
|
|
453
|
+
<p className="wv-ops-metric-sub">Masasında çalışan uzmanlar</p>
|
|
454
|
+
</div>
|
|
455
|
+
|
|
456
|
+
<div className="wv-hq-ops-metric-card">
|
|
457
|
+
<div className="wv-ops-metric-header">
|
|
458
|
+
<span>Onay Bekleyen</span>
|
|
459
|
+
<Clock size={16} color="#f59e0b" />
|
|
460
|
+
</div>
|
|
461
|
+
<div className="wv-ops-metric-num">{pendingApprovalsCount}</div>
|
|
462
|
+
<p className="wv-ops-metric-sub">Yönetici onayı bekleyen görevler</p>
|
|
463
|
+
</div>
|
|
464
|
+
</div>
|
|
465
|
+
|
|
466
|
+
{/* Department Hubs & Activity Timeline */}
|
|
467
|
+
<div className="wv-hq-ops-cols">
|
|
468
|
+
<div className="wv-hq-ops-dept-col">
|
|
469
|
+
<h2 className="wv-hq-section-heading">
|
|
470
|
+
<Building2 size={16} color="#3b82f6" />
|
|
471
|
+
<span>Departman Odaları & Masaları</span>
|
|
472
|
+
</h2>
|
|
473
|
+
|
|
474
|
+
<div className="wv-hq-dept-cards-grid">
|
|
475
|
+
{departments.map((dept) => {
|
|
476
|
+
const deptEntities = world.entities.filter((e) => dept.slotIds.includes(e.id))
|
|
477
|
+
const isDeptBusy = deptEntities.some((e) => e.status === 'running' || e.status === 'working')
|
|
478
|
+
|
|
479
|
+
return (
|
|
480
|
+
<div key={dept.id} className="wv-hq-dept-card">
|
|
481
|
+
<div>
|
|
482
|
+
<div className="wv-dept-card-top">
|
|
483
|
+
<span className="wv-dept-color-pip" style={{ backgroundColor: dept.color }} />
|
|
484
|
+
{isDeptBusy && <span className="wv-dept-busy-badge">⚡ Çalışıyor</span>}
|
|
485
|
+
</div>
|
|
486
|
+
<h3 className="wv-dept-name">{dept.name}</h3>
|
|
487
|
+
<p className="wv-dept-desc">{dept.description}</p>
|
|
488
|
+
</div>
|
|
489
|
+
|
|
490
|
+
<div className="wv-dept-card-bottom">
|
|
491
|
+
<span>{deptEntities.length} Masa</span>
|
|
492
|
+
<button
|
|
493
|
+
type="button"
|
|
494
|
+
onClick={() => {
|
|
495
|
+
setSelectedCategory(dept.slug)
|
|
496
|
+
setActiveMode('office')
|
|
497
|
+
}}
|
|
498
|
+
className="wv-dept-link-btn"
|
|
499
|
+
>
|
|
500
|
+
<span>Odaya Git</span>
|
|
501
|
+
<ArrowRight size={13} />
|
|
502
|
+
</button>
|
|
503
|
+
</div>
|
|
504
|
+
</div>
|
|
505
|
+
)
|
|
506
|
+
})}
|
|
507
|
+
</div>
|
|
508
|
+
</div>
|
|
509
|
+
|
|
510
|
+
{/* Activity Timeline */}
|
|
511
|
+
<div className="wv-hq-ops-act-col">
|
|
512
|
+
<h2 className="wv-hq-section-heading">
|
|
513
|
+
<Activity size={16} color="#3b82f6" />
|
|
514
|
+
<span>Sistem Aktivite Akışı</span>
|
|
515
|
+
</h2>
|
|
516
|
+
|
|
517
|
+
<div className="wv-hq-act-box">
|
|
518
|
+
{activities.length === 0 ? (
|
|
519
|
+
<div className="wv-hq-empty-act">
|
|
520
|
+
<Clock size={24} style={{ opacity: 0.4, margin: '0 auto 8px' }} />
|
|
521
|
+
<p>Kayıtlı sistem aktivitesi bulunmuyor.</p>
|
|
522
|
+
</div>
|
|
523
|
+
) : (
|
|
524
|
+
activities.slice(0, 8).map((act) => (
|
|
525
|
+
<div key={act.id} className="wv-hq-act-item">
|
|
526
|
+
<span className="wv-act-pip" />
|
|
527
|
+
<div className="wv-act-content">
|
|
528
|
+
<p className="wv-act-title">{act.title}</p>
|
|
529
|
+
{act.description && <p className="wv-act-desc">{act.description}</p>}
|
|
530
|
+
<span className="wv-act-time">
|
|
531
|
+
{new Date(act.createdAt).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })}
|
|
532
|
+
</span>
|
|
533
|
+
</div>
|
|
534
|
+
</div>
|
|
535
|
+
))
|
|
536
|
+
)}
|
|
537
|
+
</div>
|
|
538
|
+
</div>
|
|
539
|
+
</div>
|
|
540
|
+
</div>
|
|
541
|
+
)}
|
|
542
|
+
|
|
543
|
+
{/* ========================================================== */}
|
|
544
|
+
{/* MODE 3: AI COMMAND CENTER */}
|
|
545
|
+
{/* ========================================================== */}
|
|
546
|
+
{activeMode === 'command_center' && (
|
|
547
|
+
<div className="wv-hq-command-view">
|
|
548
|
+
<div className="wv-hq-command-center-box">
|
|
549
|
+
{/* Mission Header Card */}
|
|
550
|
+
<div className="wv-hq-dispatch-card">
|
|
551
|
+
<div className="wv-dispatch-header-row">
|
|
552
|
+
<div className="wv-dispatch-icon-badge">
|
|
553
|
+
<Terminal size={20} />
|
|
554
|
+
</div>
|
|
555
|
+
<div>
|
|
556
|
+
<h2 className="wv-dispatch-title">Yapay Zeka Komuta ve Orkestrasyon</h2>
|
|
557
|
+
<p className="wv-dispatch-sub">
|
|
558
|
+
Genel Müdürlük üzerinden tüm departman çalışanlarına otomatik görev dağıtımı yapın.
|
|
559
|
+
</p>
|
|
560
|
+
</div>
|
|
561
|
+
</div>
|
|
562
|
+
|
|
563
|
+
<div className="wv-dispatch-input-area">
|
|
564
|
+
<textarea
|
|
565
|
+
value={promptText}
|
|
566
|
+
onChange={(e) => setPromptText(e.target.value)}
|
|
567
|
+
rows={3}
|
|
568
|
+
placeholder="Şirket hedefinizi veya karmaşık projenizi yazın... (Örn: Yeni dijital pazarlama kampanyası için strateji, görsel briefler ve bütçe planını oluştur)"
|
|
569
|
+
className="wv-dispatch-textarea"
|
|
570
|
+
/>
|
|
571
|
+
<div className="wv-dispatch-actions-row">
|
|
572
|
+
<button
|
|
573
|
+
type="button"
|
|
574
|
+
onClick={() => setIsDemoMode(!isDemoMode)}
|
|
575
|
+
className={`wv-demo-toggle-btn ${isDemoMode ? 'is-demo' : 'is-ai'}`}
|
|
576
|
+
>
|
|
577
|
+
{isDemoMode ? <Sparkles size={14} /> : <Bot size={14} />}
|
|
578
|
+
<span>{isDemoMode ? 'Demo Hızlı Simülasyon' : 'Gerçek LLM API'}</span>
|
|
579
|
+
</button>
|
|
580
|
+
|
|
581
|
+
<button
|
|
582
|
+
type="button"
|
|
583
|
+
onClick={handleDispatch}
|
|
584
|
+
disabled={isLaunching || !promptText.trim()}
|
|
585
|
+
className="wv-dispatch-submit-big-btn"
|
|
586
|
+
>
|
|
587
|
+
{isLaunching ? <Loader2 size={16} className="wv-spin" /> : <Send size={15} />}
|
|
588
|
+
<span>Orkestrasyonu Başlat</span>
|
|
589
|
+
</button>
|
|
590
|
+
</div>
|
|
591
|
+
</div>
|
|
592
|
+
</div>
|
|
593
|
+
|
|
594
|
+
{/* Tasks Review Feed */}
|
|
595
|
+
<div className="wv-hq-review-section">
|
|
596
|
+
<h3 className="wv-hq-section-heading">
|
|
597
|
+
<Clock size={16} color="#f59e0b" />
|
|
598
|
+
<span>Onay ve Denetim Bekleyen Görevler</span>
|
|
599
|
+
</h3>
|
|
600
|
+
|
|
601
|
+
<div className="wv-hq-review-feed">
|
|
602
|
+
{world.entities.filter((e) => getEntityLatestTask && getEntityLatestTask(e.id)).length === 0 ? (
|
|
603
|
+
<div className="wv-hq-empty-feed">
|
|
604
|
+
Henüz tamamlanan veya onay bekleyen bir görev bulunmuyor.
|
|
605
|
+
</div>
|
|
606
|
+
) : (
|
|
607
|
+
world.entities
|
|
608
|
+
.filter((e) => getEntityLatestTask && getEntityLatestTask(e.id))
|
|
609
|
+
.map((entity) => {
|
|
610
|
+
const task = getEntityLatestTask!(entity.id)!
|
|
611
|
+
return (
|
|
612
|
+
<div key={entity.id} className="wv-hq-review-card">
|
|
613
|
+
<div className="wv-review-info">
|
|
614
|
+
<div className="wv-review-name-row">
|
|
615
|
+
<span className="wv-review-entity-name">
|
|
616
|
+
#{entity.pinNumber || '•'} {entity.name}
|
|
617
|
+
</span>
|
|
618
|
+
<span className={`wv-drawer-status-chip ${task.status === 'running' ? 'is-running' : 'is-idle'}`}>
|
|
619
|
+
{task.status || entity.status}
|
|
620
|
+
</span>
|
|
621
|
+
</div>
|
|
622
|
+
<p className="wv-review-prompt">{task.prompt}</p>
|
|
623
|
+
</div>
|
|
624
|
+
|
|
625
|
+
<button
|
|
626
|
+
type="button"
|
|
627
|
+
onClick={() => {
|
|
628
|
+
setViewingReport({
|
|
629
|
+
prompt: task.prompt,
|
|
630
|
+
summary: task.summary,
|
|
631
|
+
status: task.status,
|
|
632
|
+
})
|
|
633
|
+
}}
|
|
634
|
+
className="wv-review-view-btn"
|
|
635
|
+
>
|
|
636
|
+
<Eye size={14} />
|
|
637
|
+
<span>Raporu Gör</span>
|
|
638
|
+
</button>
|
|
639
|
+
</div>
|
|
640
|
+
)
|
|
641
|
+
})
|
|
642
|
+
)}
|
|
643
|
+
</div>
|
|
644
|
+
</div>
|
|
645
|
+
</div>
|
|
646
|
+
</div>
|
|
647
|
+
)}
|
|
648
|
+
</div>
|
|
649
|
+
|
|
650
|
+
{/* 3. Report Modal */}
|
|
651
|
+
{viewingReport && (
|
|
652
|
+
<VirtualReportModal
|
|
653
|
+
report={viewingReport}
|
|
654
|
+
onClose={() => setViewingReport(null)}
|
|
655
|
+
/>
|
|
656
|
+
)}
|
|
657
|
+
</div>
|
|
658
|
+
)
|
|
659
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ReactNode, useEffect } from 'react'
|
|
2
|
-
import { X, Focus
|
|
2
|
+
import { X, Focus } from 'lucide-react'
|
|
3
3
|
import type { WorldEntity } from '../core/types'
|
|
4
4
|
|
|
5
5
|
export interface EntityInspectorProps {
|
|
@@ -27,7 +27,6 @@ export function EntityInspector({
|
|
|
27
27
|
|
|
28
28
|
if (!entity) return null
|
|
29
29
|
|
|
30
|
-
const isPerson = entity.type === 'person' || entity.type === 'actor'
|
|
31
30
|
const isRunning = entity.status === 'running' || entity.status === 'working'
|
|
32
31
|
|
|
33
32
|
return (
|