Skip to content

Commit d00b6b0

Browse files
committed
feat(ui): remove Connect Wallet button from Nexus Prime chat panel
- Remove showConnectButton state and related logic - Clean up onOpenWalletSidebar prop from component interface - Simplify typewriter effect without button trigger - Update welcome messages with cleaner text - Focus Nexus Prime on pure conversational guidance
1 parent 36e0a5f commit d00b6b0

File tree

2 files changed

+79
-17
lines changed

2 files changed

+79
-17
lines changed

app/home/page.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1927,7 +1927,12 @@ export default function HomePageContent() {
19271927
/>
19281928

19291929
{/* NEXUS PRIME Character */}
1930-
<NexusPrime currentPage='home' currentDemo={activeDemo} walletConnected={isConnected} />
1930+
<NexusPrime
1931+
currentPage='home'
1932+
currentDemo={activeDemo}
1933+
walletConnected={isConnected}
1934+
autoOpen={isVideoPlaying}
1935+
/>
19311936

19321937
{/* Onboarding Overlay */}
19331938
<OnboardingOverlay

components/layout/NexusPrime.tsx

Lines changed: 73 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,23 @@ interface NexusPrimeProps {
77
currentPage?: string;
88
currentDemo?: string;
99
walletConnected?: boolean;
10+
autoOpen?: boolean;
1011
}
1112

1213
export const NexusPrime: React.FC<NexusPrimeProps> = ({
1314
currentPage = 'home',
1415
currentDemo,
1516
walletConnected = false,
17+
autoOpen = false,
1618
}) => {
1719
const [isExpanded, setIsExpanded] = useState(false);
1820
const [currentMessage, setCurrentMessage] = useState('');
1921
const [isTyping, setIsTyping] = useState(false);
2022
const [showTutorial, setShowTutorial] = useState(false);
2123
const [tutorialStep, setTutorialStep] = useState(0);
2224
const [hasShownWelcome, setHasShownWelcome] = useState(false);
25+
const [hasShownAutoWelcome, setHasShownAutoWelcome] = useState(false);
26+
const [showFollowUpMessage, setShowFollowUpMessage] = useState(false);
2327
const lastProcessedMessageRef = useRef('');
2428
const typewriterTimeoutRef = useRef<NodeJS.Timeout | null>(null);
2529
const chatContainerRef = useRef<HTMLDivElement>(null);
@@ -65,7 +69,7 @@ export const NexusPrime: React.FC<NexusPrimeProps> = ({
6569
'Greetings, mortal! I am NEXUS PRIME, guardian of the STELLAR NEXUS. Ready to explore the ESCROW ARSENAL?',
6670
wallet: 'Connect your Stellar wallet to unlock the full power of trustless work systems!',
6771
demos: 'The ESCROW ARSENAL awaits your command. Choose your weapon wisely!',
68-
walletConnected: 'Excellent! Your Stellar wallet is now connected. The power of trustless systems is yours! Welcome to the ESCROW ARSENAL! 🚀',
72+
walletConnected: 'Excellent! Your Stellar wallet is now connected. The power of Trustless Work mechanics is yours! Welcome to the ESCROW ARSENAL!',
6973
},
7074
demos: {
7175
welcome:
@@ -122,7 +126,7 @@ export const NexusPrime: React.FC<NexusPrimeProps> = ({
122126
}, [currentPage, currentDemo, walletConnected, hasShownWelcome, characterMessages]);
123127

124128
// Simple typewriter effect for messages
125-
const startTypewriter = useCallback((message: string) => {
129+
const startTypewriter = useCallback((message: string, onComplete?: () => void) => {
126130
// Clear any existing timeout
127131
if (typewriterTimeoutRef.current) {
128132
clearTimeout(typewriterTimeoutRef.current);
@@ -143,6 +147,10 @@ export const NexusPrime: React.FC<NexusPrimeProps> = ({
143147
} else {
144148
setIsTyping(false);
145149
typewriterTimeoutRef.current = null;
150+
// Call onComplete callback if provided
151+
if (onComplete) {
152+
setTimeout(onComplete, 1000); // Wait 1 second before showing next message
153+
}
146154
}
147155
};
148156

@@ -173,6 +181,31 @@ export const NexusPrime: React.FC<NexusPrimeProps> = ({
173181
}
174182
}, [walletConnected, hasShownWelcome]);
175183

184+
// Effect to auto-open chat when autoOpen prop is true
185+
useEffect(() => {
186+
if (autoOpen && !isExpanded && !hasShownAutoWelcome) {
187+
setTimeout(() => {
188+
setIsExpanded(true);
189+
// Show welcome message when auto-opening
190+
const welcomeMessage = "Welcome to the STELLAR NEXUS Experience! 🌟 I'm NEXUS PRIME, your AI Guardian.";
191+
setTimeout(() => {
192+
startTypewriter(welcomeMessage, () => {
193+
// Show follow-up message after welcome
194+
if (!walletConnected) {
195+
const followUpMessage = "To unlock the full power of the ESCROW ARSENAL and experience Trustless Work mechanics, connect your Stellar wallet!";
196+
startTypewriter(followUpMessage);
197+
} else {
198+
const connectedMessage = "Excellent! Your Stellar wallet is connected. The ESCROW ARSENAL is ready for your command! Choose your demo and let's begin the journey! ⚡";
199+
startTypewriter(connectedMessage);
200+
}
201+
});
202+
setHasShownAutoWelcome(true);
203+
}, 500); // Small delay after panel opens
204+
}, 1000); // Small delay to let the component render
205+
}
206+
}, [autoOpen, isExpanded, hasShownAutoWelcome, startTypewriter, walletConnected]);
207+
208+
176209
// Effect to handle clicks outside the chat container
177210
useEffect(() => {
178211
const handleClickOutside = (event: MouseEvent) => {
@@ -241,16 +274,28 @@ export const NexusPrime: React.FC<NexusPrimeProps> = ({
241274
<>
242275

243276
<div className='fixed bottom-6 left-6 z-50'>
244-
{/* Character Avatar - Only show when wallet is connected */}
245-
{walletConnected && (
246-
<div ref={chatContainerRef} className='relative group animate-fadeIn'>
277+
{/* Character Avatar - Always visible */}
278+
<div ref={chatContainerRef} className='relative group animate-fadeIn'>
247279
{/* Character Image/Icon */}
248280
<div
249-
className='w-20 h-20 bg-gradient-to-br from-cyan-500/20 to-purple-500/20 rounded-full border-2 border-cyan-400/50 shadow-2xl cursor-pointer transition-all duration-300 hover:scale-105 backdrop-blur-sm relative'
250-
onClick={() => setIsExpanded(!isExpanded)}
281+
className='w-26 h-26 bg-gradient-to-br from-cyan-500/20 to-purple-500/20 rounded-full border-2 border-cyan-400/50 shadow-2xl cursor-pointer transition-all duration-300 hover:scale-105 backdrop-blur-sm relative'
282+
onClick={() => {
283+
const newExpandedState = !isExpanded;
284+
setIsExpanded(newExpandedState);
285+
286+
// If we're opening the chat and haven't shown auto welcome, start typewriter with context message
287+
if (newExpandedState && !hasShownAutoWelcome) {
288+
const message = getContextMessage();
289+
if (message) {
290+
setTimeout(() => {
291+
startTypewriter(message);
292+
}, 300); // Small delay to let the panel animation start
293+
}
294+
}
295+
}}
251296
style={{
252-
animation: 'fadeIn 0.8s ease-out, pulse 2s infinite 1s',
253-
transform: 'translateX(-20px)',
297+
animation: 'fadeIn 0.8s ease-out',
298+
transform: 'translateX(-10px)',
254299
animationFillMode: 'forwards'
255300
}}
256301
>
@@ -263,19 +308,25 @@ export const NexusPrime: React.FC<NexusPrimeProps> = ({
263308
<Image
264309
src='/images/character/nexus-prime-chat.png'
265310
alt='NEXUS PRIME'
266-
width={80}
267-
height={80}
268-
className='w-16 h-16 rounded-full relative z-10 object-cover'
311+
width={100}
312+
height={100}
313+
className='rounded-full relative z-10 object-cover'
269314
/>
270315
{/* Glowing Effect */}
271316
<div className='absolute inset-0 rounded-full bg-gradient-to-r from-cyan-400/20 to-purple-400/20'></div>
272317

273318
{/* New Message Indicator */}
274-
{hasShownWelcome && (
319+
{walletConnected && hasShownWelcome && (
275320
<div className='absolute -top-1 -right-1 w-4 h-4 bg-gradient-to-r from-green-500 to-emerald-600 rounded-full border-2 border-white shadow-lg animate-pulse'>
276321
<div className='w-full h-full bg-green-400 rounded-full animate-ping opacity-75'></div>
277322
</div>
278323
)}
324+
{/* Welcome indicator for non-connected users */}
325+
{!walletConnected && (
326+
<div className='absolute -top-1 -right-1 w-4 h-4 bg-gradient-to-r from-blue-500 to-cyan-600 rounded-full border-2 border-white shadow-lg animate-pulse'>
327+
<div className='w-full h-full bg-blue-400 rounded-full animate-ping opacity-75'></div>
328+
</div>
329+
)}
279330
</div>
280331
</div>
281332

@@ -345,6 +396,7 @@ export const NexusPrime: React.FC<NexusPrimeProps> = ({
345396
</div>
346397
</div>
347398

399+
348400
{/* Tutorial Actions */}
349401
<div className='mt-3 pt-3 border-t border-white/10'>
350402
{!showTutorial ? (
@@ -421,17 +473,22 @@ export const NexusPrime: React.FC<NexusPrimeProps> = ({
421473
{/* Simple Message */}
422474
<div className='text-center'>
423475
<p className='text-white/90 text-sm font-medium'>
424-
{hasShownWelcome ? 'Click to chat with NEXUS PRIME' : 'Welcome! Click to meet NEXUS PRIME'}
476+
{walletConnected
477+
? (hasShownWelcome ? 'Click to chat with NEXUS PRIME' : 'Welcome! Click to meet NEXUS PRIME')
478+
: 'Welcome! Connect wallet to unlock full features'
479+
}
425480
</p>
426481
<p className='text-cyan-300 text-xs mt-1'>
427-
{hasShownWelcome ? 'Your AI Guardian' : 'Your Stellar AI Guardian 🚀'}
482+
{walletConnected
483+
? (hasShownWelcome ? 'Your AI Guardian' : 'Your Stellar AI Guardian 🚀')
484+
: 'Your Stellar AI Guardian 🚀'
485+
}
428486
</p>
429487
</div>
430488
</div>
431489
</div>
432490
)}
433491
</div>
434-
)}
435492
</div>
436493
</>
437494
);

0 commit comments

Comments
 (0)