Skip to content

Commit 9d2cbd9

Browse files
nabeelreclaude
andcommitted
Polish UI: rename, side-by-side plots, larger markers, random star button
- Rename app to "StarEmbed Explorer" - Show raw and phase-folded light curves simultaneously side by side - Double marker size (4 → 8) for better legibility - Add "Random" button in source panel toolbar to jump to a random source Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent c3b0075 commit 9d2cbd9

3 files changed

Lines changed: 45 additions & 50 deletions

File tree

src/App.jsx

Lines changed: 20 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ export default function App() {
1111
const [error, setError] = useState(null);
1212
const [loading, setLoading] = useState(true);
1313
const [selectedIdx, setSelectedIdx] = useState(null);
14-
const [plotMode, setPlotMode] = useState("raw");
1514
const [classFilter, setClassFilter] = useState("");
1615
const [page, setPage] = useState(0);
1716

@@ -54,7 +53,7 @@ export default function App() {
5453
return (
5554
<div className="app">
5655
<header>
57-
<h1>PTF Variable Star Explorer</h1>
56+
<h1>StarEmbed Explorer</h1>
5857
<p className="meta">
5958
Source: <code>{config.dataSource}</code>
6059
{" · "}
@@ -78,6 +77,13 @@ export default function App() {
7877
}}
7978
/>
8079
<span className="count-badge">{filteredRows.length}</span>
80+
<button
81+
className="random-btn"
82+
onClick={() => setSelectedIdx(Math.floor(Math.random() * rows.length))}
83+
title="Jump to a random source"
84+
>
85+
⚄ Random
86+
</button>
8187
</div>
8288

8389
<div className="table-scroll">
@@ -96,10 +102,7 @@ export default function App() {
96102
<tr
97103
key={row.sourceid}
98104
className={idx === selectedIdx ? "selected" : ""}
99-
onClick={() => {
100-
setSelectedIdx(idx);
101-
setPlotMode("raw");
102-
}}
105+
onClick={() => setSelectedIdx(idx)}
103106
>
104107
<td className="mono">{row.sourceid}</td>
105108
<td>
@@ -134,11 +137,7 @@ export default function App() {
134137

135138
<section className="detail-panel">
136139
{selectedRow ? (
137-
<SourceDetail
138-
row={selectedRow}
139-
plotMode={plotMode}
140-
onPlotModeChange={setPlotMode}
141-
/>
140+
<SourceDetail row={selectedRow} />
142141
) : (
143142
<p className="empty-hint">← Select a source to explore its light curve.</p>
144143
)}
@@ -148,7 +147,7 @@ export default function App() {
148147
);
149148
}
150149

151-
function SourceDetail({ row, plotMode, onPlotModeChange }) {
150+
function SourceDetail({ row }) {
152151
const g = row.lightcurve.g_PTF;
153152
const R = row.lightcurve.R_PTF;
154153
const gGood = g?.goodflag?.filter((f) => f === 1).length ?? 0;
@@ -190,24 +189,16 @@ function SourceDetail({ row, plotMode, onPlotModeChange }) {
190189
<MetaItem label="R obs (good)" value={`${R?.length ?? 0} (${RGood})`} />
191190
</div>
192191

193-
<div className="plot-controls">
194-
<button
195-
className={plotMode === "raw" ? "active" : ""}
196-
onClick={() => onPlotModeChange("raw")}
197-
>
198-
Raw
199-
</button>
200-
<button
201-
className={plotMode === "folded" ? "active" : ""}
202-
onClick={() => onPlotModeChange("folded")}
203-
disabled={!row.period}
204-
title={!row.period ? "No period available" : `Fold at P = ${row.period} d`}
205-
>
206-
Phase-folded
207-
</button>
192+
<div className="plot-row">
193+
<div className="plot-col">
194+
<p className="plot-label">Raw</p>
195+
<LightCurvePlot row={row} mode="raw" />
196+
</div>
197+
<div className="plot-col">
198+
<p className="plot-label">Phase-folded {row.period ? `(P = ${row.period.toFixed(4)} d)` : ""}</p>
199+
<LightCurvePlot row={row} mode="folded" />
200+
</div>
208201
</div>
209-
210-
<LightCurvePlot row={row} mode={plotMode} />
211202
</div>
212203
);
213204
}

src/components/LightCurvePlot.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function buildTrace(bandKey, bandData, mode, period) {
3030
type: "scatter",
3131
mode: "markers",
3232
name: BANDS[bandKey].label,
33-
marker: { color: BANDS[bandKey].color, size: 4, opacity: 0.8 },
33+
marker: { color: BANDS[bandKey].color, size: 8, opacity: 0.8 },
3434
};
3535
}
3636

src/index.css

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -236,41 +236,45 @@ body,
236236
color: #222;
237237
}
238238

239-
/* ── Plot controls ────────────────────────────────────────── */
239+
/* ── Side-by-side plots ───────────────────────────────────── */
240240

241-
.plot-controls {
241+
.plot-row {
242242
display: flex;
243-
gap: 0.4rem;
244-
margin-bottom: 0.5rem;
243+
gap: 0.75rem;
244+
}
245+
246+
.plot-col {
247+
flex: 1;
248+
min-width: 0;
249+
}
250+
251+
.plot-label {
252+
margin: 0 0 0.2rem;
253+
font-size: 0.78rem;
254+
font-weight: 600;
255+
color: #666;
256+
text-transform: uppercase;
257+
letter-spacing: 0.04em;
245258
}
246259

247-
.plot-controls button {
248-
padding: 0.3rem 0.9rem;
260+
/* ── Random button ────────────────────────────────────────── */
261+
262+
.random-btn {
263+
padding: 0.3rem 0.7rem;
249264
border: 1px solid #ccc;
250265
border-radius: 4px;
251266
background: #fff;
252267
cursor: pointer;
253-
font-size: 0.875rem;
268+
font-size: 0.8rem;
269+
white-space: nowrap;
254270
color: #444;
255-
transition: background 0.08s, border-color 0.08s;
256271
}
257272

258-
.plot-controls button:hover:not(:disabled) {
273+
.random-btn:hover {
259274
background: #f0f6ff;
260275
border-color: #3a7cbf;
261276
}
262277

263-
.plot-controls button.active {
264-
background: #3a7cbf;
265-
border-color: #3a7cbf;
266-
color: #fff;
267-
}
268-
269-
.plot-controls button:disabled {
270-
opacity: 0.4;
271-
cursor: default;
272-
}
273-
274278
/* ── Shared atoms ─────────────────────────────────────────── */
275279

276280
.mono {

0 commit comments

Comments
 (0)