Pratyush-01 commited on
Commit
add05eb
·
verified ·
1 Parent(s): a8b800c

ui: default damped_spring, remove Random option

Browse files
frontend/src/components/ComparePane.tsx CHANGED
@@ -51,11 +51,11 @@ export function ComparePane(): JSX.Element {
51
  const [maxTurns, setMaxTurns] = useState<number>(8);
52
  const [temperature, setTemperature] = useState<number>(0.4);
53
 
54
- // The system catalogue is fetched separately by each runner; one of
55
- // them is enough to populate the selector. We pick `a` arbitrarily.
56
  useEffect(() => {
57
  if (!systemId && runner.a.state.systems && runner.a.state.systems.length > 0) {
58
- setSystemId(runner.a.state.systems[0]?.system_id ?? "");
 
59
  }
60
  }, [runner.a.state.systems, systemId]);
61
 
@@ -73,7 +73,7 @@ export function ComparePane(): JSX.Element {
73
 
74
  function handleStart(): void {
75
  void runner.startBoth({
76
- systemId: systemId || undefined,
77
  maxTurns,
78
  connectionA,
79
  connectionB,
@@ -203,14 +203,11 @@ function CompareControlBar({
203
  {systems === null ? (
204
  <option value="">Loading…</option>
205
  ) : (
206
- <>
207
- <option value="">Random</option>
208
- {systems.map((descriptor) => (
209
- <option key={descriptor.system_id} value={descriptor.system_id}>
210
- {prettySystemId(descriptor.system_id)}
211
- </option>
212
- ))}
213
- </>
214
  )}
215
  </select>
216
  </Field>
 
51
  const [maxTurns, setMaxTurns] = useState<number>(8);
52
  const [temperature, setTemperature] = useState<number>(0.4);
53
 
54
+ // Default to damped_spring; fall back to first in list.
 
55
  useEffect(() => {
56
  if (!systemId && runner.a.state.systems && runner.a.state.systems.length > 0) {
57
+ const preferred = runner.a.state.systems.find((s) => s.system_id === "damped_spring");
58
+ setSystemId(preferred?.system_id ?? runner.a.state.systems[0]?.system_id ?? "");
59
  }
60
  }, [runner.a.state.systems, systemId]);
61
 
 
73
 
74
  function handleStart(): void {
75
  void runner.startBoth({
76
+ systemId: systemId,
77
  maxTurns,
78
  connectionA,
79
  connectionB,
 
203
  {systems === null ? (
204
  <option value="">Loading…</option>
205
  ) : (
206
+ systems.map((descriptor) => (
207
+ <option key={descriptor.system_id} value={descriptor.system_id}>
208
+ {prettySystemId(descriptor.system_id)}
209
+ </option>
210
+ ))
 
 
 
211
  )}
212
  </select>
213
  </Field>