Skip to content

Commit 2f3d493

Browse files
committed
New badge
1 parent 09feb4c commit 2f3d493

File tree

1 file changed

+27
-9
lines changed

1 file changed

+27
-9
lines changed

web/src/app/agents/page.tsx

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,14 @@ const AgentStorePage = () => {
134134
return count.toString()
135135
}
136136

137+
const isNewAgent = (createdAt: string) => {
138+
const now = new Date()
139+
const created = new Date(createdAt)
140+
const timeDiff = now.getTime() - created.getTime()
141+
const hoursDiff = timeDiff / (1000 * 3600)
142+
return hoursDiff <= 24
143+
}
144+
137145
const AgentCard = ({
138146
agent,
139147
isEditorsChoice = false,
@@ -196,15 +204,25 @@ const AgentStorePage = () => {
196204
{formatRelativeTime(agent.last_used)}
197205
</span>
198206
)}
199-
{isEditorsChoice && (
200-
<Badge
201-
variant="default"
202-
className="text-xs px-1.5 py-0 bg-amber-500 text-amber-950 hover:bg-amber-600 shrink-0"
203-
>
204-
<Star className="h-3 w-3 mr-1" />
205-
Editor's Choice
206-
</Badge>
207-
)}
207+
<div className="flex items-center gap-2">
208+
{isNewAgent(agent.created_at) && (
209+
<Badge
210+
variant="default"
211+
className="text-xs px-1.5 py-0 bg-emerald-500 text-emerald-950 hover:bg-emerald-600 shrink-0"
212+
>
213+
New
214+
</Badge>
215+
)}
216+
{isEditorsChoice && (
217+
<Badge
218+
variant="default"
219+
className="text-xs px-1.5 py-0 bg-amber-500 text-amber-950 hover:bg-amber-600 shrink-0"
220+
>
221+
<Star className="h-3 w-3 mr-1" />
222+
Editor's Choice
223+
</Badge>
224+
)}
225+
</div>
208226
</div>
209227
</div>
210228
</CardHeader>

0 commit comments

Comments
 (0)