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

Move new summary views to a stream #5888

Merged
merged 2 commits into from
Nov 14, 2024
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
31 changes: 13 additions & 18 deletions frontend/src/landing/LandingPageSummaries.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { TieredSummaries } from '../summaries/TieredSummaries'
import { Box } from '@chakra-ui/react'
import { HistoricalSummariesGraph } from '../summaries/HistoricalSummariesGraph'
import { ErrorBoundary } from 'react-error-boundary'
import { ABTestVariant, ABTestWrapper } from '../app/ABTestWrapper'
import useSearchParam from '../utilities/useSearchParam'

export function LandingPageSummaries() {
Expand Down Expand Up @@ -41,23 +40,19 @@ export function LandingPageSummaries() {
return (
<Box>
<TieredSummaries summaries={summaries} />
<ABTestWrapper insiderVariantName="B">
<ABTestVariant name="B">
{histSumLoading ? (
<LoadingMessage height={500} />
) : (
<ErrorBoundary FallbackComponent={ErrorFallbackMessage}>
<HistoricalSummariesGraph
data={historicalSummaries?.findChartSummaries}
setRange={setProgressChartRangeParam}
selectedRange={progressChartRangeParam}
width={1200}
height={500}
/>
</ErrorBoundary>
)}
</ABTestVariant>
</ABTestWrapper>
{histSumLoading ? (
<LoadingMessage height={500} />
) : (
<ErrorBoundary FallbackComponent={ErrorFallbackMessage}>
<HistoricalSummariesGraph
data={historicalSummaries?.findChartSummaries}
setRange={setProgressChartRangeParam}
selectedRange={progressChartRangeParam}
width={1200}
height={500}
/>
</ErrorBoundary>
)}
</Box>
)
}
45 changes: 20 additions & 25 deletions frontend/src/organizationDetails/OrganizationDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import { RadialBarChart } from '../summaries/RadialBarChart'
import { RequestOrgInviteModal } from '../organizations/RequestOrgInviteModal'
import { useUserVar } from '../utilities/userState'
import { HistoricalSummariesGraph } from '../summaries/HistoricalSummariesGraph'
import { ABTestVariant, ABTestWrapper } from '../app/ABTestWrapper'
import useSearchParam from '../utilities/useSearchParam'
import { AggregatedGuidanceSummary } from '../summaries/AggregatedGuidanceSummary'
import { bool } from 'prop-types'
Expand Down Expand Up @@ -160,30 +159,26 @@ export default function OrganizationDetails({ loginRequired }) {
<TieredSummaries summaries={data?.organization?.summaries} />
</ErrorBoundary>
<Divider />
<ABTestWrapper insiderVariantName="B">
<ABTestVariant name="B">
{orgSummariesLoading ? (
<LoadingMessage height={500} />
) : (
<ErrorBoundary FallbackComponent={ErrorFallbackMessage}>
<HistoricalSummariesGraph
data={orgSummariesData?.findOrganizationBySlug?.historicalSummaries}
setRange={setProgressChartRangeParam}
selectedRange={progressChartRangeParam}
width={1200}
height={500}
userHasPermission={data?.organization?.userHasPermission}
/>
</ErrorBoundary>
)}
<Divider />
{data?.organization?.userHasPermission && (
<ErrorBoundary FallbackComponent={ErrorFallbackMessage}>
<AggregatedGuidanceSummary orgSlug={orgSlug} mt="4" className="aggregated-guidance-summary" />
</ErrorBoundary>
)}
</ABTestVariant>
</ABTestWrapper>
{orgSummariesLoading ? (
<LoadingMessage height={500} />
) : (
<ErrorBoundary FallbackComponent={ErrorFallbackMessage}>
<HistoricalSummariesGraph
data={orgSummariesData?.findOrganizationBySlug?.historicalSummaries}
setRange={setProgressChartRangeParam}
selectedRange={progressChartRangeParam}
width={1200}
height={500}
userHasPermission={data?.organization?.userHasPermission}
/>
</ErrorBoundary>
)}
<Divider />
{data?.organization?.userHasPermission && (
<ErrorBoundary FallbackComponent={ErrorFallbackMessage}>
<AggregatedGuidanceSummary orgSlug={orgSlug} mt="4" className="aggregated-guidance-summary" />
</ErrorBoundary>
)}
</TabPanel>
<TabPanel>
<ErrorBoundary FallbackComponent={ErrorFallbackMessage}>
Expand Down
15 changes: 5 additions & 10 deletions frontend/src/summaries/HistoricalSummariesGraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import { Trans, t } from '@lingui/macro'
import { func } from 'prop-types'
import useSearchParam from '../utilities/useSearchParam'
import { useLocation } from 'react-router-dom'
import { ABTestVariant, ABTestWrapper } from '../app/ABTestWrapper'

const getDate = ({ date }) => new Date(date)

Expand Down Expand Up @@ -230,15 +229,11 @@ export function HistoricalSummariesGraph({
<option value="three">
<Trans>Tier 3: Compliance</Trans>
</option>
<ABTestWrapper insiderVariantName="B">
<ABTestVariant name="B">
{location.pathname.includes('/organizations/') && userHasPermission && (
<option value="four">
<Trans>Total Negative Findings</Trans>
</option>
)}
</ABTestVariant>
</ABTestWrapper>
{location.pathname.includes('/organizations/') && userHasPermission && (
<option value="four">
<Trans>Total Negative Findings</Trans>
</option>
)}
</Select>
</Flex>
<Box position="relative">
Expand Down