Don't show JobDropdown if party isn't editable
This commit is contained in:
parent
5ef43bc1f5
commit
b8130af3f6
2 changed files with 22 additions and 6 deletions
|
|
@ -12,6 +12,12 @@
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
|
h3 {
|
||||||
|
font-size: $font-medium;
|
||||||
|
font-weight: $medium;
|
||||||
|
padding: $unit 0 $unit * 2;
|
||||||
|
}
|
||||||
|
|
||||||
select {
|
select {
|
||||||
flex-grow: 0;
|
flex-grow: 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import React, { ForwardedRef, useEffect, useState } from "react"
|
import React, { ForwardedRef, useEffect, useState } from "react"
|
||||||
import { useTranslation } from "next-i18next"
|
import { useRouter } from "next/router"
|
||||||
import { useSnapshot } from "valtio"
|
import { useSnapshot } from "valtio"
|
||||||
|
import { useTranslation } from "next-i18next"
|
||||||
|
|
||||||
import JobDropdown from "~components/JobDropdown"
|
import JobDropdown from "~components/JobDropdown"
|
||||||
import JobSkillItem from "~components/JobSkillItem"
|
import JobSkillItem from "~components/JobSkillItem"
|
||||||
|
|
@ -25,6 +26,10 @@ const JobSection = (props: Props) => {
|
||||||
const { party } = useSnapshot(appState)
|
const { party } = useSnapshot(appState)
|
||||||
const { t } = useTranslation("common")
|
const { t } = useTranslation("common")
|
||||||
|
|
||||||
|
const router = useRouter()
|
||||||
|
const locale =
|
||||||
|
router.locale && ["en", "ja"].includes(router.locale) ? router.locale : "en"
|
||||||
|
|
||||||
const [job, setJob] = useState<Job>()
|
const [job, setJob] = useState<Job>()
|
||||||
const [imageUrl, setImageUrl] = useState("")
|
const [imageUrl, setImageUrl] = useState("")
|
||||||
const [numSkills, setNumSkills] = useState(4)
|
const [numSkills, setNumSkills] = useState(4)
|
||||||
|
|
@ -132,11 +137,16 @@ const JobSection = (props: Props) => {
|
||||||
<div className="Overlay" />
|
<div className="Overlay" />
|
||||||
</div>
|
</div>
|
||||||
<div className="JobDetails">
|
<div className="JobDetails">
|
||||||
<JobDropdown
|
{props.editable ? (
|
||||||
currentJob={party.job?.id}
|
<JobDropdown
|
||||||
onChange={receiveJob}
|
currentJob={party.job?.id}
|
||||||
ref={selectRef}
|
onChange={receiveJob}
|
||||||
/>
|
ref={selectRef}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<h3>{party.job?.name[locale]}</h3>
|
||||||
|
)}
|
||||||
|
|
||||||
<ul className="JobSkills">
|
<ul className="JobSkills">
|
||||||
{[...Array(numSkills)].map((e, i) => (
|
{[...Array(numSkills)].map((e, i) => (
|
||||||
<li key={`job-${i}`}>
|
<li key={`job-${i}`}>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue