Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configurable metrics for analysis page #673

Merged
merged 5 commits into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/scripts/components/analysis/define/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export const allAvailableDatasetsLayers: DatasetLayer[] = Object.values(
)
.map((dataset) => (dataset as VedaDatum<DatasetData>).data.layers)
.flat()
.filter((d) => d.type !== 'vector');
.filter((d) => d.type !== 'vector' && !d.analysis?.exclude);

export default function Analysis() {
const { params, setAnalysisParam } = useAnalysisParams();
Expand Down
199 changes: 0 additions & 199 deletions app/scripts/components/analysis/results/analysis-head-actions.tsx

This file was deleted.

79 changes: 79 additions & 0 deletions app/scripts/components/analysis/results/analysis-head.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import React, { Fragment } from 'react';
import styled, { useTheme } from 'styled-components';
import { media } from '@devseed-ui/theme-provider';
import { Button } from '@devseed-ui/button';

import { DATA_METRICS } from './analysis-metrics-dropdown';

import { FoldHeadActions } from '$components/common/fold';
import {
Legend,
LegendTitle,
LegendList,
LegendSwatch,
LegendLabel
} from '$styles/infographics';

const AnalysisFoldHeadActions = styled(FoldHeadActions)`
width: 100%;

${media.mediumUp`
width: auto;
`}

${Button} {
margin-left: auto;
}
`;

const AnalysisLegend = styled(Legend)`
flex-flow: column nowrap;
align-items: flex-start;

${media.smallUp`
flex-flow: row nowrap;
align-items: center;
`};
`;

const AnalysisLegendList = styled(LegendList)`
display: grid;
grid-template-columns: repeat(6, auto);

${media.smallUp`
display: flex;
flex-flow: row nowrap;
`};
`;

export default function AnalysisHead() {
const theme = useTheme();

return (
<AnalysisFoldHeadActions>
<AnalysisLegend>
<LegendTitle>Legend</LegendTitle>
<AnalysisLegendList>
{DATA_METRICS.map((metric) => {
return (
<Fragment key={metric.id}>
<LegendSwatch>
<svg height='8' width='8'>
<title>{theme.color?.[metric.themeColor]}</title>
<circle
cx='4'
cy='4'
r='4'
fill={theme.color?.[metric.themeColor]}
/>
</svg>
</LegendSwatch>
<LegendLabel>{metric.label}</LegendLabel>
</Fragment>
);
})}
</AnalysisLegendList>
</AnalysisLegend>
</AnalysisFoldHeadActions>
);
}
Loading