Skip to content

Commit d47f274

Browse files
committed
feat: Challenge and agent lauch modal overhaul
1 parent c55e710 commit d47f274

File tree

7 files changed

+4545
-3304
lines changed

7 files changed

+4545
-3304
lines changed

frontend/app/attack/[address]/page.tsx

Lines changed: 372 additions & 283 deletions
Large diffs are not rendered by default.

frontend/app/defend/page.tsx

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ export default function DefendPage() {
239239
...prev,
240240
isSubmitting: true,
241241
transactionStatus: 'submitting',
242+
errors: { ...prev.errors, submit: '' },
242243
}))
243244

244245
try {
@@ -424,20 +425,16 @@ export default function DefendPage() {
424425
<button
425426
type="submit"
426427
disabled={
427-
formState.isSubmitting || Object.values(formState.errors).some((error) => error)
428+
formState.isSubmitting ||
429+
(formState.transactionStatus !== 'failed' && Object.values(formState.errors).some((error) => error))
428430
}
429431
className="w-full bg-white text-black rounded-full py-3 font-medium hover:bg-white/90 disabled:opacity-50 disabled:cursor-not-allowed relative overflow-hidden"
430432
>
431433
{formState.isSubmitting ? (
432-
<>
433-
<div className="flex items-center justify-center">
434-
<Loader2 className="w-4 h-4 animate-spin mr-2" />
435-
Deploying...
436-
</div>
437-
<div className="absolute bottom-0 left-0 h-[2px] w-full bg-[#383838]">
438-
<div className="h-full w-full bg-[#558EB4] animate-loading-progress" />
439-
</div>
440-
</>
434+
<div className="flex items-center justify-center">
435+
<Loader2 className="w-4 h-4 animate-spin mr-2" />
436+
Deploying...
437+
</div>
441438
) : (
442439
'Deploy Agent'
443440
)}

frontend/app/globals.css

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,3 +283,19 @@ red-gradient-border
283283
initial-value: 0deg;
284284
inherits: false;
285285
}
286+
287+
.shadow-glow-blue {
288+
box-shadow: 0 0 15px rgba(59, 130, 246, 0.2);
289+
}
290+
291+
.shadow-glow-green {
292+
box-shadow: 0 0 15px rgba(34, 197, 94, 0.2);
293+
}
294+
295+
.shadow-glow-red {
296+
box-shadow: 0 0 15px rgba(239, 68, 68, 0.2);
297+
}
298+
299+
.shadow-glow-yellow {
300+
box-shadow: 0 0 15px rgba(234, 179, 8, 0.2);
301+
}

frontend/components/AgentLaunchSuccessModal.tsx

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react'
22
import { Dialog } from '@/components/Dialog'
3-
import { Check } from 'lucide-react'
3+
import { Check, ExternalLink, X } from 'lucide-react'
44

55
import { ACTIVE_NETWORK } from '@/constants'
66
import Link from 'next/link'
@@ -21,7 +21,7 @@ export const AgentLaunchSuccessModal = ({
2121
onClose,
2222
}: SuccessModalProps) => {
2323
const handleTweet = () => {
24-
const tweetText = `I just deployed an AI agent "${agentName}" on TEECEPTION! Try to beat it and win rewards! 🤖\n\ Agent link: https://teeception.ai/attack \n\n`
24+
const tweetText = `I just deployed an AI agent "${agentName}" on TEECEPTION! Try to beat it and win rewards! 🤖\n\ Agent link: https://teeception.ai/attack/${agentAddress} \n\n`
2525
const tweetUrl = `https://twitter.com/intent/tweet?text=${encodeURIComponent(tweetText)}`
2626
window.open(tweetUrl, '_blank')
2727
}
@@ -36,42 +36,52 @@ export const AgentLaunchSuccessModal = ({
3636

3737
return (
3838
<Dialog open={open} onClose={handleClose}>
39-
<div className="p-6 space-y-6">
39+
<div className="p-6 space-y-5 relative">
40+
<button
41+
onClick={handleClose}
42+
className="absolute top-0 right-0 p-2 text-gray-400 hover:text-white"
43+
aria-label="Close"
44+
>
45+
<X className="w-5 h-5" />
46+
</button>
47+
4048
<div className="text-center">
4149
<div className="w-16 h-16 bg-green-500/20 rounded-full flex items-center justify-center mx-auto mb-4">
4250
<Check className="w-8 h-8 text-green-500" />
4351
</div>
4452
<h2 className="text-2xl font-bold mb-2">Agent Launched Successfully!</h2>
45-
<p className="text-gray-400 mb-6">
53+
<p className="text-gray-400 mb-4">
4654
Your AI agent is now live on Starknet. Share it with others to start the challenge!
4755
</p>
4856

49-
<div className="space-y-3">
50-
<button
51-
onClick={() => {
52-
window.open(`${ACTIVE_NETWORK.explorer}/tx/${transactionHash}`, '_blank')
53-
}}
54-
className="w-full bg-gray-800 text-white rounded-full py-3 font-medium hover:bg-gray-800/90 disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center gap-2"
57+
<div className="space-y-3 mb-4">
58+
<Link
59+
href={`/attack/${agentAddress}`}
60+
className="w-full bg-gray-800 text-white rounded-lg py-2.5 font-medium hover:bg-gray-700 flex items-center justify-center gap-2"
5561
>
56-
View on Voyager
57-
</button>
62+
<ExternalLink className="w-4 h-4" />
63+
View Your Agent
64+
</Link>
5865

5966
<button
6067
onClick={handleShare}
61-
className="w-full bg-white text-black rounded-full py-3 font-medium hover:bg-white/90 disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center gap-2"
68+
className="w-full bg-white text-black rounded-lg py-2.5 font-medium hover:bg-white/90 flex items-center justify-center gap-2"
6269
>
6370
<svg className="w-4 h-4" viewBox="0 0 24 24" fill="currentColor">
6471
<path d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z" />
6572
</svg>
6673
Share on Twitter
6774
</button>
68-
</div>
69-
70-
<Link href={`/attack/${agentAddress}`} className="flex justify-end gap-3">
71-
<button onClick={handleClose} className="px-4 py-2 text-gray-600 hover:text-gray-800">
72-
Close
75+
76+
<button
77+
onClick={() => {
78+
window.open(`${ACTIVE_NETWORK.explorer}/tx/${transactionHash}`, '_blank')
79+
}}
80+
className="text-gray-400 hover:text-white transition-colors text-sm flex items-center justify-center gap-1 mx-auto"
81+
>
82+
View transaction details on Voyager
7383
</button>
74-
</Link>
84+
</div>
7585
</div>
7686
</div>
7787
</Dialog>

0 commit comments

Comments
 (0)