feat(ui): add loading state and no data message to converted compose display

This commit is contained in:
Mauricio Siu
2025-05-16 23:16:02 -06:00
parent 294378d95b
commit b4b2d12f6e

View File

@@ -10,7 +10,7 @@ import {
DialogTrigger, DialogTrigger,
} from "@/components/ui/dialog"; } from "@/components/ui/dialog";
import { api } from "@/utils/api"; import { api } from "@/utils/api";
import { Puzzle, RefreshCw } from "lucide-react"; import { Loader2, Puzzle, RefreshCw } from "lucide-react";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { toast } from "sonner"; import { toast } from "sonner";
@@ -66,7 +66,19 @@ export const ShowConvertedCompose = ({ composeId }: Props) => {
Preview your docker-compose file with added domains. Note: At least Preview your docker-compose file with added domains. Note: At least
one domain must be specified for this conversion to take effect. one domain must be specified for this conversion to take effect.
</AlertBlock> </AlertBlock>
{isLoading ? (
<div className="flex flex-row items-center justify-center min-h-[25rem] border p-4 rounded-md">
<Loader2 className="h-8 w-8 text-muted-foreground mb-2 animate-spin" />
</div>
) : compose?.length === 5 ? (
<div className="border p-4 rounded-md flex flex-col items-center justify-center min-h-[25rem]">
<Puzzle className="h-8 w-8 text-muted-foreground mb-2" />
<span className="text-muted-foreground">
No converted compose data available.
</span>
</div>
) : (
<>
<div className="flex flex-row gap-2 justify-end"> <div className="flex flex-row gap-2 justify-end">
<Button <Button
variant="secondary" variant="secondary"
@@ -96,6 +108,8 @@ export const ShowConvertedCompose = ({ composeId }: Props) => {
height="50rem" height="50rem"
/> />
</pre> </pre>
</>
)}
</DialogContent> </DialogContent>
</Dialog> </Dialog>
); );