Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
students
butter-studio
Commits
6d72fc1e
Commit
6d72fc1e
authored
Aug 06, 2021
by
Jiwon Yoon
Browse files
영화 정보페이지 수정
parent
e8ffb067
Changes
1
Show whitespace changes
Inline
Side-by-side
client/src/pages/MoviePage.js
View file @
6d72fc1e
...
...
@@ -7,10 +7,9 @@ const MoviePage = ({ location }) => {
const
[
movieInfo
,
setMovieInfo
]
=
useState
({
...
location
.
state
,
stillCuts
:
[],
cast
:
""
,
director
:
""
,
// genres: [],
attendance
:
""
cast
:
[],
director
:
[],
// attendance: ""
})
const
[
state
,
setState
]
=
useState
(
0
)
...
...
@@ -24,23 +23,14 @@ const MoviePage = ({ location }) => {
const
still
=
images
.
backdrops
.
map
(
el
=>
el
.
file_path
)
const
credits
=
await
movieApi
.
getCreditsfromTM
(
movieInfo
.
id
)
const
castsInfo
=
credits
.
cast
.
map
(
el
=>
el
.
name
)
const
casts
=
castsInfo
.
reduce
((
acc
,
cur
,
idx
)
=>
{
if
(
idx
!==
0
)
return
acc
+
'
,
'
+
cur
else
return
acc
+
cur
},
""
)
console
.
log
(
castsInfo
)
const
directorsInfo
=
await
credits
.
crew
.
filter
(
element
=>
element
.
job
===
"
Director
"
)
const
directors
=
directorsInfo
.
reduce
((
acc
,
cur
,
idx
)
=>
{
if
(
idx
!==
0
)
return
acc
+
'
,
'
+
cur
.
name
else
return
acc
+
cur
.
name
},
""
)
const
directorsInfo
=
await
credits
.
crew
.
filter
(
element
=>
element
.
job
===
"
Director
"
).
map
(
el
=>
el
.
name
)
console
.
log
(
"
directorInfo=
"
,
directorsInfo
)
setMovieInfo
({
...
movieInfo
,
stillCuts
:
still
,
cast
:
casts
,
director
:
directors
cast
:
casts
Info
,
director
:
directors
Info
})
}
catch
(
error
)
{
console
.
log
(
error
)
...
...
@@ -76,11 +66,18 @@ const MoviePage = ({ location }) => {
<
div
className
=
"
col-sm-3 mb-5
"
>
<
img
className
=
"
img-thumbnail
"
src
=
{
`https://image.tmdb.org/t/p/original
${
movieInfo
.
poster_path
}
`
}
alt
=
"
영화포스터
"
/>
<
/div
>
<
div
className
=
"
col-sm-6
"
style
=
{{
color
:
"
white
"
}}
>
<
div
className
=
"
col-sm-6
"
style
=
{{
color
:
"
white
"
}}
>
<
h1
className
=
"
pb-3
"
>
{
movieInfo
.
title
}
<
/h1
>
<
p
>
예매율
:{
Math
.
round
((
movieInfo
.
ticket_sales
/
movieInfo
.
totalReservationRate
.
totalReservationRate
)
*
100
)}
%
누적관객수
:
{
movieInfo
.
attendance
}
명
<
/p
>
<
p
>
감독
:
{
movieInfo
.
director
}
<
/p
>
<
p
>
출연
:
{
movieInfo
.
cast
}
<
/p
>
<
p
>
예매율
:{
Math
.
round
((
movieInfo
.
ticket_sales
/
movieInfo
.
totalReservationRate
.
totalReservationRate
)
*
100
)}
%
누적관객수
:
{
movieInfo
.
ticket_sales
}
명
<
/p
>
{
movieInfo
.
director
||
movieInfo
.
cast
?
<>
<
p
>
감독
:
{
movieInfo
.
director
.
map
(
el
=>
el
)
+
'
'
}
<
/p
>
<
p
>
출연
:
{
movieInfo
.
cast
.
slice
(
0
,
5
).
map
(
el
=>
el
)
+
'
'
}
<
/p
>
<
/
>
:
<><
/
>
}
<
p
>
장르
:
{
movieInfo
.
genres
.
reduce
((
acc
,
cur
,
idx
)
=>
{
if
(
idx
!==
0
)
return
acc
+
'
,
'
+
cur
.
name
else
return
acc
+
cur
.
name
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment