From 31aac2db57196ed43e359f55e3e990e33f82aa07 Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Sun, 19 Apr 2026 03:39:05 +0100 Subject: [PATCH] change route --- app/(page)/create-news/create-news.tsx | 277 -------------- app/(page)/create-news/page.tsx | 22 -- app/(page)/dashboard/page.tsx | 338 ----------------- .../components/CategoryTree.tsx | 264 -------------- app/(page)/manage-category/page.tsx | 343 ------------------ app/(page)/panel/page.tsx | 188 ---------- 6 files changed, 1432 deletions(-) delete mode 100644 app/(page)/create-news/create-news.tsx delete mode 100644 app/(page)/create-news/page.tsx delete mode 100644 app/(page)/dashboard/page.tsx delete mode 100644 app/(page)/manage-category/components/CategoryTree.tsx delete mode 100644 app/(page)/manage-category/page.tsx delete mode 100644 app/(page)/panel/page.tsx diff --git a/app/(page)/create-news/create-news.tsx b/app/(page)/create-news/create-news.tsx deleted file mode 100644 index bfbfb37..0000000 --- a/app/(page)/create-news/create-news.tsx +++ /dev/null @@ -1,277 +0,0 @@ -"use client"; -import React, { useState, useRef, useEffect } from 'react'; -import Image from 'next/image'; -import { - LayoutDashboard, Newspaper, Users, BarChart3, - Settings, HelpCircle, Image as ImageIcon, - Type, Calendar, Clock, Tag, User, Save, Eye, Send -} from 'lucide-react'; - -// Importe o componente que criámos (ajuste o caminho se necessário) -import MultiAspectEditor from '../../components/MultiAspectEditor'; -import dynamic from "next/dynamic"; -import { AdminHeaderPage } from '@/app/components/layout/admin/header'; -import { AdminSideBar } from '@/app/components/layout/admin/sidebar'; -// import { keycloak } from '@/app/feature/auth/keycloak-config'; -const Editor = dynamic( - () => import("@tinymce/tinymce-react").then((mod) => mod.Editor), - { ssr: false } -); - - -export const CreateNewsPage = () => { - - // Configuração do Design do Editor para combinar com seu layout - const editorConfig = { - height: 500, - menubar: false, - plugins: [ - 'advlist', 'autolink', 'lists', 'link', 'image', 'charmap', 'preview', - 'anchor', 'searchreplace', 'visualblocks', 'code', 'fullscreen', - 'insertdatetime', 'media', 'table', 'code', 'help', 'wordcount' - ], - // Adicionei 'blockquote' na toolbar - toolbar: 'undo redo | blocks | ' + - 'bold italic forecolor | alignleft aligncenter ' + - 'alignright alignjustify | bullist numlist | ' + - 'blockquote link image | removeformat | help', - - // Customização do aspeto da citação dentro do editor - content_style: ` - body { - font-family: Inter, Helvetica, Arial, sans-serif; - font-size: 14px; - color: #334155; - line-height: 1.6; - } - blockquote { - border-left: 4px solid #2563eb; /* Azul da TVone */ - padding-left: 1.5rem; - color: #475569; - font-style: italic; - margin: 1.5rem 0; - background: #f8fafc; - padding: 1rem 1.5rem; - border-radius: 0 8px 8px 0; - } - `, - skin: 'oxide', - promotion: false, // Remove o botão "Upgrade" do Tiny - branding: false, // Remove o "Powered by Tiny" - }; - - // 1. Estados para o Crop - const [tempImage, setTempImage] = useState(null); - const [isEditorOpen, setIsEditorOpen] = useState(false); - const [finalCrops, setFinalCrops] = useState(null); // Guarda os Base64 finais - const [content, setContent] = useState(''); - const [user, setUser] = useState<{ - email?: string; - name?: string; - picture?: string; - } | null>(null); - - const fileInputRef = useRef(null); - - // 2. Lógica de Upload - const handleFileChange = (e: React.ChangeEvent) => { - if (e.target.files && e.target.files.length > 0) { - const reader = new FileReader(); - reader.readAsDataURL(e.target.files[0]); - reader.onload = () => { - setTempImage(reader.result as string); - setIsEditorOpen(true); - }; - } - }; - - const triggerUpload = () => { - fileInputRef.current?.click(); - }; - - // Avoid hydration mismatch by waiting for mount - // useEffect(() => { - // keycloak.init({ - // onLoad: "check-sso", - // pkceMethod: "S256", - // }).then(async (authenticated) => { - // if (authenticated) { - // const token = keycloak.token!; - // localStorage.setItem("token", token); - - // // 👉 send token to Next.js backend - // fetch("/api/session", { - // method: "POST", - // body: JSON.stringify({ token }), - // }); - - - // const res = await fetch("http://localhost:3001/profile/", { - // headers: { - // //Authorization: `Bearer ${token}`, - // }, - // }); - - // const profile = await res.json(); - - // var keycloakData : { - // email: string, - // email_verified: boolean, - // name: string, - // picture: string, - // roles: string[] - // } = profile.keycloak - - // setUser(keycloakData); - // console.log("Profile:", keycloakData); - // } - // }); - // }, []); - - return ( -
-
-

Criar Nova Notícia

-
- - -
-
- -
- {/* Coluna Principal */} -
-
- {/* Título */} -
- - -
- -
- - {/* TinyMCE Editor */} -
- setContent(newContent)} - /> -
-
- - {/* Resumo (Lead) */} -
- -