Skip to content

Commit

Permalink
moved error text to constant
Browse files Browse the repository at this point in the history
  • Loading branch information
Da-Colon committed Dec 10, 2021
1 parent 8335585 commit d0e72f0
Showing 1 changed file with 24 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,30 @@ interface ArchaeologistDataProps {
isArchaeologistMaxResValid: boolean;
}

const MAX_RESURRECTION_PAST_TEXT = "Max Resurrection time has past";

const Property = ({ label }: { label: string }) => <span className="text-gray-400 mr-2">{label}</span>;

const Value = ({ value, selected }: { value: string; selected: boolean }) => (
<span className={!selected ? classnames("text-white", {'text-red': value === 'max time exceeded'}) : classnames("text-black")}> {value}</span>
<span
className={
!selected
? classnames("text-white", { "text-red": value === "max time exceeded" })
: classnames("text-black")
}
>
{" "}
{value}
</span>
);

const ArchaeologistData = ({ archaeologist, file, isSelected, open, isArchaeologistMaxResValid }: ArchaeologistDataProps) => {
const ArchaeologistData = ({
archaeologist,
file,
isSelected,
open,
isArchaeologistMaxResValid,
}: ArchaeologistDataProps) => {
if (!open) return null;
return (
<div className="border-t border-gray-500 py-4 px-8 w-full">
Expand Down Expand Up @@ -77,7 +94,11 @@ const ArchaeologistData = ({ archaeologist, file, isSelected, open, isArchaeolog
<Property label="Max Resurrection Time:" />
<Value
selected={isSelected}
value={isArchaeologistMaxResValid ? getDatefromBigNumber(archaeologist?.maximumResurrectionTime) : 'Max Resurrection time has past'}
value={
isArchaeologistMaxResValid
? getDatefromBigNumber(archaeologist?.maximumResurrectionTime)
: MAX_RESURRECTION_PAST_TEXT
}
/>
</div>
</div>
Expand Down

0 comments on commit d0e72f0

Please sign in to comment.