fleet/frontend/pages/software/ManageSoftwarePage/components/PreviewTicketModal/PreviewTicketModal.tsx
Jacob Shandling f9ac557c8e
UI: Make all Modal widths consistent (#11722)
## Addresses #11356

Images of 3 fixed modals referenced in the issue:
<img width="1235" alt="Screenshot 2023-05-12 at 4 11 52 PM"
src="https://github.com/fleetdm/fleet/assets/61553566/098081c7-15d4-4009-92a0-7a2e14ffaab1">
<img width="1235" alt="Screenshot 2023-05-12 at 4 12 50 PM"
src="https://github.com/fleetdm/fleet/assets/61553566/7d0f268d-f2dc-4686-a64d-94e28a94c717">
<img width="1235" alt="Screenshot 2023-05-12 at 4 13 26 PM"
src="https://github.com/fleetdm/fleet/assets/61553566/d486b005-1344-4656-adec-c4929332816b">

## Implemented:
- [x] Updated global modal styles for consistency
- [x] Add optional "width" prop to `Modal`
- [x] Misc cleanup:
  - [x]  Restore missing padding from inverse-alert buttons
  - [x]  Improve naming, lots of cleanup
  - [x] More coming in separate PR
- [x] Check each of the following modals, define `width` where
necessary:
  - [x]  Add hosts
  - [x]  EnrollSecret
    - [x] Also fix misaligned icons  
  - [x]  SecretEditor
  - [x]  DeleteSecret
  - [x]  ShowQuery
  - [x]  AddIntegration
  - [x]  DeleteIntegration
  - [x]  EditIntegration
  - [x]  EditTeam
  - [x]  RequestCSR
  - [x]  HostStatusWebhook
  - [x]  CreateTeam
  - [x]  DeleteTeam
  - [x]  EditTeam
  - [x]  AddMember
  - [x]  RemoveMember
  - [x]  CreateUser
  - [x]  DeleteUser
  - [x]  EditUser
    - [x] Also fix randomly shorter 'Password' field  
  - [x]  ResetPassword
  - [x]  ResetSessions
  - [x]  WelcomeHost
  - [x]  DeletHost
  - [x]  TransferHost
  - [x]  POlicyDetails
  - [x]  AutoEnrollMdm
  - [x]  Info
  - [x]  ManualEnrollMdm
  - [x]  ResetKey
  - [x]  BootstrapPackage
  - [x]  DiskEncryption
  - [x]  OSPOlicy
  - [x]  SelectQuery
  - [x]  UnenrollMdm
  - [x]  MacSettings
  - [x]  DeleteLabel
  - [x]  EditCOlumns
  -  WIP, cannot QA yet (cc @ghernandez345):
      - DeleteScript
      - RerunScript
  - [x]  DeleteProfile
  - [x]  DeletePackage - allow to conform to default "m" width, 650px
  - [x]  PackQueryEditor - allow to conform to default "m" width
  - [x]  RemovePackQuery - allow to conform to default "m" width
  - [x]  DeletePack - allow to conform to default "m" width
  - [x]  AddPolicy 
  - [x]  DeletePolicy - allow to conform to default "m" width
- [x] NewPolicy (now "SaveNewPolicyModal") - allow to conform to default
"m" width
  - [x]  DeleteQuery
  - [x]  NewQuery - allow to conform to default "m" width
  - [x]  PreviewData
  - [x]  RemoveScheduledQuery
  - [x]  ScheduleEditor
  - [x]  UserSettingsPage (aka "get API token")
  - [x]  2 x ManageAutomations –  set to large
  - [x]  2 x PreviewPayload - allow to conform to default "m" width 
  - [x]  2 x PreviewTicket - same as ManageAutomations

## Checklist for submitter

- [x] Changes file added for user-visible changes in `changes/` 
- [x] Manual QA for all new/changed functionality

---------

Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
2023-05-17 10:07:38 -07:00

69 lines
2.1 KiB
TypeScript

import React, { useContext } from "react";
import { AppContext } from "context/app";
import { IIntegrationType } from "interfaces/integration";
import Modal from "components/Modal";
import Button from "components/buttons/Button";
import CustomLink from "components/CustomLink";
import JiraPreview from "../../../../../../assets/images/jira-vuln-software-preview-400x517@2x.png";
import ZendeskPreview from "../../../../../../assets/images/zendesk-vuln-software-preview-400x455@2x.png";
import JiraPreviewPremium from "../../../../../../assets/images/jira-vuln-software-preview-premium-400x517@2x.png";
import ZendeskPreviewPremium from "../../../../../../assets/images/zendesk-vuln-software-preview-premium-400x455@2x.png";
const baseClass = "preview-ticket-modal";
interface IPreviewTicketModalProps {
onCancel: () => void;
integrationType: IIntegrationType;
}
const PreviewTicketModal = ({
onCancel,
integrationType,
}: IPreviewTicketModalProps): JSX.Element => {
const { isPremiumTier } = useContext(AppContext);
const screenshot =
integrationType === "jira" ? (
<img
src={isPremiumTier ? JiraPreviewPremium : JiraPreview}
alt="Jira ticket"
className={`${baseClass}__jira-screenshot`}
/>
) : (
<img
src={isPremiumTier ? ZendeskPreviewPremium : ZendeskPreview}
alt="Zendesk ticket"
className={`${baseClass}__zendesk-screenshot`}
/>
);
return (
<Modal
title={"Example ticket"}
onExit={onCancel}
onEnter={onCancel}
className={baseClass}
width="large"
>
<>
<p className="automations-learn-more">
Want to learn more about how automations in Fleet work?{" "}
<CustomLink
url="https://fleetdm.com/docs/using-fleet/automations"
text="Check out the Fleet documentation"
newTab
/>
</p>
<div className={`${baseClass}__example`}>{screenshot}</div>
<div className="modal-cta-wrap">
<Button onClick={onCancel} variant="brand">
Done
</Button>
</div>
</>
</Modal>
);
};
export default PreviewTicketModal;