added pucks and samples
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { Box } from '@mui/material';
|
||||
import { Box, Typography } from '@mui/material';
|
||||
|
||||
interface UnipuckProps {
|
||||
pucks: number; // Number of pucks
|
||||
@ -8,6 +8,10 @@ interface UnipuckProps {
|
||||
|
||||
const Unipuck: React.FC<UnipuckProps> = ({ pucks, samples }) => {
|
||||
const renderPuck = (sampleStatus: string[]) => {
|
||||
if (!sampleStatus) {
|
||||
sampleStatus = Array(16).fill('empty');
|
||||
}
|
||||
|
||||
const puckSVG = (
|
||||
<svg width="100" height="100" viewBox="0 0 100 100">
|
||||
<circle cx="50" cy="50" r="45" stroke="black" strokeWidth="2" fill="none" />
|
||||
@ -28,11 +32,15 @@ const Unipuck: React.FC<UnipuckProps> = ({ pucks, samples }) => {
|
||||
return puckSVG;
|
||||
};
|
||||
|
||||
if (pucks === 0) {
|
||||
return <Typography variant="body1">No pucks attached to the dewar.</Typography>;
|
||||
}
|
||||
|
||||
return (
|
||||
<Box sx={{ display: 'flex', flexWrap: 'wrap', justifyContent: 'center', gap: 2 }}>
|
||||
{[...Array(pucks)].map((_, index) => (
|
||||
<Box key={index} sx={{ margin: 1 }}>
|
||||
{renderPuck(samples ? samples[index] : Array(16).fill('empty'))}
|
||||
{renderPuck(samples && samples[index] ? samples[index] : Array(16).fill('empty'))}
|
||||
</Box>
|
||||
))}
|
||||
</Box>
|
||||
|
Reference in New Issue
Block a user