show stashids on studio details (#2810)

This commit is contained in:
halorrr 2022-09-06 01:41:01 -04:00 committed by GitHub
parent 628afce516
commit 9dcf03eb70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 38 additions and 0 deletions

View File

@ -51,6 +51,43 @@ export const StudioDetailsPanel: React.FC<IStudioDetailsPanel> = ({
);
}
function renderStashIDs() {
if (!studio.stash_ids?.length) {
return;
}
return (
<>
<dt>
<FormattedMessage id="StashIDs" />
</dt>
<dd>
<ul className="pl-0">
{studio.stash_ids.map((stashID) => {
const base = stashID.endpoint.match(/https?:\/\/.*?\//)?.[0];
const link = base ? (
<a
href={`${base}studios/${stashID.stash_id}`}
target="_blank"
rel="noopener noreferrer"
>
{stashID.stash_id}
</a>
) : (
stashID.stash_id
);
return (
<li key={stashID.stash_id} className="row no-gutters">
{link}
</li>
);
})}
</ul>
</dd>
</>
);
}
return (
<div className="studio-details">
<div>
@ -76,6 +113,7 @@ export const StudioDetailsPanel: React.FC<IStudioDetailsPanel> = ({
{renderRatingField()}
{renderTagsList()}
{renderStashIDs()}
</dl>
</div>
);