rohanjaggi commited on
Commit
13d47e7
·
1 Parent(s): 18e54c4

fix: how we score card

Browse files
src/app/globals.css CHANGED
@@ -716,7 +716,7 @@ body {
716
  color: var(--text-3);
717
  }
718
 
719
- /* ─── Segmented toggle ───────────────────────────────────────── */
720
  .seg-toggle-wrap {
721
  display: flex;
722
  flex-direction: column;
@@ -759,6 +759,61 @@ body {
759
  transition: opacity 0.15s;
760
  }
761
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
762
  /* ─── Footer ──────────────────────────────────────────────────── */
763
  .footer-bar {
764
  background: var(--bg-1);
 
716
  color: var(--text-3);
717
  }
718
 
719
+ /* ─── Segmented toggle (legacy — kept for any other uses) ───── */
720
  .seg-toggle-wrap {
721
  display: flex;
722
  flex-direction: column;
 
759
  transition: opacity 0.15s;
760
  }
761
 
762
+ /* ─── Mode switcher (full-width page navigator) ──────────────── */
763
+ .mode-switcher {
764
+ display: grid;
765
+ grid-template-columns: 1fr 1fr;
766
+ border: 1.5px solid var(--border-1);
767
+ border-radius: 12px;
768
+ overflow: hidden;
769
+ background: var(--bg-1);
770
+ margin-bottom: 1.75rem;
771
+ }
772
+ .mode-switcher-tab {
773
+ position: relative;
774
+ padding: 1.5rem 2rem;
775
+ border: none;
776
+ cursor: pointer;
777
+ text-align: left;
778
+ transition: background 0.3s cubic-bezier(0.16, 1, 0.3, 1);
779
+ }
780
+ .mode-switcher-bar {
781
+ position: absolute;
782
+ top: 0; left: 0; right: 0;
783
+ height: 3px;
784
+ transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
785
+ }
786
+ .mode-switcher-dot {
787
+ width: 8px; height: 8px;
788
+ border-radius: 50%;
789
+ flex-shrink: 0;
790
+ transition: background 0.2s;
791
+ }
792
+ .mode-switcher-label {
793
+ font-size: 15px;
794
+ font-weight: 900;
795
+ letter-spacing: -0.01em;
796
+ transition: color 0.2s;
797
+ font-family: var(--font-lato), sans-serif;
798
+ }
799
+ .mode-switcher-subtitle {
800
+ font-size: 12px;
801
+ margin: 0;
802
+ line-height: 1.6;
803
+ transition: color 0.2s;
804
+ padding-left: 18px;
805
+ }
806
+ @media (max-width: 640px) {
807
+ .mode-switcher { grid-template-columns: 1fr; }
808
+ .mode-switcher-tab {
809
+ padding: 1.25rem 1.25rem;
810
+ }
811
+ .mode-switcher-tab:first-child {
812
+ border-right: none !important;
813
+ border-bottom: 1.5px solid var(--border-1);
814
+ }
815
+ }
816
+
817
  /* ─── Footer ──────────────────────────────────────────────────── */
818
  .footer-bar {
819
  background: var(--bg-1);
src/app/page.tsx CHANGED
@@ -24,7 +24,7 @@ export default function Home() {
24
  maxFairness={maxFairness}
25
  thresholds={thresholds}
26
  guardrailThresholds={guardrailThresholds}
27
- modelCount={models.filter(m => !m.archived).length}
28
  guardrailCount={guardrails.length}
29
  />
30
 
 
24
  maxFairness={maxFairness}
25
  thresholds={thresholds}
26
  guardrailThresholds={guardrailThresholds}
27
+ modelCount={models.length}
28
  guardrailCount={guardrails.length}
29
  />
30
 
src/components/AboutSection.tsx CHANGED
@@ -202,18 +202,33 @@ function Panel({
202
  return (
203
  <div style={{
204
  border: '1.5px solid var(--border-1)',
205
- borderLeft: `3px solid ${b.color}`,
206
  borderRadius: 10,
207
  background: 'var(--bg-1)',
208
  overflow: 'hidden',
 
209
  }}>
 
 
 
 
 
 
210
  {/* Static header */}
211
- <div style={{ display: 'flex', alignItems: 'flex-start', gap: '1rem', padding: '1.25rem 1.5rem' }}>
212
- <span style={{
213
- fontFamily: 'monospace', fontSize: 28, fontWeight: 400,
214
- color: b.color, opacity: 0.25, lineHeight: 1, flexShrink: 0,
215
- letterSpacing: '-0.04em',
216
- }}>{b.num}</span>
 
 
 
 
 
 
 
 
 
217
  <div style={{ flex: 1 }}>
218
  <div style={{ display: 'flex', alignItems: 'center', gap: 10, flexWrap: 'wrap' }}>
219
  <span style={{ fontSize: 14, fontWeight: 900, color: 'var(--text-0)' }}>{b.title}</span>
@@ -230,7 +245,7 @@ function Panel({
230
 
231
  {/* Score guide */}
232
  {thirds && (
233
- <div style={{ borderTop: '1px solid var(--border-0)', padding: '1rem 1.5rem 1rem calc(1.5rem + 28px + 1rem)' }}>
234
  <div style={{ fontSize: 11, fontWeight: 700, letterSpacing: '0.06em', textTransform: 'uppercase', color: 'var(--text-2)', marginBottom: 10 }}>
235
  Score guide <span style={{ color: b.color, fontWeight: 400, textTransform: 'none', letterSpacing: 0 }}>{b.dir}</span>
236
  </div>
@@ -271,7 +286,7 @@ function Panel({
271
  </svg>
272
  </button>
273
  {breakdownOpen && (
274
- <div style={{ padding: '0 1.5rem 1.25rem calc(1.5rem + 28px + 1rem)', display: 'grid', gridTemplateColumns: '1fr 1fr', gap: '1rem 1.5rem' }}>
275
  {b.breakdowns.map(bd => (
276
  <div key={bd.label}>
277
  <div style={{ marginBottom: 5 }}>
@@ -318,12 +333,23 @@ export default function AboutSection({
318
 
319
  return (
320
  <div id="about" className="section-wrap">
321
- <h2 className="section-title">How we score</h2>
322
- <p style={{ maxWidth: '60ch', fontSize: 13, color: 'var(--text-2)', lineHeight: 1.8, marginTop: '0.75rem', marginBottom: '2rem' }}>
323
- {mode === 'models'
324
- ? 'RAI Bench evaluates three orthogonal dimensions of responsible AI deployment. Each benchmark shows score ranges and sub-metric definitions.'
325
- : 'Guardrails are evaluated on their ability to detect unsafe content from RabakBench — the same adversarial dataset used for model LUC testing.'}
326
- </p>
 
 
 
 
 
 
 
 
 
 
 
327
 
328
  <div style={{ display: 'flex', flexDirection: 'column', gap: '1rem' }}>
329
  {mode === 'models'
 
202
  return (
203
  <div style={{
204
  border: '1.5px solid var(--border-1)',
 
205
  borderRadius: 10,
206
  background: 'var(--bg-1)',
207
  overflow: 'hidden',
208
+ position: 'relative',
209
  }}>
210
+ {/* Top accent bar (replaces side-stripe) */}
211
+ <div style={{
212
+ position: 'absolute', top: 0, left: 0, right: 0, height: 3,
213
+ background: b.color,
214
+ }} />
215
+
216
  {/* Static header */}
217
+ <div style={{ display: 'flex', alignItems: 'flex-start', gap: '1rem', padding: '1.5rem 1.5rem 1.25rem' }}>
218
+ <div style={{
219
+ display: 'flex', flexDirection: 'column', alignItems: 'center', flexShrink: 0, gap: 4,
220
+ paddingTop: 2,
221
+ }}>
222
+ <div style={{
223
+ width: 36, height: 36, borderRadius: 8,
224
+ background: b.colorDim, display: 'flex', alignItems: 'center', justifyContent: 'center',
225
+ }}>
226
+ <span style={{
227
+ fontFamily: 'monospace', fontSize: 13, fontWeight: 900,
228
+ color: b.color, lineHeight: 1, letterSpacing: '-0.02em',
229
+ }}>{b.num}</span>
230
+ </div>
231
+ </div>
232
  <div style={{ flex: 1 }}>
233
  <div style={{ display: 'flex', alignItems: 'center', gap: 10, flexWrap: 'wrap' }}>
234
  <span style={{ fontSize: 14, fontWeight: 900, color: 'var(--text-0)' }}>{b.title}</span>
 
245
 
246
  {/* Score guide */}
247
  {thirds && (
248
+ <div style={{ borderTop: '1px solid var(--border-0)', padding: '1rem 1.5rem 1rem calc(1.5rem + 36px + 1rem)' }}>
249
  <div style={{ fontSize: 11, fontWeight: 700, letterSpacing: '0.06em', textTransform: 'uppercase', color: 'var(--text-2)', marginBottom: 10 }}>
250
  Score guide <span style={{ color: b.color, fontWeight: 400, textTransform: 'none', letterSpacing: 0 }}>{b.dir}</span>
251
  </div>
 
286
  </svg>
287
  </button>
288
  {breakdownOpen && (
289
+ <div style={{ padding: '0 1.5rem 1.25rem calc(1.5rem + 36px + 1rem)', display: 'grid', gridTemplateColumns: '1fr 1fr', gap: '1rem 1.5rem' }}>
290
  {b.breakdowns.map(bd => (
291
  <div key={bd.label}>
292
  <div style={{ marginBottom: 5 }}>
 
333
 
334
  return (
335
  <div id="about" className="section-wrap">
336
+ <div style={{ display: 'flex', alignItems: 'flex-end', justifyContent: 'space-between', flexWrap: 'wrap', gap: '1rem', marginBottom: '2rem' }}>
337
+ <div>
338
+ <h2 className="section-title">How we score</h2>
339
+ <p style={{ maxWidth: '60ch', fontSize: 13, color: 'var(--text-2)', lineHeight: 1.8, marginTop: '0.75rem' }}>
340
+ {mode === 'models'
341
+ ? 'Three orthogonal dimensions of responsible AI deployment. Each benchmark shows score ranges and sub-metric definitions.'
342
+ : 'Guardrails are evaluated on their ability to detect unsafe content from RabakBench — the same adversarial dataset used for model LUC testing.'}
343
+ </p>
344
+ </div>
345
+ <div style={{
346
+ fontSize: 11, fontWeight: 700, letterSpacing: '0.08em', textTransform: 'uppercase',
347
+ color: 'var(--text-3)', border: '1.5px solid var(--border-1)', borderRadius: 6,
348
+ padding: '6px 12px', background: 'var(--bg-0)', whiteSpace: 'nowrap', flexShrink: 0,
349
+ }}>
350
+ {mode === 'models' ? '3 benchmarks' : '1 benchmark'}
351
+ </div>
352
+ </div>
353
 
354
  <div style={{ display: 'flex', flexDirection: 'column', gap: '1rem' }}>
355
  {mode === 'models'
src/components/BenchmarkExplainer.tsx CHANGED
@@ -1,7 +1,6 @@
1
  'use client'
2
 
3
  import { useEffect, useRef } from 'react'
4
- import SegmentedToggle from '@/components/SegmentedToggle'
5
 
6
  type Mode = 'models' | 'guardrails'
7
 
@@ -17,6 +16,11 @@ interface Props {
17
  options: ToggleOption[]
18
  }
19
 
 
 
 
 
 
20
  const CRITERIA = [
21
  {
22
  num: '01',
@@ -100,24 +104,90 @@ export default function BenchmarkExplainer({ mode, onModeChange, options }: Prop
100
  return (
101
  <section className="explainer-section" ref={ref} id="criteria">
102
  <div className="section-wrap" style={{ paddingBottom: '1.5rem' }}>
103
- <div className="explainer-intro section-reveal reveal" style={{ marginBottom: '1rem' }}>
 
 
104
  <h2 className="section-title">What we test</h2>
105
- <p style={{ marginTop: '0.5rem', fontSize: 13, color: 'var(--text-2)', lineHeight: 1.7, maxWidth: '64ch' }}>
106
- {mode === 'models'
107
- ? 'Each model is independently evaluated across three dimensions. A model can excel in one area and underperform in another.'
108
- : 'Each guardrail is evaluated on its ability to detect locally-contextualised unsafe content across multiple categories.'}
109
- </p>
110
  </div>
111
 
112
- {/* Mode toggle */}
113
- <SegmentedToggle
114
- options={options}
115
- active={mode}
116
- onChange={(key) => onModeChange(key as Mode)}
117
- />
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118
 
119
  {/* Criteria rows */}
120
- <div style={{ marginTop: '1.25rem', display: 'flex', flexDirection: 'column', gap: 0, border: '1.5px solid var(--border-1)', borderRadius: 10, overflow: 'hidden', background: 'var(--bg-1)' }}>
121
  {visibleCriteria.map((c, i) => (
122
  <div
123
  key={c.num}
@@ -125,18 +195,28 @@ export default function BenchmarkExplainer({ mode, onModeChange, options }: Prop
125
  display: 'flex',
126
  alignItems: 'center',
127
  gap: '1rem',
128
- padding: '1rem 1.5rem',
129
  borderBottom: i < visibleCriteria.length - 1 ? '1px solid var(--border-0)' : 'none',
130
- borderLeft: `3px solid ${c.color}`,
131
  }}
132
  >
 
133
  <div style={{
134
  width: 40, height: 40, borderRadius: 8, flexShrink: 0,
135
  display: 'flex', alignItems: 'center', justifyContent: 'center',
136
- background: c.colorDim, border: `1.5px solid ${c.color}`,
137
  }}>
138
  <c.Icon color={c.color} />
 
 
 
 
 
 
 
 
139
  </div>
 
 
140
  <div style={{ flex: 1, minWidth: 0 }}>
141
  <div style={{ display: 'flex', alignItems: 'center', gap: '0.75rem', flexWrap: 'wrap' }}>
142
  <span style={{ fontSize: 13, fontWeight: 900, color: 'var(--text-0)' }}>{c.title}</span>
@@ -155,9 +235,6 @@ export default function BenchmarkExplainer({ mode, onModeChange, options }: Prop
155
  </p>
156
  )}
157
  </div>
158
- <span style={{ fontSize: 11, fontWeight: 700, color: 'var(--text-3)', fontFamily: 'monospace', flexShrink: 0 }}>
159
- {c.num}
160
- </span>
161
  </div>
162
  ))}
163
  </div>
 
1
  'use client'
2
 
3
  import { useEffect, useRef } from 'react'
 
4
 
5
  type Mode = 'models' | 'guardrails'
6
 
 
16
  options: ToggleOption[]
17
  }
18
 
19
+ const MODE_COLORS: Record<Mode, { color: string; dim: string }> = {
20
+ models: { color: '#BA2FA2', dim: 'rgba(186,47,162,0.07)' },
21
+ guardrails: { color: '#00C0F3', dim: 'rgba(0,192,243,0.07)' },
22
+ }
23
+
24
  const CRITERIA = [
25
  {
26
  num: '01',
 
104
  return (
105
  <section className="explainer-section" ref={ref} id="criteria">
106
  <div className="section-wrap" style={{ paddingBottom: '1.5rem' }}>
107
+
108
+ {/* Section header */}
109
+ <div className="explainer-intro section-reveal reveal" style={{ marginBottom: '1.75rem' }}>
110
  <h2 className="section-title">What we test</h2>
 
 
 
 
 
111
  </div>
112
 
113
+ {/* Mode switcher — full-width two-panel page navigator */}
114
+ <div style={{
115
+ display: 'grid', gridTemplateColumns: '1fr 1fr',
116
+ border: '1.5px solid var(--border-1)', borderRadius: 12,
117
+ overflow: 'hidden', marginBottom: '1.75rem',
118
+ }}>
119
+ {options.map((o, i) => {
120
+ const isActive = mode === o.key
121
+ const { color, dim } = MODE_COLORS[o.key as Mode]
122
+ return (
123
+ <button
124
+ key={o.key}
125
+ onClick={() => onModeChange(o.key as Mode)}
126
+ style={{
127
+ position: 'relative',
128
+ padding: '1.5rem 2rem',
129
+ borderTop: 'none',
130
+ borderBottom: 'none',
131
+ borderLeft: 'none',
132
+ borderRight: i === 0 ? '1.5px solid var(--border-1)' : 'none',
133
+ background: isActive ? dim : 'var(--bg-1)',
134
+ cursor: 'pointer',
135
+ textAlign: 'left',
136
+ transition: 'background 0.3s cubic-bezier(0.16, 1, 0.3, 1)',
137
+ display: 'block',
138
+ }}
139
+ >
140
+ {/* Top accent bar */}
141
+ <div style={{
142
+ position: 'absolute', top: 0, left: 0, right: 0, height: 3,
143
+ background: color, opacity: isActive ? 1 : 0,
144
+ transition: 'opacity 0.3s',
145
+ }} />
146
+
147
+ {/* Label row */}
148
+ <div style={{ display: 'flex', alignItems: 'center', gap: 10, marginBottom: 10 }}>
149
+ <div style={{
150
+ width: 8, height: 8, borderRadius: '50%',
151
+ background: isActive ? color : 'var(--border-2)',
152
+ flexShrink: 0, transition: 'background 0.2s',
153
+ }} />
154
+ <span style={{
155
+ fontSize: 16, fontWeight: 900, letterSpacing: '-0.01em',
156
+ color: isActive ? color : 'var(--text-2)',
157
+ fontFamily: 'var(--font-lato), sans-serif',
158
+ transition: 'color 0.2s',
159
+ }}>{o.label}</span>
160
+ {isActive && (
161
+ <span style={{
162
+ fontSize: 10, fontWeight: 700, letterSpacing: '0.06em', textTransform: 'uppercase',
163
+ color, background: dim, border: `1px solid ${color}`,
164
+ padding: '2px 8px', borderRadius: 4,
165
+ }}>Active</span>
166
+ )}
167
+ </div>
168
+
169
+ {/* Subtitle + viewing indicator */}
170
+ <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', paddingLeft: 18, gap: 12 }}>
171
+ <p style={{
172
+ fontSize: 12, color: isActive ? 'var(--text-2)' : 'var(--text-3)',
173
+ margin: 0, lineHeight: 1.6,
174
+ transition: 'color 0.2s',
175
+ }}>{o.subtitle}</p>
176
+ {isActive && (
177
+ <span style={{
178
+ fontSize: 10, fontWeight: 700, letterSpacing: '0.08em',
179
+ textTransform: 'uppercase', color, opacity: 0.5,
180
+ flexShrink: 0,
181
+ }}>viewing ↓</span>
182
+ )}
183
+ </div>
184
+ </button>
185
+ )
186
+ })}
187
+ </div>
188
 
189
  {/* Criteria rows */}
190
+ <div style={{ display: 'flex', flexDirection: 'column', gap: 0, border: '1.5px solid var(--border-1)', borderRadius: 10, overflow: 'hidden', background: 'var(--bg-1)' }}>
191
  {visibleCriteria.map((c, i) => (
192
  <div
193
  key={c.num}
 
195
  display: 'flex',
196
  alignItems: 'center',
197
  gap: '1rem',
198
+ padding: '1.1rem 1.5rem',
199
  borderBottom: i < visibleCriteria.length - 1 ? '1px solid var(--border-0)' : 'none',
 
200
  }}
201
  >
202
+ {/* Numbered icon badge */}
203
  <div style={{
204
  width: 40, height: 40, borderRadius: 8, flexShrink: 0,
205
  display: 'flex', alignItems: 'center', justifyContent: 'center',
206
+ background: c.colorDim, position: 'relative',
207
  }}>
208
  <c.Icon color={c.color} />
209
+ <div style={{
210
+ position: 'absolute', top: -5, right: -5,
211
+ fontSize: 9, fontWeight: 900, fontFamily: 'monospace',
212
+ color: '#fff', background: c.color,
213
+ minWidth: 16, height: 16, borderRadius: 4,
214
+ display: 'flex', alignItems: 'center', justifyContent: 'center',
215
+ padding: '0 3px', lineHeight: 1,
216
+ }}>{c.num}</div>
217
  </div>
218
+
219
+ {/* Content */}
220
  <div style={{ flex: 1, minWidth: 0 }}>
221
  <div style={{ display: 'flex', alignItems: 'center', gap: '0.75rem', flexWrap: 'wrap' }}>
222
  <span style={{ fontSize: 13, fontWeight: 900, color: 'var(--text-0)' }}>{c.title}</span>
 
235
  </p>
236
  )}
237
  </div>
 
 
 
238
  </div>
239
  ))}
240
  </div>
src/components/GuardrailDistribution.tsx CHANGED
@@ -22,8 +22,8 @@ export default function GuardrailDistribution({ guardrails }: { guardrails: Guar
22
 
23
  const VW = 800
24
  const ROW_H = 120
25
- const LBL_W = 150
26
- const PAD_R = 12
27
  const AXIS_W = VW - LBL_W - PAD_R
28
  const DOT_R = 7
29
  const VH = STRIP_ROWS.length * ROW_H
@@ -167,7 +167,7 @@ export default function GuardrailDistribution({ guardrails }: { guardrails: Guar
167
  })}
168
 
169
  {/* Row label */}
170
- <text x={LBL_W - 10} y={yMid + 5}
171
  textAnchor="end" fontSize={12} fontWeight="700"
172
  fill="var(--text-1)" fontFamily="inherit">
173
  {row.label}
 
22
 
23
  const VW = 800
24
  const ROW_H = 120
25
+ const LBL_W = 85
26
+ const PAD_R = 85
27
  const AXIS_W = VW - LBL_W - PAD_R
28
  const DOT_R = 7
29
  const VH = STRIP_ROWS.length * ROW_H
 
167
  })}
168
 
169
  {/* Row label */}
170
+ <text x={LBL_W - 16} y={yMid + 5}
171
  textAnchor="end" fontSize={12} fontWeight="700"
172
  fill="var(--text-1)" fontFamily="inherit">
173
  {row.label}
src/components/ScoreDistribution.tsx CHANGED
@@ -25,8 +25,8 @@ export default function ScoreDistribution({ models, maxFairness }: { models: Mod
25
 
26
  const VW = 800
27
  const ROW_H = 120
28
- const LBL_W = 150
29
- const PAD_R = 12
30
  const AXIS_W = VW - LBL_W - PAD_R
31
  const DOT_R = 7
32
  const VH = STRIP_ROWS.length * ROW_H
@@ -179,7 +179,7 @@ export default function ScoreDistribution({ models, maxFairness }: { models: Mod
179
  })}
180
 
181
  {/* Row label */}
182
- <text x={LBL_W - 10} y={yMid + 5}
183
  textAnchor="end" fontSize={12} fontWeight="700"
184
  fill="var(--text-1)" fontFamily="inherit">
185
  {row.label}
 
25
 
26
  const VW = 800
27
  const ROW_H = 120
28
+ const LBL_W = 85
29
+ const PAD_R = 85
30
  const AXIS_W = VW - LBL_W - PAD_R
31
  const DOT_R = 7
32
  const VH = STRIP_ROWS.length * ROW_H
 
179
  })}
180
 
181
  {/* Row label */}
182
+ <text x={LBL_W - 16} y={yMid + 5}
183
  textAnchor="end" fontSize={12} fontWeight="700"
184
  fill="var(--text-1)" fontFamily="inherit">
185
  {row.label}