-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #517 from meilisearch/feat/add-similar-movies
Add similar movies
- Loading branch information
Showing
35 changed files
with
638 additions
and
375 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,21 @@ | ||
import dotenv from 'dotenv'; | ||
import dotenv from 'dotenv' | ||
|
||
dotenv.config(); // load environment variables from a .env file into process.env | ||
dotenv.config() // load environment variables from a .env file into process.env | ||
|
||
export const checkEnv = (variables: string | string[]) => { | ||
export const checkEnv = (variables: string | string[]) => { | ||
if (Array.isArray(variables)) { | ||
variables.forEach(variable => { | ||
if (process.env[variable] === undefined) { | ||
throw new Error(`Please set the ${variable} environment variable.`); | ||
throw new Error(`Please set the ${variable} environment variable.`) | ||
} | ||
}) | ||
return | ||
} | ||
if (process.env[variables] === undefined) { | ||
throw new Error(`Please set the ${variables} environment variable.`); | ||
throw new Error(`Please set the ${variables} environment variable.`) | ||
} | ||
} | ||
|
||
export const isUsingMeilisearchCloud = host => { | ||
return host.includes('edge.meilisearch') || host.includes('meilisearch.io') | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import React from 'react' | ||
import styled from 'styled-components' | ||
import { TwicImg } from '@twicpics/components/react' | ||
import { getTwicpicsUrl } from '~/utils' | ||
import { MOVIE_POSTER_ASPECT_RATIO } from '~/lib/constants' | ||
import Typography from 'components/Typography' | ||
import Rating from 'components/Rating' | ||
import { MovieData } from '~/types' | ||
import clsx from 'clsx' | ||
|
||
type CardProps = MovieData & { | ||
className?: string | ||
imageClassName?: string | ||
} | ||
|
||
const Title = styled(Typography)` | ||
color: var(--800-100); | ||
` | ||
|
||
const ReleaseYear = styled(Typography)` | ||
color: var(--gray-300); | ||
` | ||
|
||
const Card = ({ | ||
poster_path = '', | ||
title = '', | ||
release_date = '', | ||
vote_average, | ||
...props | ||
}: CardProps) => { | ||
const releaseYear = new Date(release_date).getFullYear() | ||
return ( | ||
<div className={clsx('flex flex-col', props.className)}> | ||
<div | ||
className={clsx( | ||
'rounded-lg overflow-hidden mb-2', | ||
props.imageClassName | ||
)} | ||
> | ||
<TwicImg | ||
src={getTwicpicsUrl('tmdb', poster_path)} | ||
ratio={MOVIE_POSTER_ASPECT_RATIO} | ||
className="w-full h-full object-cover" | ||
/> | ||
</div> | ||
<Title variant="cardTitle" className="text-wrap"> | ||
{title} | ||
</Title> | ||
<div className="flex items-center flex-wrap space-x-4"> | ||
<ReleaseYear variant="subtitle">{releaseYear}</ReleaseYear> | ||
<Rating rating={Math.round((vote_average / 2) * 10) / 10} /> | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
export default Card |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,17 @@ | ||
import React from 'react' | ||
import styled from 'styled-components' | ||
import People from 'components/People' | ||
import get from 'utils/get' | ||
|
||
const Peoples = styled.div` | ||
display: grid; | ||
grid-template-columns: repeat(4, 1fr); | ||
grid-gap: 24px; | ||
@media (min-width: ${get('breakpoints.desktop')}) { | ||
margin-top: 22px; | ||
grid-template-columns: repeat(8, 1fr); | ||
grid-gap: 30px; | ||
} | ||
` | ||
import clsx from 'clsx' | ||
|
||
const Cast = ({ cast, ...props }) => ( | ||
<Peoples {...props}> | ||
<div {...props} className={clsx('flex flex-wrap gap-6', props.className)}> | ||
{cast.map((people, index) => ( | ||
<People | ||
key={`${people?.name}-${people?.character || index}`} | ||
people={people} | ||
data-cast={people?.name} | ||
/> | ||
))} | ||
</Peoples> | ||
</div> | ||
) | ||
|
||
export default Cast |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.