Skip to content

Commit 6efd049

Browse files
chriscrosstalkclaude
authored andcommitted
fix(benchmark): Add settings nav link, fix submission bug, improve UX
- Add Benchmark to Settings sidebar navigation - Fix Luxon DateTime bug when saving submission timestamp - Add privacy explanation text before Share button - Add error handling and display for failed submissions - Show "Submitting..." state and success confirmation - Add link to view leaderboard after successful submission Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 755807f commit 6efd049

File tree

3 files changed

+47
-11
lines changed

3 files changed

+47
-11
lines changed

admin/app/services/benchmark_service.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import Docker from 'dockerode'
55
import si from 'systeminformation'
66
import { v4 as uuidv4 } from 'uuid'
77
import axios from 'axios'
8+
import { DateTime } from 'luxon'
89
import BenchmarkResult from '#models/benchmark_result'
910
import BenchmarkSetting from '#models/benchmark_setting'
1011
import { SystemService } from '#services/system_service'
@@ -154,7 +155,7 @@ export class BenchmarkService {
154155

155156
if (response.data.success) {
156157
result.submitted_to_repository = true
157-
result.submitted_at = new Date() as any
158+
result.submitted_at = DateTime.now()
158159
result.repository_id = response.data.repository_id
159160
await result.save()
160161

admin/inertia/layouts/SettingsLayout.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import {
2+
ChartBarIcon,
23
Cog6ToothIcon,
34
CommandLineIcon,
45
FolderIcon,
@@ -16,6 +17,7 @@ import { getServiceLink } from '~/lib/navigation'
1617

1718
const navigation = [
1819
{ name: 'Apps', href: '/settings/apps', icon: CommandLineIcon, current: false },
20+
{ name: 'Benchmark', href: '/settings/benchmark', icon: ChartBarIcon, current: false },
1921
{ name: 'Legal Notices', href: '/settings/legal', icon: IconGavel, current: false },
2022
{ name: 'Maps Manager', href: '/settings/maps', icon: IconMapRoute, current: false },
2123
{ name: 'Models Manager', href: '/settings/models', icon: IconDatabaseStar, current: false },

admin/inertia/pages/settings/benchmark.tsx

Lines changed: 43 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -128,18 +128,27 @@ export default function BenchmarkPage(props: {
128128
})
129129

130130
// Submit to repository mutation
131+
const [submitError, setSubmitError] = useState<string | null>(null)
131132
const submitResult = useMutation({
132133
mutationFn: async (benchmarkId?: string) => {
134+
setSubmitError(null)
133135
const res = await fetch('/api/benchmark/submit', {
134136
method: 'POST',
135137
headers: { 'Content-Type': 'application/json' },
136138
body: JSON.stringify({ benchmark_id: benchmarkId }),
137139
})
138-
return res.json()
140+
const data = await res.json()
141+
if (!data.success) {
142+
throw new Error(data.error || 'Failed to submit benchmark')
143+
}
144+
return data
139145
},
140146
onSuccess: () => {
141147
refetchLatest()
142148
},
149+
onError: (error: Error) => {
150+
setSubmitError(error.message)
151+
},
143152
})
144153

145154
// Simulate progress during sync benchmark (since we don't get SSE updates)
@@ -336,21 +345,45 @@ export default function BenchmarkPage(props: {
336345
Your NOMAD Score is a weighted composite of all benchmark results.
337346
</p>
338347
{!latestResult.submitted_to_repository && (
339-
<StyledButton
340-
onClick={() => submitResult.mutate(latestResult.benchmark_id)}
341-
disabled={submitResult.isPending}
342-
leftIcon={<CloudArrowUpIcon className="w-5 h-5" />}
343-
>
344-
Share with Community
345-
</StyledButton>
348+
<div className="space-y-3">
349+
<p className="text-sm text-desert-stone-dark">
350+
Share your benchmark score anonymously with the NOMAD community. Only your hardware specs and scores are sent — no identifying information.
351+
</p>
352+
<StyledButton
353+
onClick={() => submitResult.mutate(latestResult.benchmark_id)}
354+
disabled={submitResult.isPending}
355+
leftIcon={<CloudArrowUpIcon className="w-5 h-5" />}
356+
>
357+
{submitResult.isPending ? 'Submitting...' : 'Share with Community'}
358+
</StyledButton>
359+
{submitError && (
360+
<Alert
361+
type="error"
362+
title="Submission Failed"
363+
message={submitError}
364+
variant="bordered"
365+
dismissible
366+
onDismiss={() => setSubmitError(null)}
367+
/>
368+
)}
369+
</div>
346370
)}
347371
{latestResult.submitted_to_repository && (
348372
<Alert
349373
type="success"
350374
title="Shared with Community"
351-
message={`Repository ID: ${latestResult.repository_id}`}
375+
message="Your benchmark has been submitted to the community leaderboard. Thanks for contributing!"
352376
variant="bordered"
353-
/>
377+
>
378+
<a
379+
href="https://benchmark.projectnomad.us"
380+
target="_blank"
381+
rel="noopener noreferrer"
382+
className="text-sm text-desert-green hover:underline mt-2 inline-block"
383+
>
384+
View the leaderboard →
385+
</a>
386+
</Alert>
354387
)}
355388
</div>
356389
</div>

0 commit comments

Comments
 (0)