mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 20:34:37 +03:00
46 lines
1.4 KiB
TypeScript
46 lines
1.4 KiB
TypeScript
import React from "react";
|
|
import { Card } from 'react-bootstrap';
|
|
import { Link } from "react-router-dom";
|
|
import * as GQL from "../../core/generated-graphql";
|
|
import { TextUtils } from "../../utils/text";
|
|
import { NavigationUtils } from "../../utils/navigation";
|
|
|
|
interface IPerformerCardProps {
|
|
performer: GQL.PerformerDataFragment;
|
|
ageFromDate?: string;
|
|
}
|
|
|
|
export const PerformerCard: React.FC<IPerformerCardProps> = (props: IPerformerCardProps) => {
|
|
const age = TextUtils.age(props.performer.birthdate, props.ageFromDate);
|
|
const ageString = `${age} years old${!!props.ageFromDate ? " in this scene." : "."}`;
|
|
|
|
function maybeRenderFavoriteBanner() {
|
|
if (props.performer.favorite === false) { return; }
|
|
return (
|
|
<div className={`rating-banner rating-5`}>
|
|
FAVORITE
|
|
</div>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<Card className="col-3">
|
|
<Link
|
|
to={`/performers/${props.performer.id}`}
|
|
className="performer previewable image"
|
|
style={{backgroundImage: `url(${props.performer.image_path})`}}
|
|
>
|
|
{maybeRenderFavoriteBanner()}
|
|
</Link>
|
|
<div className="card-section">
|
|
<h4 className="text-truncate">
|
|
{props.performer.name}
|
|
</h4>
|
|
{age !== 0 ? <div>{ageString}</div> : ''}
|
|
<span>Stars in {props.performer.scene_count} <Link to={NavigationUtils.makePerformerScenesUrl(props.performer)}>scenes</Link>.
|
|
</span>
|
|
</div>
|
|
</Card>
|
|
);
|
|
};
|