2023-04-06 10:36:31 +00:00
|
|
|
// ui
|
|
|
|
import { CustomMenu } from "components/ui";
|
|
|
|
// icons
|
2023-10-16 14:57:22 +00:00
|
|
|
import { Trash2 } from "lucide-react";
|
2023-04-06 10:36:31 +00:00
|
|
|
// helpers
|
|
|
|
import { renderShortDateWithYearFormat } from "helpers/date-time.helper";
|
|
|
|
// types
|
|
|
|
import { IImporterService } from "types";
|
2023-05-05 10:15:38 +00:00
|
|
|
// constants
|
|
|
|
import { IMPORTERS_EXPORTERS_LIST } from "constants/workspace";
|
2023-04-06 10:36:31 +00:00
|
|
|
|
|
|
|
type Props = {
|
|
|
|
service: IImporterService;
|
|
|
|
refreshing: boolean;
|
|
|
|
handleDelete: () => void;
|
|
|
|
};
|
|
|
|
|
|
|
|
export const SingleImport: React.FC<Props> = ({ service, refreshing, handleDelete }) => (
|
2023-09-15 09:33:32 +00:00
|
|
|
<div className="flex items-center justify-between gap-2 px-4 py-3">
|
2023-04-06 10:36:31 +00:00
|
|
|
<div>
|
2023-04-24 07:50:41 +00:00
|
|
|
<h4 className="flex items-center gap-2 text-sm">
|
2023-04-06 10:36:31 +00:00
|
|
|
<span>
|
2023-05-05 10:15:38 +00:00
|
|
|
Import from{" "}
|
|
|
|
<span className="font-medium">
|
|
|
|
{IMPORTERS_EXPORTERS_LIST.find((i) => i.provider === service.service)?.title}
|
|
|
|
</span>{" "}
|
|
|
|
to <span className="font-medium">{service.project_detail.name}</span>
|
2023-04-06 10:36:31 +00:00
|
|
|
</span>
|
|
|
|
<span
|
2023-04-24 07:50:41 +00:00
|
|
|
className={`rounded px-2 py-0.5 text-xs capitalize ${
|
2023-04-06 10:36:31 +00:00
|
|
|
service.status === "completed"
|
2023-04-24 07:50:41 +00:00
|
|
|
? "bg-green-500/20 text-green-500"
|
2023-04-06 10:36:31 +00:00
|
|
|
: service.status === "processing"
|
2023-04-24 07:50:41 +00:00
|
|
|
? "bg-yellow-500/20 text-yellow-500"
|
2023-04-06 10:36:31 +00:00
|
|
|
: service.status === "failed"
|
2023-04-24 07:50:41 +00:00
|
|
|
? "bg-red-500/20 text-red-500"
|
2023-04-06 10:36:31 +00:00
|
|
|
: ""
|
|
|
|
}`}
|
|
|
|
>
|
|
|
|
{refreshing ? "Refreshing..." : service.status}
|
|
|
|
</span>
|
|
|
|
</h4>
|
2023-07-10 07:17:00 +00:00
|
|
|
<div className="mt-2 flex items-center gap-2 text-xs text-custom-text-200">
|
2023-04-06 10:36:31 +00:00
|
|
|
<span>{renderShortDateWithYearFormat(service.created_at)}</span>|
|
2023-08-08 07:31:43 +00:00
|
|
|
<span>Imported by {service.initiated_by_detail.display_name}</span>
|
2023-04-06 10:36:31 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<CustomMenu ellipsis>
|
|
|
|
<CustomMenu.MenuItem onClick={handleDelete}>
|
|
|
|
<span className="flex items-center justify-start gap-2">
|
2023-10-16 14:57:22 +00:00
|
|
|
<Trash2 className="h-3.5 w-3.5" />
|
2023-04-06 10:36:31 +00:00
|
|
|
Delete import
|
|
|
|
</span>
|
|
|
|
</CustomMenu.MenuItem>
|
|
|
|
</CustomMenu>
|
|
|
|
</div>
|
|
|
|
);
|