Update HomePage.jsx
This commit is contained in:
parent
d10394c015
commit
ef393743cb
@ -1,9 +1,9 @@
|
|||||||
import React, { useState, useEffect } from 'react';
|
import React, { useState, useEffect } from "react";
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from "react-router-dom";
|
||||||
import { useMedia } from '../contexts/MediaContext';
|
import { useMedia } from "../contexts/MediaContext";
|
||||||
import { useAuth } from '../contexts/AuthContext';
|
import { useAuth } from "../contexts/AuthContext";
|
||||||
import { listMedia } from '../services/supabase';
|
import { listMedia } from "../services/supabase";
|
||||||
import { mediaTypes } from '../services/mediaService';
|
import { mediaTypes } from "../services/mediaService";
|
||||||
import { FiTrendingUp, FiCalendar, FiAward } from "react-icons/fi";
|
import { FiTrendingUp, FiCalendar, FiAward } from "react-icons/fi";
|
||||||
import MediaCarousel from "../components/media/MediaCarousel";
|
import MediaCarousel from "../components/media/MediaCarousel";
|
||||||
import { getImageUrl } from "../services/tmdbApi";
|
import { getImageUrl } from "../services/tmdbApi";
|
||||||
@ -27,8 +27,8 @@ const HomePage = () => {
|
|||||||
|
|
||||||
setMedia(data || []);
|
setMedia(data || []);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error loading media:', err);
|
console.error("Error loading media:", err);
|
||||||
setError('Не удалось загрузить контент');
|
setError("Не удалось загрузить контент");
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
@ -68,11 +68,8 @@ const HomePage = () => {
|
|||||||
<h1 className="text-3xl font-bold text-campfire-light">
|
<h1 className="text-3xl font-bold text-campfire-light">
|
||||||
Добро пожаловать в CampFire
|
Добро пожаловать в CampFire
|
||||||
</h1>
|
</h1>
|
||||||
{user?.role === 'admin' && (
|
{user?.role === "admin" && (
|
||||||
<Link
|
<Link to="/admin/media" className="btn-secondary">
|
||||||
to="/admin/media"
|
|
||||||
className="btn-secondary"
|
|
||||||
>
|
|
||||||
Управление контентом
|
Управление контентом
|
||||||
</Link>
|
</Link>
|
||||||
)}
|
)}
|
||||||
@ -98,7 +95,7 @@ const HomePage = () => {
|
|||||||
<div className="p-4">
|
<div className="p-4">
|
||||||
<div className="flex items-center justify-between mb-2">
|
<div className="flex items-center justify-between mb-2">
|
||||||
<span className="text-xs font-medium px-2 py-1 rounded-full bg-campfire-amber/20 text-campfire-amber">
|
<span className="text-xs font-medium px-2 py-1 rounded-full bg-campfire-amber/20 text-campfire-amber">
|
||||||
{item.type === 'movie' ? 'Фильм' : 'Сериал'}
|
{item.type === "movie" ? "Фильм" : "Сериал"}
|
||||||
</span>
|
</span>
|
||||||
<span className="text-sm text-campfire-ash">
|
<span className="text-sm text-campfire-ash">
|
||||||
{new Date(item.release_date).getFullYear()}
|
{new Date(item.release_date).getFullYear()}
|
||||||
@ -120,11 +117,8 @@ const HomePage = () => {
|
|||||||
<p className="text-campfire-ash text-lg">
|
<p className="text-campfire-ash text-lg">
|
||||||
Пока нет доступного контента
|
Пока нет доступного контента
|
||||||
</p>
|
</p>
|
||||||
{user?.role === 'admin' && (
|
{user?.role === "admin" && (
|
||||||
<Link
|
<Link to="/admin/media" className="inline-block mt-4 btn-primary">
|
||||||
to="/admin/media"
|
|
||||||
className="inline-block mt-4 btn-primary"
|
|
||||||
>
|
|
||||||
Добавить контент
|
Добавить контент
|
||||||
</Link>
|
</Link>
|
||||||
)}
|
)}
|
||||||
|
Loading…
Reference in New Issue
Block a user