From 1e0620ffef5063d375aead64981e4a4b4899491c Mon Sep 17 00:00:00 2001 From: andrzej Date: Wed, 22 May 2024 15:05:38 +0200 Subject: [PATCH] watch provider text language dependent --- src/App.css | 7 ++----- src/App.tsx | 3 +-- src/objects/sidebar.tsx | 13 ++++++++++--- src/objects/tmdb.tsx | 1 - src/objects/whereToWatch.tsx | 10 +++++----- 5 files changed, 18 insertions(+), 16 deletions(-) diff --git a/src/App.css b/src/App.css index c6381f4..542a732 100644 --- a/src/App.css +++ b/src/App.css @@ -56,7 +56,7 @@ main { background-color: rgba(0, 0, 0, 0.5); display: grid; - grid-template-rows: 1fr 2fr 2fr 1fr; + grid-template-rows: 1fr 1fr 2fr 1fr; align-items: center; justify-content: center; @@ -73,13 +73,10 @@ main { display: contents; } - margin: 0; - grid-row: 2/ span 1; .chosen-movie-poster { + grid-row: 2/ span 1; object-fit: cover; - height: 100%; - width: 100%; display: flex; justify-content: center; } diff --git a/src/App.tsx b/src/App.tsx index 5b63726..d5ea452 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -8,7 +8,6 @@ import tmdb from './objects/tmdb' import { Sidebar } from './objects/sidebar' import { Movie } from './objects/movie-wall' import CrossfadeImage from 'react-crossfade-image' -import { WhereToWatch } from './objects/whereToWatch' export type Config = { language: string, @@ -65,7 +64,7 @@ function App() {
- +
{ movie: Movie; similarMoviesAvailable: boolean; watchProviders: {}; + config: Config; } -export function Sidebar({ movie, similarMoviesAvailable, watchProviders }: SidebarProps) { +export function Sidebar({ movie, similarMoviesAvailable, watchProviders, config }: SidebarProps) { + const apology = config.language == "es" ? + "Resumen no disponible" : + config.language == "en" ? + "Summary unavailable." : + "" return diff --git a/src/objects/tmdb.tsx b/src/objects/tmdb.tsx index 4d2b995..ffee17c 100644 --- a/src/objects/tmdb.tsx +++ b/src/objects/tmdb.tsx @@ -60,7 +60,6 @@ export default { .filter((e: Movie) => { return e.poster_path }) - // array.splice(19) if (array.length > 0) { setMovies(array) setSimilarMoviesAvailable(true) diff --git a/src/objects/whereToWatch.tsx b/src/objects/whereToWatch.tsx index 4f328f0..8e722d5 100644 --- a/src/objects/whereToWatch.tsx +++ b/src/objects/whereToWatch.tsx @@ -1,5 +1,6 @@ import React from "react" import tmdb from "./tmdb" +import { Config } from "../App" interface WhereToWatchProps extends React.ComponentPropsWithRef<"div"> { watchProviders: { @@ -7,7 +8,6 @@ interface WhereToWatchProps extends React.ComponentPropsWithRef<"div"> { rent: Array<{}>; buy: Array<{}>; link: string; - }; } const sampleData = { @@ -74,20 +74,20 @@ function watchProvidersExist(watchProviders: any) { return watchProviders?.link } -export function WhereToWatch({ watchProviders }: WhereToWatchProps) { +export function WhereToWatch({ watchProviders, config }: WhereToWatchProps) { console.log("Watch providers exist?" + watchProvidersExist(watchProviders)) if (!watchProvidersExist(watchProviders)) { console.group() console.log("Watch providers (WhereToWatch)") console.log(watchProviders) console.groupEnd() - return

Por el momento no hay opciónes streaming.

+ return

{config.language == "es" ? "Por el momento no hay opciónes streaming." : config.language == "en" ? "There are no online viewing options right now." : ""}

} return <>