mirror of
https://gitlab.com/foxixus/neomovies.git
synced 2025-10-28 01:48:50 +05:00
Release 2.3.1
This commit is contained in:
@@ -7,6 +7,7 @@ import { getImageUrl } from '@/lib/neoApi';
|
||||
import type { MovieDetails } from '@/lib/api';
|
||||
import MoviePlayer from '@/components/MoviePlayer';
|
||||
import FavoriteButton from '@/components/FavoriteButton';
|
||||
import Reactions from '@/components/Reactions';
|
||||
import { formatDate } from '@/lib/utils';
|
||||
import { PlayCircle, ArrowLeft } from 'lucide-react';
|
||||
|
||||
@@ -128,6 +129,10 @@ export default function MovieContent({ movieId, initialMovie }: MovieContentProp
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="mt-8">
|
||||
<Reactions mediaId={movie.id.toString()} mediaType="movie" />
|
||||
</div>
|
||||
|
||||
{/* Desktop-only Embedded Player */}
|
||||
{imdbId && (
|
||||
<div id="movie-player" className="mt-10 hidden md:block rounded-lg bg-secondary/50 p-4 shadow-inner">
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
'use client';
|
||||
|
||||
import { useAuth } from '@/hooks/useAuth';
|
||||
import { authAPI } from '@/lib/authApi';
|
||||
import toast from 'react-hot-toast';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { Loader2, User, LogOut, Trash2 } from 'lucide-react';
|
||||
import Modal from '@/components/ui/Modal';
|
||||
|
||||
export default function ProfilePage() {
|
||||
const { logout } = useAuth();
|
||||
@@ -11,6 +14,7 @@ export default function ProfilePage() {
|
||||
const [userName, setUserName] = useState<string | null>(null);
|
||||
const [userEmail, setUserEmail] = useState<string | null>(null);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [isModalOpen, setIsModalOpen] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
const token = localStorage.getItem('token');
|
||||
@@ -23,9 +27,17 @@ export default function ProfilePage() {
|
||||
}
|
||||
}, [router]);
|
||||
|
||||
const handleDeleteAccount = () => {
|
||||
// TODO: Implement account deletion logic
|
||||
alert('Функция удаления аккаунта в разработке.');
|
||||
const handleConfirmDelete = async () => {
|
||||
try {
|
||||
await authAPI.deleteAccount();
|
||||
toast.success('Аккаунт успешно удален.');
|
||||
setIsModalOpen(false);
|
||||
logout();
|
||||
} catch (error) {
|
||||
console.error('Failed to delete account:', error);
|
||||
toast.error('Не удалось удалить аккаунт. Попробуйте снова.');
|
||||
setIsModalOpen(false);
|
||||
}
|
||||
};
|
||||
|
||||
if (loading) {
|
||||
@@ -62,7 +74,7 @@ export default function ProfilePage() {
|
||||
<h2 className="text-xl font-bold text-red-500 mb-4">Опасная зона</h2>
|
||||
<p className="text-red-400 mb-6">Это действие нельзя будет отменить. Все ваши данные, включая избранное, будут удалены.</p>
|
||||
<button
|
||||
onClick={handleDeleteAccount}
|
||||
onClick={() => setIsModalOpen(true)}
|
||||
className="w-full sm:w-auto px-6 py-3 border border-transparent text-base font-medium rounded-lg text-white bg-red-600 hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 flex items-center justify-center gap-2"
|
||||
>
|
||||
<Trash2 size={20} />
|
||||
@@ -70,6 +82,14 @@ export default function ProfilePage() {
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<Modal
|
||||
isOpen={isModalOpen}
|
||||
onClose={() => setIsModalOpen(false)}
|
||||
onConfirm={handleConfirmDelete}
|
||||
title="Подтвердите удаление аккаунта"
|
||||
>
|
||||
<p>Вы уверены, что хотите навсегда удалить свой аккаунт? Все ваши данные, включая избранное и реакции, будут безвозвратно удалены. Это действие нельзя будет отменить.</p>
|
||||
</Modal>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import { getImageUrl } from '@/lib/neoApi';
|
||||
import type { TVShowDetails } from '@/lib/api';
|
||||
import MoviePlayer from '@/components/MoviePlayer';
|
||||
import FavoriteButton from '@/components/FavoriteButton';
|
||||
import Reactions from '@/components/Reactions';
|
||||
import { formatDate } from '@/lib/utils';
|
||||
import { PlayCircle, ArrowLeft } from 'lucide-react';
|
||||
|
||||
@@ -132,6 +133,10 @@ export default function TVContent({ showId, initialShow }: TVContentProps) {
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="mt-8">
|
||||
<Reactions mediaId={show.id.toString()} mediaType="tv" />
|
||||
</div>
|
||||
|
||||
{imdbId && (
|
||||
<div id="movie-player" className="mt-10 hidden md:block rounded-lg bg-secondary/50 p-4 shadow-inner">
|
||||
<MoviePlayer
|
||||
|
||||
Reference in New Issue
Block a user