fix(frontend): handle empty array of media attributes (#922)

This commit is contained in:
Danshil Mungur
2021-02-13 02:01:35 +04:00
committed by GitHub
parent 2768155bba
commit 04fa9f79e2
3 changed files with 17 additions and 15 deletions

View File

@@ -9,7 +9,7 @@
"build": "yarn build:next && yarn build:server", "build": "yarn build:next && yarn build:server",
"lint": "eslint \"./server/**/*.{ts,tsx}\" \"./src/**/*.{ts,tsx}\"", "lint": "eslint \"./server/**/*.{ts,tsx}\" \"./src/**/*.{ts,tsx}\"",
"start": "NODE_ENV=production node dist/index.js", "start": "NODE_ENV=production node dist/index.js",
"i18n:extract": "extract-messages -l=en -o src/i18n/locale -d en --flat true --overwriteDefault false './src/**/!(*.test).{ts,tsx}'", "i18n:extract": "extract-messages -l=en -o src/i18n/locale -d en --flat true --overwriteDefault false \"./src/**/!(*.test).{ts,tsx}\"",
"migration:generate": "ts-node --project server/tsconfig.json ./node_modules/.bin/typeorm migration:generate", "migration:generate": "ts-node --project server/tsconfig.json ./node_modules/.bin/typeorm migration:generate",
"migration:create": "ts-node --project server/tsconfig.json ./node_modules/.bin/typeorm migration:create", "migration:create": "ts-node --project server/tsconfig.json ./node_modules/.bin/typeorm migration:create",
"migration:run": "ts-node --project server/tsconfig.json ./node_modules/.bin/typeorm migration:run", "migration:run": "ts-node --project server/tsconfig.json ./node_modules/.bin/typeorm migration:run",

View File

@@ -384,13 +384,14 @@ const MovieDetails: React.FC<MovieDetailsProps> = ({ movie }) => {
)} )}
</h1> </h1>
<span className="mt-1 text-xs lg:text-base lg:mt-0"> <span className="mt-1 text-xs lg:text-base lg:mt-0">
{movieAttributes {movieAttributes.length > 0 &&
.map((t, k) => <span key={k}>{t}</span>) movieAttributes
.reduce((prev, curr) => ( .map((t, k) => <span key={k}>{t}</span>)
<> .reduce((prev, curr) => (
{prev} | {curr} <>
</> {prev} | {curr}
))} </>
))}
</span> </span>
</div> </div>
<div className="relative z-10 flex flex-wrap justify-center flex-shrink-0 mt-4 sm:justify-end sm:flex-nowrap lg:mt-0"> <div className="relative z-10 flex flex-wrap justify-center flex-shrink-0 mt-4 sm:justify-end sm:flex-nowrap lg:mt-0">

View File

@@ -412,13 +412,14 @@ const TvDetails: React.FC<TvDetailsProps> = ({ tv }) => {
)} )}
</h1> </h1>
<span className="mt-1 text-xs lg:text-base lg:mt-0"> <span className="mt-1 text-xs lg:text-base lg:mt-0">
{seriesAttributes {seriesAttributes.length > 0 &&
.map((t, k) => <span key={k}>{t}</span>) seriesAttributes
.reduce((prev, curr) => ( .map((t, k) => <span key={k}>{t}</span>)
<> .reduce((prev, curr) => (
{prev} | {curr} <>
</> {prev} | {curr}
))} </>
))}
</span> </span>
</div> </div>
<div className="flex flex-wrap justify-center flex-shrink-0 mt-4 sm:flex-nowrap sm:justify-end lg:mt-0"> <div className="flex flex-wrap justify-center flex-shrink-0 mt-4 sm:flex-nowrap sm:justify-end lg:mt-0">