Skip to content

Commit f73ea63

Browse files
committed
s-param better user feedback
1 parent 5d1eeb7 commit f73ea63

File tree

2 files changed

+18
-11
lines changed

2 files changed

+18
-11
lines changed

src/Circuit.jsx

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,9 @@ function SparamComponent({ modalOpen, setModalOpen, value, index, setUserCircuit
192192
const gs0 = value.data[frequency] ? (value.data[frequency].S21 ? 10 * Math.log10(value.data[frequency].S21.magnitude ** 2) : 0) : 0;
193193
const parsed = parseTouchstoneFile(customInput);
194194
const validCheckerResults = parsed.error === null;
195-
const helperText =
196-
customInput == "" ? "Copy in a file" : validCheckerResults ? `${Object.keys(parsed.data).length} data points parsed succesfully` : parsed.error;
195+
const numRows = Object.keys(parsed.data).length;
196+
const defaultMaxRows = 300;
197+
const helperText = customInput == "" ? "Copy in a file" : validCheckerResults ? `${numRows} data points parsed succesfully` : parsed.error;
197198
return (
198199
<>
199200
<Typography variant="caption" align="center" sx={{ display: "block" }}>
@@ -286,22 +287,28 @@ function SparamComponent({ modalOpen, setModalOpen, value, index, setUserCircuit
286287
</li>
287288
<li>Zo: {parsed.settings.zo}</li>
288289
</ul>
289-
{showAllData ? "All rows of data:" : `First ${Math.min(300, Object.keys(parsed.data).length)} rows of data:`}
290-
<button onClick={() => setShowAllData((o) => !o)}>{showAllData ? "Show less" : "Show all"}</button>
291-
<TableContainer sx={{ maxHeight: 300, border: "1px solid black" }}>
290+
ABOVE TEXT FORMATTED INTO A TABLE{" "}
291+
{numRows > defaultMaxRows && (showAllData ? "- All rows of data: " : `- First ${Math.min(defaultMaxRows, numRows)} rows of data: `)}
292+
{numRows > defaultMaxRows && <button onClick={() => setShowAllData((o) => !o)}>{showAllData ? "Show less" : "Show all"}</button>}
293+
<TableContainer sx={{ maxHeight: defaultMaxRows, border: "1px solid black" }}>
292294
<Table stickyHeader size="small">
293295
<TableHead>
294296
<TableRow>
295297
<TableCell key="frequency">Frequency ({parsed.settings.freq_unit})</TableCell>
296298
{allcols.map((column) => {
297299
if (!(column in Object.values(parsed.data)[0])) return null;
298-
return [<TableCell key="mag">|{column}|</TableCell>, <TableCell key="ang">{column}</TableCell>];
300+
return [
301+
<TableCell key="mag">
302+
|{column}|<small>dB</small>
303+
</TableCell>,
304+
<TableCell key="ang">{column}°</TableCell>,
305+
];
299306
})}
300307
</TableRow>
301308
</TableHead>
302309
<TableBody>
303310
{Object.keys(parsed.data).map((f, i) => {
304-
if (!showAllData) if (i > 300) return null; // limit to 300 rows for performance
311+
if (!showAllData) if (i > defaultMaxRows) return null; // limit to defaultMaxRows rows for performance
305312
return (
306313
<TableRow hover tabIndex={-1} key={f}>
307314
<TableCell key="freq">{(f / unitConverter[parsed.settings.freq_unit]).toLocaleString()}</TableCell>
@@ -319,7 +326,7 @@ function SparamComponent({ modalOpen, setModalOpen, value, index, setUserCircuit
319326
</Table>
320327
</TableContainer>
321328
<Typography sx={{ display: "block", mt: 3 }}>Noise Data - note that noise frequencies not in s-param are discarded</Typography>
322-
<TableContainer sx={{ maxHeight: 300, border: "1px solid black" }}>
329+
<TableContainer sx={{ maxHeight: defaultMaxRows, border: "1px solid black" }}>
323330
<Table stickyHeader size="small">
324331
<TableHead>
325332
<TableRow>
@@ -332,7 +339,7 @@ function SparamComponent({ modalOpen, setModalOpen, value, index, setUserCircuit
332339
</TableHead>
333340
<TableBody>
334341
{Object.keys(parsed.noise).map((f, i) => {
335-
if (!showAllData) if (i > 300) return null; // limit to 300 rows for performance
342+
if (!showAllData) if (i > defaultMaxRows) return null; // limit to defaultMaxRows rows for performance
336343
return (
337344
<TableRow hover tabIndex={-1} key={f}>
338345
<TableCell key="freq">{(f / unitConverter[parsed.settings.freq_unit]).toLocaleString()}</TableCell>

src/ReleaseNotes.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,11 @@ function ReleaseNotes() {
9696
</p>
9797
<p>
9898
The first version of this site was extremely simple to support my basic needs; a black box, capacitor, inductor and smith chart
99-
diagram. We successfully used the tool to chose our component values, and since then I've not needed a Smith Chart!
99+
diagram. We successfully used the tool to chose our component values.
100100
</p>
101101
<p>The community has made hundreds of requests over the years and many features have been added</p>
102102
<p>
103-
All features have been verified against Fritz's software, YouTube videos, allaboutcircuits.com, etc. Of course I made some
103+
All features have been verified against Fritz's software, YouTube videos, allaboutcircuits.com, etc. Of coursethere were some
104104
mistakes, most of these have been identified and fixed during the 100's of comments
105105
</p>
106106
</TableCell>

0 commit comments

Comments
 (0)