diff --git a/src/app/[locale]/(auth)/layout.tsx b/src/app/[locale]/(auth)/layout.tsx
index b533ea9..eea5f9d 100644
--- a/src/app/[locale]/(auth)/layout.tsx
+++ b/src/app/[locale]/(auth)/layout.tsx
@@ -1,14 +1,10 @@
'use client';
-import Footer from '@/components/layout/footer/footer';
-import { Box, Flex } from '@chakra-ui/react';
-
function AuthLayout({ children }: { children: React.ReactNode }) {
return (
-
- {children}
-
-
+
- {(previewData.author?.name ?? previewData.authorName ?? "X")?.[0]}
+ {(previewData.tweet?.author?.name ?? "X")?.[0]}
- {previewData.author?.name ?? previewData.authorName ?? "Kullanıcı"}
+ {previewData.tweet?.author?.name ?? "Kullanıcı"}
- @{previewData.author?.handle ?? previewData.authorHandle ?? "handle"}
+ @{previewData.tweet?.author?.username ?? "handle"}
{/* Content */}
- {previewData.text ?? previewData.content ?? ""}
+ {previewData.tweet?.text ?? ""}
{/* Images */}
- {(previewData.images?.length > 0 || previewData.mediaUrls?.length > 0) && (
+ {(previewData.tweet?.media?.length > 0) && (
- {(previewData.images ?? previewData.mediaUrls ?? []).map(
- (url: string, i: number) => (
+ {(previewData.tweet.media ?? [])
+ .filter((m: any) => m.type === 'photo')
+ .map(
+ (m: any, i: number) => (
{/* eslint-disable-next-line @next/next/no-img-element */}

@@ -220,30 +227,38 @@ export default function XToVideoPage() {
- {previewData.likes ?? previewData.stats?.likes ?? 0}
+ {previewData.tweet?.metrics?.likes ?? 0}
- {previewData.retweets ?? previewData.stats?.retweets ?? 0}
+ {previewData.tweet?.metrics?.retweets ?? 0}
- {previewData.views ?? previewData.stats?.views ?? 0}
+ {previewData.tweet?.metrics?.views ?? 0}
- {previewData.threadLength > 1 && (
+ {previewData.tweet?.isThread && (
- {previewData.threadLength} tweet thread
+ {previewData.tweet?.threadTweets?.length ?? 0} tweet thread
)}
+ {/* Suggested info */}
+ {previewData.suggestedTitle && (
+
+
+ Önerilen başlık: {previewData.suggestedTitle} · Tahmini süre: {previewData.estimatedDuration}sn · Viral skoru: {previewData.viralScore}/100
+
+ )}
+
{/* Images tag */}
- {(previewData.images?.length > 0 || previewData.mediaUrls?.length > 0) && (
+ {(previewData.tweet?.media?.filter((m: any) => m.type === 'photo')?.length > 0) && (
- {(previewData.images ?? previewData.mediaUrls ?? []).length} görsel referans olarak kullanılacak + AI görsel üretilecek
+ {previewData.tweet.media.filter((m: any) => m.type === 'photo').length} görsel referans olarak kullanılacak + AI görsel üretilecek
)}
diff --git a/src/app/api/auth/[...nextauth]/route.ts b/src/app/api/auth/[...nextauth]/route.ts
index 55dfbc1..156bc72 100644
--- a/src/app/api/auth/[...nextauth]/route.ts
+++ b/src/app/api/auth/[...nextauth]/route.ts
@@ -1,5 +1,4 @@
-import baseUrl from "@/config/base-url";
-import { authService } from "@/lib/api/example/auth/service";
+import { authApi } from "@/lib/api/api-service";
import NextAuth from "next-auth";
import Credentials from "next-auth/providers/credentials";
@@ -38,22 +37,19 @@ const handler = NextAuth({
}
// Normal mod: backend'e istek at
- const res = await authService.login({
+ const res = await authApi.login({
email: credentials.email,
password: credentials.password,
});
- console.log("res", res);
-
- const response = res;
-
- // Backend returns ApiResponse
- // Structure: { data: { accessToken, refreshToken, expiresIn, user }, message, statusCode }
- if (!res.success || !response?.data?.accessToken) {
- throw new Error(response?.message || "Giriş başarısız");
+ // Axios interceptor otomatik unwrap yapıyor:
+ // Backend { success, data: { accessToken, refreshToken, user } } sarıyor
+ // Interceptor sonrası res = { accessToken, refreshToken, user }
+ if (!res?.accessToken) {
+ throw new Error("Giriş başarısız");
}
- const { accessToken, refreshToken, user } = response.data;
+ const { accessToken, refreshToken, user } = res;
return {
id: user.id,
diff --git a/src/components/layout/app-shell.tsx b/src/components/layout/app-shell.tsx
index 6209144..eba1f1b 100644
--- a/src/components/layout/app-shell.tsx
+++ b/src/components/layout/app-shell.tsx
@@ -2,11 +2,12 @@
import { usePathname } from "next/navigation";
import { motion, AnimatePresence } from "framer-motion";
-import { Home, FolderOpen, LayoutGrid, Settings, Sparkles, AtSign, ShieldCheck } from "lucide-react";
+import { Home, FolderOpen, LayoutGrid, Settings, Sparkles, AtSign, ShieldCheck, LogOut } from "lucide-react";
import Link from "next/link";
import { cn } from "@/lib/utils";
import { useCreditBalance, useCurrentUser } from "@/hooks/use-api";
import { NotificationsDropdown } from "./notifications-dropdown";
+import { signOut } from "next-auth/react";
const navItems = [
{ href: "/dashboard", icon: Home, label: "Ana Sayfa" },
@@ -66,13 +67,13 @@ export function MobileNav() {
function CreditCard() {
const { data, isLoading } = useCreditBalance();
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- const remaining = (data as any)?.data?.remaining ?? (data as any)?.remaining ?? 0;
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- const total = (data as any)?.data?.total ?? (data as any)?.total ?? 50;
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- const planName = (data as any)?.data?.plan ?? (data as any)?.plan ?? "Free";
- const pct = total > 0 ? Math.round((remaining / total) * 100) : 0;
+ // Axios interceptor unwrap sonrası data doğrudan backend yanıtı
+ const creditData = data as any;
+ const isAdmin = creditData?.isAdmin === true;
+ const remaining = creditData?.remaining ?? creditData?.balance ?? 0;
+ const total = creditData?.total ?? creditData?.monthlyLimit ?? 50;
+ const planName = creditData?.plan ?? "Free";
+ const pct = isAdmin ? 100 : (total > 0 ? Math.round((remaining / total) * 100) : 0);
return (
@@ -81,7 +82,7 @@ function CreditCard() {
{planName}
- {isLoading ? "..." : remaining}
+ {isLoading ? "..." : isAdmin ? "∞" : remaining}
- {total} kredilik planınızın {remaining}'{remaining === 1 ? "i" : "si"} kaldı
+ {isAdmin ? "Sınırsız admin erişimi" : `${total} kredilik planınızın ${remaining}'${remaining === 1 ? "i" : "si"} kaldı`}
);
@@ -106,6 +107,10 @@ export function DesktopSidebar() {
const roles: string[] = (user?.roles ?? []).map((r: any) => r?.role?.name ?? r?.name ?? "");
const isAdmin = roles.includes("admin") || roles.includes("superadmin");
+ const handleLogout = () => {
+ signOut({ redirect: true, callbackUrl: "/signin" });
+ };
+
return (