From ca0242d3802d4ef7c20a071e60c0a541761545ee Mon Sep 17 00:00:00 2001 From: Felipe Coutinho Date: Tue, 20 Jan 2026 16:41:05 +0000 Subject: [PATCH] =?UTF-8?q?chore:=20remove=20implementa=C3=A7=C3=A3o=20do?= =?UTF-8?q?=20changelog?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove página /changelog e seus arquivos - Remove componentes ChangelogLink e ChangelogList - Remove referência do header-dashboard --- app/(dashboard)/changelog/layout.tsx | 23 --- app/(dashboard)/changelog/loading.tsx | 31 ---- app/(dashboard)/changelog/page.tsx | 102 ------------ components/changelog/changelog-link.tsx | 34 ---- components/changelog/changelog-list.tsx | 200 ------------------------ components/header-dashboard.tsx | 2 - 6 files changed, 392 deletions(-) delete mode 100644 app/(dashboard)/changelog/layout.tsx delete mode 100644 app/(dashboard)/changelog/loading.tsx delete mode 100644 app/(dashboard)/changelog/page.tsx delete mode 100644 components/changelog/changelog-link.tsx delete mode 100644 components/changelog/changelog-list.tsx diff --git a/app/(dashboard)/changelog/layout.tsx b/app/(dashboard)/changelog/layout.tsx deleted file mode 100644 index 07c7d03..0000000 --- a/app/(dashboard)/changelog/layout.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import PageDescription from "@/components/page-description"; -import { RiGitCommitLine } from "@remixicon/react"; - -export const metadata = { - title: "Changelog | Opensheets", -}; - -export default function RootLayout({ - children, -}: { - children: React.ReactNode; -}) { - return ( -
- } - title="Changelog" - subtitle="Histórico completo de alterações e atualizações do projeto." - /> - {children} -
- ); -} diff --git a/app/(dashboard)/changelog/loading.tsx b/app/(dashboard)/changelog/loading.tsx deleted file mode 100644 index 13d5185..0000000 --- a/app/(dashboard)/changelog/loading.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import { Card, CardContent, CardHeader } from "@/components/ui/card"; -import { Skeleton } from "@/components/ui/skeleton"; - -export default function Loading() { - return ( -
-
- - -
- -
- {[...Array(5)].map((_, i) => ( - - - -
- - - -
-
- - - -
- ))} -
-
- ); -} diff --git a/app/(dashboard)/changelog/page.tsx b/app/(dashboard)/changelog/page.tsx deleted file mode 100644 index 16ec8b3..0000000 --- a/app/(dashboard)/changelog/page.tsx +++ /dev/null @@ -1,102 +0,0 @@ -import { ChangelogList } from "@/components/changelog/changelog-list"; -import { execSync } from "child_process"; - -type GitCommit = { - hash: string; - shortHash: string; - author: string; - date: string; - message: string; - body: string; - filesChanged: string[]; -}; - -function getGitRemoteUrl(): string | null { - try { - const remoteUrl = execSync("git config --get remote.origin.url", { - encoding: "utf-8", - cwd: process.cwd(), - }).trim(); - - // Converter SSH para HTTPS se necessário - if (remoteUrl.startsWith("git@")) { - return remoteUrl - .replace("git@github.com:", "https://github.com/") - .replace("git@gitlab.com:", "https://gitlab.com/") - .replace(".git", ""); - } - - return remoteUrl.replace(".git", ""); - } catch (error) { - console.error("Error fetching git remote URL:", error); - return null; - } -} - -function getGitCommits(): GitCommit[] { - try { - // Buscar os últimos 50 commits - const commits = execSync( - 'git log -50 --pretty=format:"%H|%h|%an|%ad|%s|%b" --date=iso --name-only', - { - encoding: "utf-8", - cwd: process.cwd(), - } - ) - .trim() - .split("\n\n"); - - return commits - .map((commitBlock) => { - const lines = commitBlock.split("\n"); - const [hash, shortHash, author, date, message, ...rest] = - lines[0].split("|"); - - // Separar body e arquivos - const bodyLines: string[] = []; - const filesChanged: string[] = []; - let isBody = true; - - rest.forEach((line) => { - if (line && !line.includes("/") && !line.includes(".")) { - bodyLines.push(line); - } else { - isBody = false; - } - }); - - lines.slice(1).forEach((line) => { - if (line.trim()) { - filesChanged.push(line.trim()); - } - }); - - return { - hash, - shortHash, - author, - date, - message, - body: bodyLines.join("\n").trim(), - filesChanged: filesChanged.filter( - (f) => f && !f.startsWith("git log") - ), - }; - }) - .filter((commit) => commit.hash && commit.message); - } catch (error) { - console.error("Error fetching git commits:", error); - return []; - } -} - -export default async function ChangelogPage() { - const commits = getGitCommits(); - const repoUrl = getGitRemoteUrl(); - - return ( -
- -
- ); -} diff --git a/components/changelog/changelog-link.tsx b/components/changelog/changelog-link.tsx deleted file mode 100644 index ba2735b..0000000 --- a/components/changelog/changelog-link.tsx +++ /dev/null @@ -1,34 +0,0 @@ -"use client"; - -import { buttonVariants } from "@/components/ui/button"; -import { - Tooltip, - TooltipContent, - TooltipTrigger, -} from "@/components/ui/tooltip"; -import { cn } from "@/lib/utils"; -import { RiGitCommitLine } from "@remixicon/react"; -import Link from "next/link"; - -export function ChangelogLink() { - return ( - - - - - Changelog - - - - Changelog - - - ); -} diff --git a/components/changelog/changelog-list.tsx b/components/changelog/changelog-list.tsx deleted file mode 100644 index 4349ac8..0000000 --- a/components/changelog/changelog-list.tsx +++ /dev/null @@ -1,200 +0,0 @@ -"use client"; - -import { Badge } from "@/components/ui/badge"; -import { Card, CardContent, CardHeader } from "@/components/ui/card"; -import { - Accordion, - AccordionContent, - AccordionItem, - AccordionTrigger, -} from "@/components/ui/accordion"; -import { formatDistanceToNow } from "date-fns"; -import { ptBR } from "date-fns/locale"; -import { - RiGitCommitLine, - RiUserLine, - RiCalendarLine, - RiFileList2Line, -} from "@remixicon/react"; - -type GitCommit = { - hash: string; - shortHash: string; - author: string; - date: string; - message: string; - body: string; - filesChanged: string[]; -}; - -type ChangelogListProps = { - commits: GitCommit[]; - repoUrl: string | null; -}; - -type CommitType = { - type: string; - scope?: string; - description: string; -}; - -function parseCommitMessage(message: string): CommitType { - const conventionalPattern = /^(\w+)(?:$$([^)]+)$$)?:\s*(.+)$/; - const match = message.match(conventionalPattern); - - if (match) { - return { - type: match[1], - scope: match[2], - description: match[3], - }; - } - - return { - type: "chore", - description: message, - }; -} - -function getCommitTypeColor(type: string): string { - const colors: Record = { - feat: "bg-emerald-500/10 text-emerald-700 dark:text-emerald-400 border-emerald-500/20", - fix: "bg-red-500/10 text-red-700 dark:text-red-400 border-red-500/20", - docs: "bg-blue-500/10 text-blue-700 dark:text-blue-400 border-blue-500/20", - style: - "bg-purple-500/10 text-purple-700 dark:text-purple-400 border-purple-500/20", - refactor: - "bg-orange-500/10 text-orange-700 dark:text-orange-400 border-orange-500/20", - perf: "bg-yellow-500/10 text-yellow-700 dark:text-yellow-400 border-yellow-500/20", - test: "bg-pink-500/10 text-pink-700 dark:text-pink-400 border-pink-500/20", - chore: "bg-gray-500/10 text-gray-700 dark:text-gray-400 border-gray-500/20", - }; - - return colors[type] || colors.chore; -} - -export function ChangelogList({ commits, repoUrl }: ChangelogListProps) { - if (!commits || commits.length === 0) { - return ( -
-

- Nenhum commit encontrado no repositório -

-
- ); - } - - return ( -
- {commits.map((commit) => ( - - ))} -
- ); -} - -function CommitCard({ - commit, - repoUrl, -}: { - commit: GitCommit; - repoUrl: string | null; -}) { - const commitDate = new Date(commit.date); - const relativeTime = formatDistanceToNow(commitDate, { - addSuffix: true, - locale: ptBR, - }); - - const commitUrl = repoUrl ? `${repoUrl}/commit/${commit.hash}` : null; - const parsed = parseCommitMessage(commit.message); - - return ( - - -
- - {parsed.type} - - {parsed.scope && ( - - {parsed.scope} - - )} - - {parsed.description} - -
- -
- {commitUrl ? ( - - - {commit.shortHash} - - ) : ( - - - {commit.shortHash} - - )} - - - {commit.author} - - - - {relativeTime} - -
-
- - {commit.body && ( - - {commit.body} - - )} - - {commit.filesChanged.length > 0 && ( - - - - -
- - - {commit.filesChanged.length} arquivo - {commit.filesChanged.length !== 1 ? "s" : ""} - -
-
- -
    - {commit.filesChanged.map((file, index) => ( -
  • - {file} -
  • - ))} -
-
-
-
-
- )} -
- ); -} diff --git a/components/header-dashboard.tsx b/components/header-dashboard.tsx index 1a5584c..4b2795e 100644 --- a/components/header-dashboard.tsx +++ b/components/header-dashboard.tsx @@ -1,4 +1,3 @@ -import { ChangelogLink } from "@/components/changelog/changelog-link"; import { FeedbackDialog } from "@/components/feedback/feedback-dialog"; import { NotificationBell } from "@/components/notificacoes/notification-bell"; import { SidebarTrigger } from "@/components/ui/sidebar"; @@ -29,7 +28,6 @@ export async function SiteHeader({ notificationsSnapshot }: SiteHeaderProps) { | -