diff --git a/ui/src/components/EmbedConfigModal.tsx b/ui/src/components/EmbedConfigModal.tsx new file mode 100644 index 0000000..a6f9621 --- /dev/null +++ b/ui/src/components/EmbedConfigModal.tsx @@ -0,0 +1,181 @@ +import { Button } from "@ui/components/ui/button"; +import { + Dialog, + DialogContent, + DialogFooter, + DialogHeader, + DialogTitle, +} from "@ui/components/ui/dialog"; +import { Label } from "@ui/components/ui/label"; +import { + Select, + SelectContent, + SelectItem, + SelectTrigger, + SelectValue, +} from "@ui/components/ui/select"; +import { CopyButton } from "@ui/components/ui/clipboard"; +import { useState } from "react"; +import { TypographyMuted } from "@ui/components/ui/typography"; + +type ColorVariant = "black" | "white" | "blue" | "purple" | "green" | "orange"; + +interface EmbedConfig { + backgroundVariant: ColorVariant; + buttonVariant: ColorVariant; +} + +interface EmbedConfigModalProps { + isOpen: boolean; + onClose: () => void; + baseEmbedUrl: string; +} + +export function EmbedConfigModal({ isOpen, onClose, baseEmbedUrl }: EmbedConfigModalProps) { + const [embedConfig, setEmbedConfig] = useState({ + backgroundVariant: "purple", + buttonVariant: "purple", + }); + + const getEmbedUrl = () => { + const params = new URLSearchParams({ + backgroundVariant: embedConfig.backgroundVariant, + buttonVariant: embedConfig.buttonVariant, + }); + return `${baseEmbedUrl}?${params.toString()}`; + }; + + const generateEmbedCode = () => { + const embedUrl = getEmbedUrl(); + + return ``; + }; + + const colorOptions: { value: ColorVariant; label: string; color: string }[] = [ + { value: "black", label: "Noir", color: "bg-gray-900" }, + { value: "white", label: "Blanc", color: "bg-white" }, + { value: "blue", label: "Bleu", color: "bg-blue-600" }, + { value: "purple", label: "Violet", color: "bg-purple-600" }, + { value: "green", label: "Vert", color: "bg-green-600" }, + { value: "orange", label: "Orange", color: "bg-orange-600" }, + ]; + + return ( + + + + Configurer l'intégration + + +
+ {/* Configuration Section */} +
+
+ + +
+ +
+ + +
+
+ + {/* Preview Link */} +
+ +
+ + +
+
+ + {/* Embed Code */} +
+ + + Copiez ce code pour intégrer le formulaire de réservation sur votre site web + +
+
+
+                  {generateEmbedCode()}
+                
+
+
+ +
+
+
+
+ + + + +
+
+ ); +} diff --git a/ui/src/components/EventTypeCard.tsx b/ui/src/components/EventTypeCard.tsx index 373a42e..401f756 100644 --- a/ui/src/components/EventTypeCard.tsx +++ b/ui/src/components/EventTypeCard.tsx @@ -7,9 +7,17 @@ import { CardHeader, CardTitle, } from "@ui/components/ui/card"; -import { CopyButton } from "@ui/components/ui/clipboard"; +import { EmbedConfigModal } from "@ui/components/EmbedConfigModal"; import { EventType, EventTypeConfig, useEventTypes } from "@ui/hooks/event-types"; -import { CheckIcon, EditIcon, ExternalLinkIcon, TrashIcon, XIcon } from "lucide-react"; +import { + CheckIcon, + EditIcon, + ExternalLinkIcon, + SettingsIcon, + TrashIcon, + XIcon, +} from "lucide-react"; +import { useState } from "react"; import { useUser } from "src/providers/UserStoreProvider"; export function EventTypeCard({ @@ -21,7 +29,9 @@ export function EventTypeCard({ }) { const { toggleEventType, deleteEventType } = useEventTypes(); const user = useUser(); - const getPublicLink = (standardName: string | null) => { + const [isEmbedModalOpen, setIsEmbedModalOpen] = useState(false); + + const getPublicLink = (standardName: string | null, isEmbed: boolean = false) => { // Sanitize user name for URL (replace spaces with hyphens, lowercase, remove special chars) const sanitizedUserName = user.name ?.toLowerCase() @@ -31,10 +41,12 @@ export function EventTypeCard({ const shortUserId = user.id.substring(0, 6); // Construct the public booking URL const baseUrl = window.location.origin; - const publicUrl = `${baseUrl}/book/${sanitizedUserName}-${shortUserId}/${standardName}`; - - return publicUrl; + if (isEmbed) { + return `${baseUrl}/embed/book/${sanitizedUserName}-${shortUserId}/${standardName}`; + } + return `${baseUrl}/book/${sanitizedUserName}-${shortUserId}/${standardName}`; }; + return ( {eventType.name}
+ -