watch provider text language dependent
This commit is contained in:
		
							parent
							
								
									c1eab915da
								
							
						
					
					
						commit
						a5f9972b28
					
				| 
						 | 
					@ -56,7 +56,7 @@ main {
 | 
				
			||||||
  background-color: rgba(0, 0, 0, 0.5);
 | 
					  background-color: rgba(0, 0, 0, 0.5);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  display: grid;
 | 
					  display: grid;
 | 
				
			||||||
  grid-template-rows: 1fr 2fr 2fr 1fr;
 | 
					  grid-template-rows: 1fr 1fr 2fr 1fr;
 | 
				
			||||||
  align-items: center;
 | 
					  align-items: center;
 | 
				
			||||||
  justify-content: center;
 | 
					  justify-content: center;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -73,13 +73,10 @@ main {
 | 
				
			||||||
    display: contents;
 | 
					    display: contents;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  margin: 0;
 | 
					 | 
				
			||||||
  grid-row: 2/ span 1;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  .chosen-movie-poster {
 | 
					  .chosen-movie-poster {
 | 
				
			||||||
 | 
					    grid-row: 2/ span 1;
 | 
				
			||||||
    object-fit: cover;
 | 
					    object-fit: cover;
 | 
				
			||||||
    height: 100%;
 | 
					 | 
				
			||||||
    width: 100%;
 | 
					 | 
				
			||||||
    display: flex;
 | 
					    display: flex;
 | 
				
			||||||
    justify-content: center;
 | 
					    justify-content: center;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,7 +8,6 @@ import tmdb from './objects/tmdb'
 | 
				
			||||||
import { Sidebar } from './objects/sidebar'
 | 
					import { Sidebar } from './objects/sidebar'
 | 
				
			||||||
import { Movie } from './objects/movie-wall'
 | 
					import { Movie } from './objects/movie-wall'
 | 
				
			||||||
import CrossfadeImage from 'react-crossfade-image'
 | 
					import CrossfadeImage from 'react-crossfade-image'
 | 
				
			||||||
import { WhereToWatch } from './objects/whereToWatch'
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
export type Config = {
 | 
					export type Config = {
 | 
				
			||||||
  language: string,
 | 
					  language: string,
 | 
				
			||||||
| 
						 | 
					@ -65,7 +64,7 @@ function App() {
 | 
				
			||||||
      </div>
 | 
					      </div>
 | 
				
			||||||
      <main >
 | 
					      <main >
 | 
				
			||||||
        <HamburgerMenu config={config} setConfig={setConfig} />
 | 
					        <HamburgerMenu config={config} setConfig={setConfig} />
 | 
				
			||||||
        <Sidebar movie={chosenMovie} similarMoviesAvailable={similarMoviesAvailable} watchProviders={watchProviders} />
 | 
					        <Sidebar movie={chosenMovie} similarMoviesAvailable={similarMoviesAvailable} watchProviders={watchProviders} config={config} />
 | 
				
			||||||
        <div id="movie-wall-container">
 | 
					        <div id="movie-wall-container">
 | 
				
			||||||
          <MovieWall movies={movies}
 | 
					          <MovieWall movies={movies}
 | 
				
			||||||
            setMovies={setMovies}
 | 
					            setMovies={setMovies}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3,12 +3,14 @@ import { Movie } from "./movie-wall";
 | 
				
			||||||
import tmdb from "./tmdb";
 | 
					import tmdb from "./tmdb";
 | 
				
			||||||
import { WhereToWatch } from "./whereToWatch";
 | 
					import { WhereToWatch } from "./whereToWatch";
 | 
				
			||||||
import CrossfadeImage from 'react-crossfade-image'
 | 
					import CrossfadeImage from 'react-crossfade-image'
 | 
				
			||||||
 | 
					import { Config } from "../App";
 | 
				
			||||||
export interface SidebarProps extends React.ComponentPropsWithRef<"div"> {
 | 
					export interface SidebarProps extends React.ComponentPropsWithRef<"div"> {
 | 
				
			||||||
  movie: Movie;
 | 
					  movie: Movie;
 | 
				
			||||||
  similarMoviesAvailable: boolean;
 | 
					  similarMoviesAvailable: boolean;
 | 
				
			||||||
  watchProviders: {};
 | 
					  watchProviders: {};
 | 
				
			||||||
 | 
					  config: Config;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
export function Sidebar({ movie, similarMoviesAvailable, watchProviders }: SidebarProps) {
 | 
					export function Sidebar({ movie, similarMoviesAvailable, watchProviders, config }: SidebarProps) {
 | 
				
			||||||
  return <div id="sidebar">
 | 
					  return <div id="sidebar">
 | 
				
			||||||
    <h1>{movie?.title ?? "loading"}</h1>
 | 
					    <h1>{movie?.title ?? "loading"}</h1>
 | 
				
			||||||
    <a href={tmdb.makeMovieLink(movie)} target="_blank" rel="noopener noreferrer">
 | 
					    <a href={tmdb.makeMovieLink(movie)} target="_blank" rel="noopener noreferrer">
 | 
				
			||||||
| 
						 | 
					@ -19,7 +21,7 @@ export function Sidebar({ movie, similarMoviesAvailable, watchProviders }: Sideb
 | 
				
			||||||
      : movie.overview === "" ? "Resumen no disponible."
 | 
					      : movie.overview === "" ? "Resumen no disponible."
 | 
				
			||||||
        : movie.overview}
 | 
					        : movie.overview}
 | 
				
			||||||
    </p>
 | 
					    </p>
 | 
				
			||||||
    <WhereToWatch watchProviders={watchProviders} />
 | 
					    <WhereToWatch watchProviders={watchProviders} config={config} />
 | 
				
			||||||
  </div>
 | 
					  </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,5 +1,6 @@
 | 
				
			||||||
import React from "react"
 | 
					import React from "react"
 | 
				
			||||||
import tmdb from "./tmdb"
 | 
					import tmdb from "./tmdb"
 | 
				
			||||||
 | 
					import { Config } from "../App"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
interface WhereToWatchProps extends React.ComponentPropsWithRef<"div"> {
 | 
					interface WhereToWatchProps extends React.ComponentPropsWithRef<"div"> {
 | 
				
			||||||
  watchProviders: {
 | 
					  watchProviders: {
 | 
				
			||||||
| 
						 | 
					@ -7,7 +8,6 @@ interface WhereToWatchProps extends React.ComponentPropsWithRef<"div"> {
 | 
				
			||||||
    rent: Array<{}>;
 | 
					    rent: Array<{}>;
 | 
				
			||||||
    buy: Array<{}>;
 | 
					    buy: Array<{}>;
 | 
				
			||||||
    link: string;
 | 
					    link: string;
 | 
				
			||||||
 | 
					 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
const sampleData = {
 | 
					const sampleData = {
 | 
				
			||||||
| 
						 | 
					@ -74,7 +74,7 @@ function watchProvidersExist(watchProviders: any) {
 | 
				
			||||||
  return watchProviders?.link
 | 
					  return watchProviders?.link
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
export function WhereToWatch({ watchProviders }: WhereToWatchProps) {
 | 
					export function WhereToWatch({ watchProviders, config }: WhereToWatchProps) {
 | 
				
			||||||
  console.log("Watch providers exist?" + watchProvidersExist(watchProviders))
 | 
					  console.log("Watch providers exist?" + watchProvidersExist(watchProviders))
 | 
				
			||||||
  if (!watchProvidersExist(watchProviders)) {
 | 
					  if (!watchProvidersExist(watchProviders)) {
 | 
				
			||||||
    console.group()
 | 
					    console.group()
 | 
				
			||||||
| 
						 | 
					@ -86,8 +86,8 @@ export function WhereToWatch({ watchProviders }: WhereToWatchProps) {
 | 
				
			||||||
  return <><footer id="sidebar-footer">
 | 
					  return <><footer id="sidebar-footer">
 | 
				
			||||||
    <div id="watch-providers-container">
 | 
					    <div id="watch-providers-container">
 | 
				
			||||||
      {watchProviders?.flatrate?.length > 0 ? <div className="watch-providers"><h1>Streaming:</h1><ProviderIcons providerList={watchProviders.flatrate} link={watchProviders.link} /></div> : ""}
 | 
					      {watchProviders?.flatrate?.length > 0 ? <div className="watch-providers"><h1>Streaming:</h1><ProviderIcons providerList={watchProviders.flatrate} link={watchProviders.link} /></div> : ""}
 | 
				
			||||||
      {watchProviders?.rent?.length > 0 ? <div className="watch-providers"><h1>Alquiler:</h1><ProviderIcons providerList={watchProviders.rent} link={watchProviders.link} /></div> : ""}
 | 
					      {watchProviders?.rent?.length > 0 ? <div className="watch-providers"><h1>{config.language == "es" ? "Alquiler:" : config.language == "en" ? "To Rent:" : ""}</h1><ProviderIcons providerList={watchProviders.rent} link={watchProviders.link} /></div> : ""}
 | 
				
			||||||
      {watchProviders?.buy?.length > 0 ? <div className="watch-providers"><h1>Comprar:</h1><ProviderIcons providerList={watchProviders.buy} link={watchProviders.link} /></div> : ""}
 | 
					      {watchProviders?.buy?.length > 0 ? <div className="watch-providers"><h1>{config.language == "es" ? "Comprar:" : config.language == "en" ? "To Buy:" : ""}</h1><ProviderIcons providerList={watchProviders.buy} link={watchProviders.link} /></div> : ""}
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
    <p>Powered by Just Watch.</p>
 | 
					    <p>Powered by Just Watch.</p>
 | 
				
			||||||
  </footer>
 | 
					  </footer>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue