Skip to content

Commit abcd1c8

Browse files
committed
popup live activity changes
1 parent e749b80 commit abcd1c8

3 files changed

Lines changed: 78 additions & 8 deletions

File tree

src/components/MockTerminal/MockTerminal.css

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,35 @@
104104
background: #37d67a;
105105
}
106106

107+
.mock-terminal__prompt-line {
108+
cursor: pointer;
109+
outline: none;
110+
border-radius: 6px;
111+
}
112+
113+
.mock-terminal__prompt-line:focus-visible {
114+
box-shadow: 0 0 0 2px rgba(47, 191, 113, 0.5);
115+
}
116+
117+
.mock-terminal__hint {
118+
font-size: 11.5px;
119+
font-style: italic;
120+
color: rgba(55, 65, 70, 0.4);
121+
transition: color 0.2s ease;
122+
}
123+
124+
[data-theme="dark"] .mock-terminal__hint {
125+
color: rgba(244, 246, 243, 0.35);
126+
}
127+
128+
.mock-terminal__prompt-line:hover .mock-terminal__hint {
129+
color: rgba(55, 65, 70, 0.65);
130+
}
131+
132+
[data-theme="dark"] .mock-terminal__prompt-line:hover .mock-terminal__hint {
133+
color: rgba(244, 246, 243, 0.6);
134+
}
135+
107136
@keyframes mock-terminal-blink {
108137
0%,
109138
100% {

src/components/MockTerminal/index.tsx

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
import React from "react";
22
import "./MockTerminal.css";
33

4-
const MockTerminal: React.FC = () => {
4+
interface MockTerminalProps {
5+
onPromptClick?: () => void;
6+
}
7+
8+
const MockTerminal: React.FC<MockTerminalProps> = ({ onPromptClick }) => {
59
return (
6-
<div className="mock-terminal" aria-hidden="true">
10+
<div className="mock-terminal">
711
<div className="mock-terminal__titlebar">
812
<span className="mock-terminal__dot mock-terminal__dot--red" />
913
<span className="mock-terminal__dot mock-terminal__dot--yellow" />
@@ -35,9 +39,24 @@ const MockTerminal: React.FC = () => {
3539
</span>
3640
</div>
3741
<div className="mock-terminal__out">→ sponsored: ₹500 this week</div>
38-
<div>
42+
<div
43+
className="mock-terminal__prompt-line"
44+
role="button"
45+
tabIndex={0}
46+
aria-label="Open live user activity"
47+
onClick={onPromptClick}
48+
onKeyDown={(e) => {
49+
if (e.key === "Enter" || e.key === " ") {
50+
e.preventDefault();
51+
onPromptClick?.();
52+
}
53+
}}
54+
>
3955
<span className="mock-terminal__prompt">$</span>{" "}
40-
<span className="mock-terminal__cursor" />
56+
<span className="mock-terminal__cursor" />{" "}
57+
<span className="mock-terminal__hint">
58+
click to see live user activity
59+
</span>
4160
</div>
4261
</div>
4362
</div>

src/components/header/header.tsx

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useState } from "react";
1+
import React, { useState, useEffect, useRef } from "react";
22
import "./header.css";
33
import Link from "@docusaurus/Link";
44
import { motion } from "framer-motion";
@@ -123,7 +123,29 @@ const HeaderContent = () => {
123123
};
124124

125125
const HeaderToaster = () => {
126-
const [showActivity, setShowActivity] = useState(true);
126+
// Terminal shows first; Live Activity auto-opens after 10s (or on prompt click)
127+
const [showActivity, setShowActivity] = useState(false);
128+
const autoOpenTimerRef = useRef<NodeJS.Timeout | null>(null);
129+
130+
useEffect(() => {
131+
autoOpenTimerRef.current = setTimeout(() => {
132+
setShowActivity(true);
133+
}, 10000);
134+
135+
return () => {
136+
if (autoOpenTimerRef.current) {
137+
clearTimeout(autoOpenTimerRef.current);
138+
}
139+
};
140+
}, []);
141+
142+
const openActivity = () => {
143+
if (autoOpenTimerRef.current) {
144+
clearTimeout(autoOpenTimerRef.current);
145+
autoOpenTimerRef.current = null;
146+
}
147+
setShowActivity(true);
148+
};
127149

128150
return (
129151
<motion.div
@@ -146,7 +168,7 @@ const HeaderToaster = () => {
146168
width: "100%",
147169
}}
148170
>
149-
{/* Live Activity by default; mock terminal takes its place once closed */}
171+
{/* Mock terminal by default; Live Activity opens after 10s or on prompt click */}
150172
<div
151173
style={{
152174
position: "relative",
@@ -164,7 +186,7 @@ const HeaderToaster = () => {
164186
animate={{ opacity: 1, scale: 1 }}
165187
transition={{ duration: 0.5, ease: [0.4, 0, 0.2, 1] }}
166188
>
167-
<MockTerminal />
189+
<MockTerminal onPromptClick={openActivity} />
168190
</motion.div>
169191
)}
170192
</div>

0 commit comments

Comments
 (0)