Skip to content

Commit

Permalink
refactor: integrals
Browse files Browse the repository at this point in the history
  • Loading branch information
hamed-musallam committed Oct 19, 2023
1 parent 12e5ac6 commit 0481a12
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 18 deletions.
4 changes: 1 addition & 3 deletions src/component/1d/integral/Integral.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ interface IntegralProps {
max: number;
}

function Integral({ integral, nucleus, max }: IntegralProps) {
export function Integral({ integral, nucleus, max }: IntegralProps) {
const { x, y } = integral;
const { scaleRatio } = useActiveSpectrumIntegralsViewState();
const path = useIntegralPath({ x, y, max, scaleRatio });
Expand All @@ -34,5 +34,3 @@ function Integral({ integral, nucleus, max }: IntegralProps) {
</g>
);
}

export default Integral;
26 changes: 11 additions & 15 deletions src/component/1d/integral/IntegralsSeries.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Integral as IntegralType } from 'nmr-processing';
import { useChartData } from '../../context/ChartContext';
import useSpectrum from '../../hooks/useSpectrum';

import Integral from './Integral';
import { Integral } from './Integral';

const emptyData = { integrals: {}, info: {}, display: {} };

Expand All @@ -14,7 +14,7 @@ export interface IntegralData extends IntegralType {
y: Float64Array;
}

function IntegralsSeries() {
export default function IntegralsSeries() {
const {
displayerKey,
view: {
Expand All @@ -26,17 +26,15 @@ function IntegralsSeries() {
if (!integrals) return null;

return (
<g clipPath={`url(#${displayerKey}clip-chart-1d)`}>
<g className="integrals">
{integrals.values.map((integral) => (
<Integral
nucleus={nucleus}
key={integral.id}
integral={integral}
max={integrals.max}
/>
))}
</g>
<g clipPath={`url(#${displayerKey}clip-chart-1d)`} className="integrals">
{integrals.values.map((integral) => (
<Integral
nucleus={nucleus}
key={integral.id}
integral={integral}
max={integrals.max}
/>
))}
</g>
);
}
Expand Down Expand Up @@ -76,5 +74,3 @@ function useIntegrals() {

return { max, values };
}

export default IntegralsSeries;

0 comments on commit 0481a12

Please sign in to comment.