Replaced default height and weight fields with fields taking units argument.

This commit is contained in:
2019-12-16 02:39:13 +01:00
parent 577c03f9b7
commit f4c2e6c08c
8 changed files with 133 additions and 26 deletions

View File

@@ -136,8 +136,8 @@
>
<dfn class="bio-label"><Icon icon="height" />Height</dfn>
<span>
<span class="height-metric">{{ actor.height }} cm</span>
<span class="height-imperial">{{ imperialHeight.feet }}' {{ imperialHeight.inches }}"</span>
<span class="height-metric">{{ actor.height.metric }} cm</span>
<span class="height-imperial">{{ actor.height.imperial }}</span>
</span>
</li>
@@ -148,8 +148,8 @@
<dfn class="bio-label"><Icon icon="scale" />Weight</dfn>
<span>
<span class="weight-metric">{{ actor.weight }} kg</span>
<span class="weight-imperial">{{ imperialWeight }} lbs</span>
<span class="weight-metric">{{ actor.weight.metric }} kg</span>
<span class="weight-imperial">{{ actor.weight.imperial }} lbs</span>
</span>
</li>
@@ -239,8 +239,6 @@
</template>
<script>
import { cmToFeetInches, kgToLbs } from '../../../src/utils/convert';
import Photos from './photos.vue';
import FilterBar from '../header/filter-bar.vue';
import Releases from '../releases/releases.vue';
@@ -249,14 +247,6 @@ async function fetchReleases() {
this.releases = await this.$store.dispatch('fetchActorReleases', this.$route.params.actorSlug);
}
function imperialHeight() {
return cmToFeetInches(this.actor.height);
}
function imperialWeight() {
return kgToLbs(this.actor.weight);
}
function scrollPhotos(event) {
event.currentTarget.scrollLeft += event.deltaY; // eslint-disable-line no-param-reassign
}
@@ -286,10 +276,6 @@ export default {
expanded: false,
};
},
computed: {
imperialHeight,
imperialWeight,
},
mounted,
methods: {
fetchReleases,

View File

@@ -4,8 +4,23 @@ function curateActor(actor) {
const curatedActor = {
...actor,
avatar: actor.avatar[0],
origin: {
country: actor.originCountry,
height: actor.heightMetric && {
metric: actor.heightMetric,
imperial: actor.heightImperial,
},
weight: actor.weightMetric && {
metric: actor.weightMetric,
imperial: actor.weightImperial,
},
origin: actor.birthCountry && {
city: actor.birthCity,
state: actor.birthState,
country: actor.birthCountry,
},
residence: actor.residenceCountry && {
city: actor.residenceCity,
state: actor.residenceState,
country: actor.residenceCountry,
},
};
@@ -20,14 +35,50 @@ function initActorActions(store, _router) {
id
name
slug
gender
birthdate
age
ethnicity
bust
waist
hip
heightMetric: height(units:METRIC)
heightImperial: height(units:IMPERIAL)
weightMetric: weight(units:METRIC)
weightImperial: weight(units:IMPERIAL)
hasTattoos
hasPiercings
tattoos
piercings
avatar: actorsMediasByTargetId(condition: { role:"avatar" }) {
thumbnail
path
}
originCountry: countryByBirthCountryAlpha2 {
photos: actorsMediasByTargetId(condition: { role:"photo" }) {
id
thumbnail
path
index
}
birthCity
birthState
birthCountry: countryByBirthCountryAlpha2 {
alpha2
name
alias
}
residenceCity
residenceState
residenceCountry: countryByResidenceCountryAlpha2 {
alpha2
name
alias
}
social: actorsSocialsByTargetId {
id
url
platform
}
aliases: actorsByAliasFor {
id
name
@@ -56,7 +107,7 @@ function initActorActions(store, _router) {
avatar: actorsMediasByTargetId(condition: { role:"avatar" }) {
thumbnail
}
originCountry: countryByBirthCountryAlpha2 {
birthCountry: countryByBirthCountryAlpha2 {
alpha2
name
alias
@@ -67,8 +118,6 @@ function initActorActions(store, _router) {
limit,
});
console.log(actors);
return actors.map(actor => curateActor(actor));
}

View File

@@ -47,6 +47,7 @@ function initReleasesActions(_store, _router) {
name
slug
birthdate
age
originCountry: countryByBirthCountryAlpha2 {
alpha2
name
@@ -111,6 +112,7 @@ function initReleasesActions(_store, _router) {
name
slug
birthdate
age
originCountry: countryByBirthCountryAlpha2 {
alpha2
name