-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.tsx
More file actions
208 lines (190 loc) · 6.12 KB
/
App.tsx
File metadata and controls
208 lines (190 loc) · 6.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
import React, { useState, useEffect } from 'react';
import { useVanish } from './hooks/useVanish';
import { AppView } from './types';
import { ActiveTasks } from './components/ActiveTasks';
import { TargetEngaged } from './components/TargetEngaged';
import { ExpiredNotice } from './components/ExpiredNotice';
import { DestructSequence } from './components/DestructSequence';
import { DestructedTerminal } from './components/DestructedTerminal';
import { StatsOverlay } from './components/StatsOverlay';
import { Onboarding } from './components/Onboarding';
import { IncomingCall } from './components/IncomingCall';
import { StealthMode } from './components/StealthMode';
import { IncomingDirectiveModal } from './components/IncomingDirectiveModal';
import { GlobalWipeSequence } from './components/GlobalWipeSequence';
import { LandingPage } from './components/LandingPage';
const App: React.FC = () => {
const {
view,
tasks,
stats,
expiredCount,
completedSessionCount,
isConnected,
activeNodes,
networkIp,
authoritativeHostUrl,
joinIpUrl,
manualIpError,
mutationsLocked,
coprocessor,
destructReason,
handlerMessage,
incomingCallText,
isDeployed,
activeTargetId,
syndicateMode,
squadIntegrity,
squadNodes,
incomingDirective,
globalWipeCulprit,
addTask,
completeTask,
deleteTask,
deployOperation,
engageTarget,
disengageTarget,
acknowledgeExpiry,
keepApp,
letItGo,
finishGlobalWipe,
manualPanic,
terminateServer,
enterOnboarding,
finishOnboarding,
acknowledgeCall,
setManualIp,
acceptDirective,
rejectDirective,
verifyKill,
denyKill
} = useVanish();
const [isStealth, setIsStealth] = useState(false);
// Stealth Mode / Boss Key Logic (Double Tap Escape)
useEffect(() => {
let lastEsc = 0;
const handleKeyDown = (e: KeyboardEvent) => {
if (e.key === 'Escape') {
const now = Date.now();
if (now - lastEsc < 400) {
setIsStealth(prev => !prev);
lastEsc = 0;
} else {
lastEsc = now;
}
}
};
window.addEventListener('keydown', handleKeyDown);
return () => window.removeEventListener('keydown', handleKeyDown);
}, []);
if (isStealth) {
return <StealthMode />;
}
if (view === AppView.LANDING) {
return <LandingPage onEnter={enterOnboarding} />;
}
if (view === AppView.IDENTIFY) {
return <Onboarding onComplete={finishOnboarding} />;
}
if (view === AppView.INCOMING_CALL) {
return <IncomingCall taskText={incomingCallText} onAcknowledge={acknowledgeCall} />;
}
if (view === AppView.INCOMING_DIRECTIVE && incomingDirective) {
return (
<IncomingDirectiveModal
task={incomingDirective}
onAccept={() => acceptDirective(incomingDirective)}
onReject={() => rejectDirective(incomingDirective)}
/>
);
}
if (view === AppView.GLOBAL_WIPE) {
return (
<GlobalWipeSequence
culprit={globalWipeCulprit}
onComplete={finishGlobalWipe}
/>
);
}
if (view === AppView.ENGAGED && activeTargetId) {
const targetTask = tasks.find(t => t.id === activeTargetId);
if (targetTask) {
return (
<TargetEngaged
task={targetTask}
onComplete={completeTask}
onAbort={disengageTarget}
/>
);
}
}
if (view === AppView.DESTRUCTED) {
return <DestructedTerminal reason={destructReason} terminateServer={terminateServer} />;
}
return (
<div className="min-h-screen bg-[#050505] text-gray-200 py-4 md:py-8 lg:py-12 px-4 sm:px-8 md:px-12 lg:px-20 flex justify-center">
<div className="w-full max-w-3xl md:max-w-4xl lg:max-w-5xl xl:max-w-7xl flex flex-col min-h-full transition-all duration-700 ease-in-out">
<main className="flex-grow flex flex-col w-full">
{view === AppView.TASKS && (
<ActiveTasks
tasks={tasks}
isConnected={isConnected}
activeNodes={activeNodes}
networkIp={networkIp}
authoritativeHostUrl={authoritativeHostUrl}
joinIpUrl={joinIpUrl}
manualIpError={manualIpError}
mutationsLocked={mutationsLocked}
coprocessor={coprocessor}
handlerMessage={handlerMessage}
isDeployed={isDeployed}
syndicateMode={syndicateMode}
squadIntegrity={squadIntegrity}
squadNodes={squadNodes}
onAddTask={addTask}
onCompleteTask={completeTask}
onDeleteTask={deleteTask}
onDeploy={deployOperation}
onEngage={engageTarget}
onPanic={manualPanic}
onSetManualIp={setManualIp}
verifyKill={verifyKill}
denyKill={denyKill}
/>
)}
{view === AppView.EXPIRED_NOTICE && (
<ExpiredNotice count={expiredCount} onAcknowledge={acknowledgeExpiry} />
)}
{view === AppView.DESTRUCTING && (
<DestructSequence
completedCount={completedSessionCount}
reason={destructReason}
onKeep={keepApp}
onDestruct={letItGo}
/>
)}
</main>
{view === AppView.TASKS && <StatsOverlay stats={stats} />}
</div>
{/* Global CSS overrides for animations specific to app states */}
<style>{`
@keyframes fadeIn {
from { opacity: 0; transform: translateY(10px); }
to { opacity: 1; transform: translateY(0); }
}
.animate-fade-in {
animation: fadeIn 0.5s ease-out forwards;
}
@keyframes completedDrop {
0% { transform: scale(0.97) translateX(-10px); opacity: 0; filter: blur(3px); color: #ef4444; }
40% { color: #dc2626; opacity: 1; }
100% { transform: scale(1) translateX(0); opacity: 0.7; filter: blur(0); }
}
.animate-completed-drop {
animation: completedDrop 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
`}</style>
</div>
);
};
export default App;