mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 12:54:38 +03:00
Fix date rendering for missing date values (#580)
* Fix date rendering when missing date value * Move scene studio overlay within scene card
This commit is contained in:
@@ -242,9 +242,7 @@ export const Movie: React.FC = () => {
|
|||||||
})}
|
})}
|
||||||
{TableUtils.renderInputGroup({
|
{TableUtils.renderInputGroup({
|
||||||
title: `Date ${isEditing ? "(YYYY-MM-DD)" : ""}`,
|
title: `Date ${isEditing ? "(YYYY-MM-DD)" : ""}`,
|
||||||
value: isEditing
|
value: isEditing ? date : TextUtils.formatDate(intl, date),
|
||||||
? date
|
|
||||||
: intl.formatDate(date, { format: "long" }),
|
|
||||||
isEditing,
|
isEditing,
|
||||||
onChange: setDate,
|
onChange: setDate,
|
||||||
})}
|
})}
|
||||||
|
|||||||
@@ -490,7 +490,7 @@ export const PerformerDetailsPanel: React.FC<IPerformerDetails> = ({
|
|||||||
title: "Birthdate",
|
title: "Birthdate",
|
||||||
value: isEditing
|
value: isEditing
|
||||||
? birthdate
|
? birthdate
|
||||||
: intl.formatDate(birthdate, { format: "long" }),
|
: TextUtils.formatDate(intl, birthdate),
|
||||||
isEditing: !!isEditing,
|
isEditing: !!isEditing,
|
||||||
onChange: setBirthdate,
|
onChange: setBirthdate,
|
||||||
})}
|
})}
|
||||||
|
|||||||
@@ -252,9 +252,10 @@ export const SceneCard: React.FC<ISceneCardProps> = (
|
|||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
{maybeRenderSceneStudioOverlay()}
|
|
||||||
<Link to={`/scenes/${props.scene.id}`} className="scene-card-link">
|
<Link to={`/scenes/${props.scene.id}`} className="scene-card-link">
|
||||||
{maybeRenderRatingBanner()}
|
{maybeRenderRatingBanner()}
|
||||||
|
{maybeRenderSceneStudioOverlay()}
|
||||||
{maybeRenderSceneSpecsOverlay()}
|
{maybeRenderSceneSpecsOverlay()}
|
||||||
<video
|
<video
|
||||||
loop
|
loop
|
||||||
|
|||||||
@@ -39,9 +39,11 @@ export const SceneDetailPanel: React.FC<ISceneDetailProps> = (props) => {
|
|||||||
{props.scene.title ?? TextUtils.fileNameFromPath(props.scene.path)}
|
{props.scene.title ?? TextUtils.fileNameFromPath(props.scene.path)}
|
||||||
</h3>
|
</h3>
|
||||||
<div className="col-6 scene-details">
|
<div className="col-6 scene-details">
|
||||||
|
{props.scene.date ? (
|
||||||
<h4>
|
<h4>
|
||||||
<FormattedDate value={props.scene.date ?? ""} format="long" />
|
<FormattedDate value={props.scene.date} format="long" />
|
||||||
</h4>
|
</h4>
|
||||||
|
) : undefined}
|
||||||
{props.scene.rating ? <h6>Rating: {props.scene.rating}</h6> : ""}
|
{props.scene.rating ? <h6>Rating: {props.scene.rating}</h6> : ""}
|
||||||
{props.scene.file.height && (
|
{props.scene.file.height && (
|
||||||
<h6>Resolution: {TextUtils.resolution(props.scene.file.height)}</h6>
|
<h6>Resolution: {TextUtils.resolution(props.scene.file.height)}</h6>
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import { IntlShape } from "react-intl";
|
||||||
|
|
||||||
// Typescript currently does not implement the intl Unit interface
|
// Typescript currently does not implement the intl Unit interface
|
||||||
type Unit =
|
type Unit =
|
||||||
| "byte"
|
| "byte"
|
||||||
@@ -128,6 +130,14 @@ const sanitiseURL = (url?: string, siteURL?: URL) => {
|
|||||||
return `https://${url}`;
|
return `https://${url}`;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const formatDate = (intl: IntlShape, date?: string) => {
|
||||||
|
if (!date) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
return intl.formatDate(date, { format: "long" });
|
||||||
|
};
|
||||||
|
|
||||||
const TextUtils = {
|
const TextUtils = {
|
||||||
truncate,
|
truncate,
|
||||||
fileSize,
|
fileSize,
|
||||||
@@ -139,6 +149,7 @@ const TextUtils = {
|
|||||||
sanitiseURL,
|
sanitiseURL,
|
||||||
twitterURL,
|
twitterURL,
|
||||||
instagramURL,
|
instagramURL,
|
||||||
|
formatDate,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default TextUtils;
|
export default TextUtils;
|
||||||
|
|||||||
Reference in New Issue
Block a user