mirror of
https://github.com/stashapp/stash.git
synced 2025-12-06 08:26:00 +01:00
* Use more neutral language for content * Add sfw mode setting * Make configuration context mandatory * Add sfw class when sfw mode active * Hide nsfw performer fields in sfw mode * Hide nsfw sort options * Hide nsfw filter/sort options in sfw mode * Replace o-count with like counter in sfw mode * Use sfw label for o-counter filter in sfw mode * Use likes instead of o-count in sfw mode in other places * Rename sfw mode to sfw content mode * Use sfw image for default performers in sfw mode * Document SFW content mode * Add SFW mode setting to setup * Clarify README * Change wording of sfw mode description * Handle configuration loading error correctly * Hide age in performer cards
51 lines
1.2 KiB
TypeScript
51 lines
1.2 KiB
TypeScript
import React, { useMemo } from "react";
|
|
import { Link } from "react-router-dom";
|
|
import { useConfigurationContext } from "src/hooks/Config";
|
|
|
|
interface IStudio {
|
|
id: string;
|
|
name: string;
|
|
image_path?: string | null;
|
|
}
|
|
|
|
export const StudioOverlay: React.FC<{
|
|
studio: IStudio | null | undefined;
|
|
}> = ({ studio }) => {
|
|
const { configuration } = useConfigurationContext();
|
|
|
|
const configValue = configuration?.interface.showStudioAsText;
|
|
|
|
const showStudioAsText = useMemo(() => {
|
|
if (configValue || !studio?.image_path) {
|
|
return true;
|
|
}
|
|
|
|
// If the studio has a default image, show the studio name as text
|
|
const studioImageURL = new URL(studio.image_path);
|
|
if (studioImageURL.searchParams.get("default") === "true") {
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}, [configValue, studio?.image_path]);
|
|
|
|
if (!studio) return <></>;
|
|
|
|
return (
|
|
// this class name is incorrect
|
|
<div className="studio-overlay">
|
|
<Link to={`/studios/${studio.id}`}>
|
|
{showStudioAsText ? (
|
|
studio.name
|
|
) : (
|
|
<img
|
|
className="image-thumbnail"
|
|
loading="lazy"
|
|
alt={studio.name}
|
|
src={studio.image_path ?? ""}
|
|
/>
|
|
)}
|
|
</Link>
|
|
</div>
|
|
);
|
|
};
|