-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
feedback revisions: extract header into separate component and put pr…
…eview back into progress and planning files
Showing
4 changed files
with
90 additions
and
59 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
src/scenes/Engagement/LanguageEngagement/PlanningSpreadsheet/PlanningSpreadsheetHeader.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import { Preview as PreviewIcon } from '@mui/icons-material'; | ||
import { IconButton, Stack, Tooltip, Typography } from '@mui/material'; | ||
import { StyleProps } from '~/common'; | ||
import { Feature } from '~/components/Feature'; | ||
import { | ||
NonDirectoryActionItem as File, | ||
useFileActions, | ||
} from '~/components/files/FileActions'; | ||
import { PnPValidationIcon } from '../../../ProgressReports/PnpValidation/PnpValidationIcon'; | ||
import { EngagementPlanningSpreadsheetFragment } from './PlanningSpreadsheet.graphql'; | ||
|
||
interface PlanningSpreadsheetHeaderProps extends StyleProps { | ||
engagement: EngagementPlanningSpreadsheetFragment; | ||
} | ||
|
||
export const PlanningSpreadsheetHeader = ({ | ||
engagement, | ||
}: PlanningSpreadsheetHeaderProps) => ( | ||
<Stack | ||
sx={{ | ||
mt: -1, | ||
flexDirection: 'row', | ||
gap: 1, | ||
alignItems: 'center', | ||
}} | ||
> | ||
<Typography variant="h4">Planning Spreadsheet</Typography> | ||
{engagement.pnp.value && ( | ||
<> | ||
<Preview file={engagement.pnp.value} /> | ||
<Feature | ||
flag="pnp-validation" | ||
match={true} | ||
sx={{ | ||
display: 'inherit', | ||
flexDirection: 'inherit', | ||
gap: 'inherit', | ||
}} | ||
> | ||
{engagement.pnpExtractionResult && ( | ||
<PnPValidationIcon | ||
file={engagement.pnp.value} | ||
result={engagement.pnpExtractionResult} | ||
engagement={engagement} | ||
size="small" | ||
/> | ||
)} | ||
</Feature> | ||
</> | ||
)} | ||
</Stack> | ||
); | ||
|
||
export const Preview = ({ file }: { file: File }) => { | ||
const { openFilePreview } = useFileActions(); | ||
return ( | ||
<Tooltip title="Preview"> | ||
<IconButton onClick={() => openFilePreview(file)} size="small"> | ||
<PreviewIcon /> | ||
</IconButton> | ||
</Tooltip> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters