mirror of
https://gitlab.com/foxixus/neomovies.git
synced 2025-10-27 17:38:50 +05:00
Update 103 files
- /public/file.svg - /public/globe.svg - /public/next.svg - /public/vercel.svg - /public/window.svg - /public/google.svg - /public/logo.png - /src/eslint.config.mjs - /src/api.ts - /src/middleware.ts - /src/app/favicon.ico - /src/app/globals.css - /src/app/layout.tsx - /src/app/page.tsx - /src/app/providers.tsx - /src/app/not-found.tsx - /src/app/error.tsx - /src/app/metadata.ts - /src/app/styles.tsx - /src/app/api/auth/[...nextauth]/route.ts - /src/app/api/auth/register/route.ts - /src/app/api/auth/verify/route.ts - /src/app/api/auth/check-verification/route.ts - /src/app/api/auth/resend-code/route.ts - /src/app/api/movies/search/route.ts - /src/app/api/movies/sync/route.ts - /src/app/api/admin/send-verification/route.ts - /src/app/api/admin/verify-code/route.ts - /src/app/api/admin/movies/route.ts - /src/app/api/admin/movies/toggle-visibility/route.ts - /src/app/api/admin/create/route.ts - /src/app/api/admin/users/toggle-admin/route.ts - /src/app/api/admin/toggle-admin/route.ts - /src/app/login/page.tsx - /src/app/login/LoginClient.tsx - /src/app/verify/page.tsx - /src/app/verify/VerificationClient.tsx - /src/app/profile/page.tsx - /src/app/movie/[id]/page.tsx - /src/app/movie/[id]/MoviePage.tsx - /src/app/movie/[id]/MovieContent.tsx - /src/app/settings/page.tsx - /src/app/tv/[id]/page.tsx - /src/app/tv/[id]/TVShowPage.tsx - /src/app/tv/[id]/TVShowContent.tsx - /src/app/admin/login/page.tsx - /src/app/admin/login/AdminLoginClient.tsx - /src/lib/db.ts - /src/lib/jwt.ts - /src/lib/registry.tsx - /src/lib/api.ts - /src/lib/mongodb.ts - /src/lib/mailer.ts - /src/lib/auth.ts - /src/lib/utils.ts - /src/lib/email.ts - /src/lib/movieSync.ts - /src/models/User.ts - /src/models/index.ts - /src/models/Movie.ts - /src/types/auth.ts - /src/types/movie.ts - /src/components/MovieCard.tsx - /src/components/Notification.tsx - /src/components/Pagination.tsx - /src/components/GoogleIcon.tsx - /src/components/StyleProvider.tsx - /src/components/Providers.tsx - /src/components/VerificationCodeInput.tsx - /src/components/GlassCard.tsx - /src/components/AppLayout.tsx - /src/components/SearchModal.tsx - /src/components/DarkReaderFix.tsx - /src/components/ClientLayout.tsx - /src/components/MenuItem.tsx - /src/components/MoviePlayer.tsx - /src/components/PageLayout.tsx - /src/components/SettingsContent.tsx - /src/components/Navbar.tsx - /src/components/LayoutContent.tsx - /src/components/SearchResults.tsx - /src/components/Icons/Icons.tsx - /src/components/Icons/HeartIcon.tsx - /src/components/Icons/PlayIcon.tsx - /src/components/admin/MovieSearch.tsx - /src/hooks/useUser.ts - /src/hooks/useMovies.ts - /src/hooks/useSettings.ts - /src/hooks/useSearch.ts - /src/styles/GlobalStyles.ts - /src/styles/GlobalStyles.tsx - /src/providers/AuthProvider.tsx - /src/data/movies.ts - /types/next-auth.d.ts - /middleware.ts - /next.config.js - /next-env.d.ts - /package.json - /postcss.config.mjs - /README.md - /tailwind.config.ts - /tsconfig.json - /package-lock.json
This commit is contained in:
109
src/components/SearchResults.tsx
Normal file
109
src/components/SearchResults.tsx
Normal file
@@ -0,0 +1,109 @@
|
||||
'use client';
|
||||
|
||||
import React from 'react';
|
||||
import styled from 'styled-components';
|
||||
import Link from 'next/link';
|
||||
import Image from 'next/image';
|
||||
import { Movie, TVShow } from '@/lib/api';
|
||||
|
||||
const ResultsContainer = styled.div`
|
||||
max-height: 400px;
|
||||
overflow-y: auto;
|
||||
padding: 1rem;
|
||||
`;
|
||||
|
||||
const ResultItem = styled(Link)`
|
||||
display: flex;
|
||||
padding: 0.75rem;
|
||||
gap: 1rem;
|
||||
text-decoration: none;
|
||||
color: white;
|
||||
transition: background-color 0.2s;
|
||||
border-radius: 8px;
|
||||
|
||||
&:hover {
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
`;
|
||||
|
||||
const PosterContainer = styled.div`
|
||||
position: relative;
|
||||
width: 45px;
|
||||
height: 68px;
|
||||
flex-shrink: 0;
|
||||
border-radius: 0.25rem;
|
||||
overflow: hidden;
|
||||
background: rgba(0, 0, 0, 0.2);
|
||||
`;
|
||||
|
||||
const ItemInfo = styled.div`
|
||||
flex-grow: 1;
|
||||
`;
|
||||
|
||||
const Title = styled.h3`
|
||||
font-size: 1rem;
|
||||
margin-bottom: 0.25rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
`;
|
||||
|
||||
const Year = styled.span`
|
||||
font-size: 0.875rem;
|
||||
color: rgba(255, 255, 255, 0.6);
|
||||
`;
|
||||
|
||||
const Type = styled.span`
|
||||
font-size: 0.75rem;
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
padding: 0.25rem 0.5rem;
|
||||
border-radius: 1rem;
|
||||
`;
|
||||
|
||||
interface SearchResultsProps {
|
||||
results: (Movie | TVShow)[];
|
||||
onItemClick: () => void;
|
||||
}
|
||||
|
||||
export default function SearchResults({ results, onItemClick }: SearchResultsProps) {
|
||||
const getYear = (date: string) => {
|
||||
if (!date) return '';
|
||||
return new Date(date).getFullYear();
|
||||
};
|
||||
|
||||
const isMovie = (item: Movie | TVShow): item is Movie => {
|
||||
return 'title' in item;
|
||||
};
|
||||
|
||||
return (
|
||||
<ResultsContainer>
|
||||
{results.map((item) => (
|
||||
<ResultItem
|
||||
key={item.id}
|
||||
href={isMovie(item) ? `/movie/${item.id}` : `/tv/${item.id}`}
|
||||
onClick={onItemClick}
|
||||
>
|
||||
<PosterContainer>
|
||||
<Image
|
||||
src={item.poster_path
|
||||
? `https://image.tmdb.org/t/p/w92${item.poster_path}`
|
||||
: '/placeholder.png'}
|
||||
alt={isMovie(item) ? item.title : item.name}
|
||||
fill
|
||||
style={{ objectFit: 'cover' }}
|
||||
/>
|
||||
</PosterContainer>
|
||||
<ItemInfo>
|
||||
<Title>
|
||||
{isMovie(item) ? item.title : item.name}
|
||||
<Type>{isMovie(item) ? 'Фильм' : 'Сериал'}</Type>
|
||||
</Title>
|
||||
<Year>
|
||||
{getYear(isMovie(item) ? item.release_date : item.first_air_date)}
|
||||
</Year>
|
||||
</ItemInfo>
|
||||
</ResultItem>
|
||||
))}
|
||||
</ResultsContainer>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user