diff --git a/src/frontend/apps/mardownPDF/.eslintrc.cjs b/src/frontend/apps/mardownPDF/.eslintrc.cjs deleted file mode 100644 index d6c953795..000000000 --- a/src/frontend/apps/mardownPDF/.eslintrc.cjs +++ /dev/null @@ -1,18 +0,0 @@ -module.exports = { - root: true, - env: { browser: true, es2020: true }, - extends: [ - 'eslint:recommended', - 'plugin:@typescript-eslint/recommended', - 'plugin:react-hooks/recommended', - ], - ignorePatterns: ['dist', '.eslintrc.cjs'], - parser: '@typescript-eslint/parser', - plugins: ['react-refresh'], - rules: { - 'react-refresh/only-export-components': [ - 'warn', - { allowConstantExport: true }, - ], - }, -} diff --git a/src/frontend/apps/mardownPDF/app/favicon.ico b/src/frontend/apps/mardownPDF/app/favicon.ico deleted file mode 100644 index 718d6fea4..000000000 Binary files a/src/frontend/apps/mardownPDF/app/favicon.ico and /dev/null differ diff --git a/src/frontend/apps/mardownPDF/app/globals.css b/src/frontend/apps/mardownPDF/app/globals.css deleted file mode 100644 index 52a8d2d55..000000000 --- a/src/frontend/apps/mardownPDF/app/globals.css +++ /dev/null @@ -1,76 +0,0 @@ -@tailwind base; -@tailwind components; -@tailwind utilities; - -@layer base { - :root { - --background: 0 0% 100%; - --foreground: 0 0% 3.9%; - - --card: 0 0% 100%; - --card-foreground: 0 0% 3.9%; - - --popover: 0 0% 100%; - --popover-foreground: 0 0% 3.9%; - - --primary: 0 0% 9%; - --primary-foreground: 0 0% 98%; - - --secondary: 0 0% 96.1%; - --secondary-foreground: 0 0% 9%; - - --muted: 0 0% 96.1%; - --muted-foreground: 0 0% 45.1%; - - --accent: 0 0% 96.1%; - --accent-foreground: 0 0% 9%; - - --destructive: 0 84.2% 60.2%; - --destructive-foreground: 0 0% 98%; - - --border: 0 0% 89.8%; - --input: 0 0% 89.8%; - --ring: 0 0% 3.9%; - - --radius: 0.5rem; - } - - .dark { - --background: 0 0% 3.9%; - --foreground: 0 0% 98%; - - --card: 0 0% 3.9%; - --card-foreground: 0 0% 98%; - - --popover: 0 0% 3.9%; - --popover-foreground: 0 0% 98%; - - --primary: 0 0% 98%; - --primary-foreground: 0 0% 9%; - - --secondary: 0 0% 14.9%; - --secondary-foreground: 0 0% 98%; - - --muted: 0 0% 14.9%; - --muted-foreground: 0 0% 63.9%; - - --accent: 0 0% 14.9%; - --accent-foreground: 0 0% 98%; - - --destructive: 0 62.8% 30.6%; - --destructive-foreground: 0 0% 98%; - - --border: 0 0% 14.9%; - --input: 0 0% 14.9%; - --ring: 0 0% 83.1%; - } -} - -@layer base { - * { - @apply border-border; - } - body { - @apply bg-background text-foreground; - } -} \ No newline at end of file diff --git a/src/frontend/apps/mardownPDF/app/layout.tsx b/src/frontend/apps/mardownPDF/app/layout.tsx deleted file mode 100644 index 40e027fbe..000000000 --- a/src/frontend/apps/mardownPDF/app/layout.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import type { Metadata } from 'next' -import { Inter } from 'next/font/google' -import './globals.css' - -const inter = Inter({ subsets: ['latin'] }) - -export const metadata: Metadata = { - title: 'Create Next App', - description: 'Generated by create next app', -} - -export default function RootLayout({ - children, -}: { - children: React.ReactNode -}) { - return ( - - {children} - - ) -} diff --git a/src/frontend/apps/mardownPDF/app/page.tsx b/src/frontend/apps/mardownPDF/app/page.tsx deleted file mode 100644 index 05a0803b8..000000000 --- a/src/frontend/apps/mardownPDF/app/page.tsx +++ /dev/null @@ -1,157 +0,0 @@ -'use client'; - -import Image from 'next/image' -import {Button} from "@/components/ui/button"; -import React, {useEffect, useState} from "react"; -import {Textarea} from "@/components/ui/textarea"; -import {Input} from "@/components/ui/input"; -import {Form} from "@/components/ui/form"; - - -import * as z from "zod" -import {useForm} from "react-hook-form"; -import {zodResolver} from "@hookform/resolvers/zod"; -import {FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage} from "@/components/ui/form"; -import {Select, SelectContent, SelectItem, SelectTrigger, SelectValue} from "@/components/ui/select"; -import {Toaster} from "@/components/ui/sonner"; -import {toast} from "sonner"; - -const formSchema = z.object({ - body: z.string(), - template_id: z.string() -}) - -export default function Home() { - - - const [templates, setTemplates] = useState([]); - const [isFetching, setIsFetching] = useState(false); - - const fetchTemplates = async () => { - const res= await fetch('http://localhost:8071/api/templates'); - if (!res.ok) { - // This will activate the closest `error.js` Error Boundary - throw new Error('Failed to fetch data') - } - const templates = await res.json() - setTemplates(templates); - }; - - useEffect( () => { - fetchTemplates(); - }, []) - - const form = useForm>({ - resolver: zodResolver(formSchema), - defaultValues: { - body: "", - template_id: "", - }, - }) - - function download(blob, filename) { - const url = window.URL.createObjectURL(blob); - const a = document.createElement('a'); - a.style.display = 'none'; - a.href = url; - // the filename you want - a.download = filename; - document.body.appendChild(a); - a.click(); - document.body.removeChild(a); - window.URL.revokeObjectURL(url); - } - - const generateDocument = async (values: any) => { - const res = await fetch('http://localhost:8071/api/generate-document/', - { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - }, - body: JSON.stringify(values), - }) - - if (!res.ok) { - // This will activate the closest `error.js` Error Boundary - throw new Error('Failed to generate document') - } - - return await res.blob() - } - - async function onSubmit(values: z.infer) { - // Do something with the form values. - // ✅ This will be type-safe and validated. - setIsFetching(true) - - try { - const document = await generateDocument(values) - download(document, "wip.pdf") - - toast("Fichier téléchargé.", { - description: "Nous avons généré votre document à partir du template sélectionné.", - }) - setIsFetching(false) - - } catch (e) { - setIsFetching(false) - } - } - - return ( -
-
- - - - Imprint -
-
-
- - ( - - Contenu - -