Skip to content

Commit 416154d

Browse files
author
prasanth_j
committed
Show copied state for MAXC env
1 parent 7b4eb61 commit 416154d

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

‎maxc_desktop/src/App.tsx‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
Bell,
1313
ChevronDown,
1414
ChevronRight,
15+
Check,
1516
FolderOpen,
1617
GitBranch,
1718
Keyboard,
@@ -202,6 +203,7 @@ function App() {
202203
downloaded: 0,
203204
total: undefined,
204205
});
206+
const [envCopied, setEnvCopied] = useState(false);
205207

206208
// -- shortcut help --
207209
const [showShortcuts, setShowShortcuts] = useState(false);
@@ -2068,7 +2070,8 @@ function App() {
20682070
async function copyEnvBlock() {
20692071
try {
20702072
await navigator.clipboard.writeText(envBlock);
2071-
setBackendStatus("Copied MAXC env to clipboard");
2073+
setEnvCopied(true);
2074+
window.setTimeout(() => setEnvCopied(false), 2000);
20722075
} catch {
20732076
setBackendStatus("Failed to copy env");
20742077
}
@@ -2239,7 +2242,14 @@ function App() {
22392242
MAXC Environment
22402243
</span>
22412244
<Button variant="outline" size="sm" className="h-7 px-2" onClick={copyEnvBlock}>
2242-
Copy
2245+
{envCopied ? (
2246+
<span className="inline-flex items-center gap-1">
2247+
<Check className="size-3.5" />
2248+
Copied
2249+
</span>
2250+
) : (
2251+
"Copy"
2252+
)}
22432253
</Button>
22442254
</div>
22452255
<pre className="whitespace-pre-wrap break-words rounded-md border bg-muted px-3 py-2 text-[11px] text-muted-foreground">

0 commit comments

Comments
 (0)