diff --git a/apps/client/src/ee/licence/components/activate-license-modal.tsx b/apps/client/src/ee/licence/components/activate-license-modal.tsx index 28b3d0d6..766d3f25 100644 --- a/apps/client/src/ee/licence/components/activate-license-modal.tsx +++ b/apps/client/src/ee/licence/components/activate-license-modal.tsx @@ -1,6 +1,6 @@ import { z } from "zod/v4"; -import React from "react"; -import { Button, Group, Modal, Textarea } from "@mantine/core"; +import React, { useRef } from "react"; +import { Button, Divider, Group, Modal, Stack, Textarea } from "@mantine/core"; import { useForm } from "@mantine/form"; import { zod4Resolver } from "mantine-form-zod-resolver"; import { useTranslation } from "react-i18next"; @@ -49,6 +49,7 @@ interface ActivateLicenseFormProps { export function ActivateLicenseForm({ onClose }: ActivateLicenseFormProps) { const { t } = useTranslation(); const activateLicenseMutation = useActivateMutation(); + const fileInputRef = useRef(null); const form = useForm({ validate: zod4Resolver(formSchema), @@ -63,29 +64,68 @@ export function ActivateLicenseForm({ onClose }: ActivateLicenseFormProps) { onClose?.(); } + function handleFileUpload(event: React.ChangeEvent) { + const file = event.target.files?.[0]; + if (!file) return; + + const reader = new FileReader(); + reader.onload = (e) => { + const content = (e.target?.result as string)?.trim(); + if (content) { + form.setFieldValue("licenseKey", content); + handleSubmit({ licenseKey: content }); + } + }; + reader.readAsText(file); + + if (fileInputRef.current) { + fileInputRef.current.value = ""; + } + } + return (
-