fleet/frontend/pages/SoftwarePage/components/AddSoftwareModal/AddSoftwareModal.tsx
Gabriel Hernandez cedcadbb36
Add UI for Apple VPP apps feature on the software pages. (#20504)
relates to #19869

> NOTE: API integration will be included in a separate PR

This adds the UI updates to support the new VPP feature on the software
pages. This includes the software titles page and software titles
details page. The new UI includes:

**Add Vpp apps tab in Add software modal:**


![image](https://github.com/user-attachments/assets/f1751b5d-1393-45b7-894c-fa6d067d27d2)

**Various updates to the SoftwareIcon component to support icons from an
external source:**


![image](https://github.com/user-attachments/assets/c860d776-170c-4f51-813e-34f83e479471)

**Various updates to the SoftwarePackageCard compont to support app
store apps.**


![image](https://github.com/user-attachments/assets/7bdd369d-6c95-47a6-8942-63ac3c694ffe)

- [x] Changes file added for user-visible changes in `changes/`,
`orbit/changes/` or `ee/fleetd-chrome/changes`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated testss:
- [x] Manual QA for all new/changed functionality
2024-07-18 10:20:17 +01:00

78 lines
1.9 KiB
TypeScript

import React from "react";
import { InjectedRouter } from "react-router";
import { Tab, TabList, TabPanel, Tabs } from "react-tabs";
import { APP_CONTEXT_ALL_TEAMS_ID } from "interfaces/team";
import Modal from "components/Modal";
import Button from "components/buttons/Button";
import TabsWrapper from "components/TabsWrapper";
import AppStoreVpp from "../AppStoreVpp";
import AddPackage from "../AddPackage";
const baseClass = "add-software-modal";
interface IAllTeamsMessageProps {
onExit: () => void;
}
const AllTeamsMessage = ({ onExit }: IAllTeamsMessageProps) => {
return (
<>
<p>
Please select a team first. Software can&apos;t be added when{" "}
<b>All teams</b> is selected.
</p>
<div className="modal-cta-wrap">
<Button variant="brand" onClick={onExit}>
Done
</Button>
</div>
</>
);
};
interface IAddSoftwareModalProps {
teamId: number;
router: InjectedRouter;
onExit: () => void;
}
const AddSoftwareModal = ({
teamId,
router,
onExit,
}: IAddSoftwareModalProps) => {
return (
<Modal
title="Add software"
onExit={onExit}
width="large"
className={baseClass}
>
<>
{teamId === APP_CONTEXT_ALL_TEAMS_ID ? (
<AllTeamsMessage onExit={onExit} />
) : (
<TabsWrapper className={`${baseClass}__tabs`}>
<Tabs>
<TabList>
<Tab>Package</Tab>
<Tab>App Store (VPP)</Tab>
</TabList>
<TabPanel>
<AddPackage teamId={teamId} router={router} onExit={onExit} />
</TabPanel>
<TabPanel>
<AppStoreVpp teamId={teamId} router={router} onExit={onExit} />
</TabPanel>
</Tabs>
</TabsWrapper>
)}
</>
</Modal>
);
};
export default AddSoftwareModal;