Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scene details page styling #4785

Open
wants to merge 26 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
f814f7d
initial push
cj12312021 Apr 22, 2024
1b00ae9
updated gallery presentation
cj12312021 Apr 23, 2024
528764f
more gallery improvements
cj12312021 Apr 23, 2024
2b8b936
add title on card image
cj12312021 Apr 23, 2024
ced6d5e
adjust tab and performer card fitting
cj12312021 Apr 23, 2024
82b2f70
adjust performer detail height limit
cj12312021 Apr 23, 2024
38e96ae
collapsible section improvements
cj12312021 Apr 24, 2024
64d478a
better way to center show more/less button
cj12312021 Apr 24, 2024
0320369
show more less transiaitions as well as studio text element
cj12312021 Apr 25, 2024
2f5b82e
missing commit
cj12312021 Apr 25, 2024
72b0c38
pulled maybeRenderShowMoreLess out into shared location
cj12312021 Apr 25, 2024
1069867
fix collapsible details on the non content detail pages
cj12312021 Apr 26, 2024
a9fd330
collapsible tabs
cj12312021 Apr 27, 2024
55191f6
consistent ids across tabs
cj12312021 Apr 27, 2024
ae5c1a0
extend gallery viewer to each gallery
cj12312021 May 1, 2024
b995030
gallery viewer improvements
cj12312021 May 1, 2024
62c1a1b
fix linter error
cj12312021 May 2, 2024
04f5cf6
prettier
cj12312021 May 2, 2024
2571dd5
fix setting label and move hidden studio text
cj12312021 May 2, 2024
f917c22
Merge branch 'develop' into content-details-page-redesign-plugin
cj12312021 Sep 4, 2024
223e57d
cleanup
cj12312021 Sep 5, 2024
0f56d79
Merge remote-tracking branch 'origin/develop' into content-details-pa…
cj12312021 Sep 5, 2024
93e67d3
post merge cleanup
cj12312021 Sep 5, 2024
4ce7e9e
more cleanup
cj12312021 Sep 5, 2024
ae8739d
hide scrubber on scene details page
cj12312021 Sep 5, 2024
76d33d7
prettier
cj12312021 Sep 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion ui/v2.5/src/components/Galleries/GalleryCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ export const GalleryPreview: React.FC<IGalleryPreviewProps> = ({
gallery,
onScrubberClick,
}) => {
const [isPortrait, setIsPortrait] = React.useState(false);

function identifyPortaitImage(e: React.UIEvent<HTMLImageElement>) {
const img = e.target as HTMLImageElement;
setIsPortrait(img.width < img.height);
}

const [imgSrc, setImgSrc] = useState<string | undefined>(
gallery.paths.cover ?? undefined
);
Expand All @@ -36,9 +43,10 @@ export const GalleryPreview: React.FC<IGalleryPreviewProps> = ({
{!!imgSrc && (
<img
loading="lazy"
className="gallery-card-image"
className={`gallery-card-image ${isPortrait ? "portrait-image" : ""}`}
alt={gallery.title ?? ""}
src={imgSrc}
onLoad={identifyPortaitImage}
/>
)}
{gallery.image_count > 0 && (
Expand All @@ -60,6 +68,7 @@ interface IProps {
selecting?: boolean;
selected?: boolean | undefined;
zoomIndex?: number;
titleOnImage?: boolean;
onSelectedChanged?: (selected: boolean, shiftKey: boolean) => void;
}

Expand Down Expand Up @@ -231,6 +240,7 @@ export const GalleryCard: React.FC<IProps> = (props) => {
selected={props.selected}
selecting={props.selecting}
onSelectedChanged={props.onSelectedChanged}
titleOnImage={props.titleOnImage}
/>
);
};
143 changes: 93 additions & 50 deletions ui/v2.5/src/components/Galleries/GalleryDetails/Gallery.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import cx from "classnames";
import { useRatingKeybinds } from "src/hooks/keybinds";
import { ConfigurationContext } from "src/hooks/Config";
import { TruncatedText } from "src/components/Shared/TruncatedText";
import ScreenUtils from "src/utils/screen";

interface IProps {
gallery: GQL.GalleryDataFragment;
Expand All @@ -59,9 +60,11 @@ export const GalleryPage: React.FC<IProps> = ({ gallery, add }) => {
const Toast = useToast();
const intl = useIntl();
const { configuration } = useContext(ConfigurationContext);
const uiConfig = configuration?.ui;
const enableBackgroundImage = uiConfig?.enableGalleryBackgroundImage ?? false;
const showLightbox = useGalleryLightbox(gallery.id, gallery.chapters);

const [collapsed, setCollapsed] = useState(false);
const [collapsed, setCollapsed] = useState(ScreenUtils.isSmallScreen());

const [activeTabKey, setActiveTabKey] = useState("gallery-details-panel");

Expand Down Expand Up @@ -118,6 +121,30 @@ export const GalleryPage: React.FC<IProps> = ({ gallery, add }) => {
return collapsed ? faChevronRight : faChevronLeft;
}

function maybeRenderHeaderBackgroundImage() {
if (enableBackgroundImage && gallery != null && gallery.studio != null) {
let image = gallery.studio.image_path;
if (image) {
const imageURL = new URL(image);
let isDefaultImage = imageURL.searchParams.get("default");
if (!isDefaultImage) {
return (
<div className="background-image-container">
<picture>
<source src={image} />
<img
className="background-image"
src={image}
alt={`${gallery.studio.name} background`}
/>
</picture>
</div>
);
}
}
}
}

async function onRescan() {
if (!gallery || !path) {
return;
Expand Down Expand Up @@ -380,63 +407,74 @@ export const GalleryPage: React.FC<IProps> = ({ gallery, add }) => {
const title = galleryTitle(gallery);

return (
<div className="row">
<div id="gallery-page" className="row">
<Helmet>
<title>{title}</title>
</Helmet>
{maybeRenderDeleteDialog()}
<div className={`gallery-tabs ${collapsed ? "collapsed" : ""}`}>
<div>
<div className="gallery-header-container">
{gallery.studio && (
<h1 className="text-center gallery-studio-image">
<Link to={`/studios/${gallery.studio.id}`}>
<img
src={gallery.studio.image_path ?? ""}
alt={`${gallery.studio.name} logo`}
className="studio-logo"
<div
className={`gallery-tabs order-xl-first order-last ${
collapsed ? "collapsed" : ""
}`}
>
<div className="detail-header">
{maybeRenderHeaderBackgroundImage()}
<div className="detail-container">
<div className="gallery-header-container">
{gallery.studio && (
<>
<h1 className="text-center gallery-studio-image">
<Link to={`/studios/${gallery.studio.id}`}>
<img
src={gallery.studio.image_path ?? ""}
alt={`${gallery.studio.name} logo`}
className="studio-logo"
/>
</Link>
</h1>
</>
)}
<h3
className={cx("gallery-header", {
"no-studio": !gallery.studio,
})}
>
<TruncatedText lineCount={2} text={title} />
</h3>
</div>

<div className="gallery-subheader">
{!!gallery.date && (
<span className="date" data-value={gallery.date}>
<FormattedDate
value={gallery.date}
format="long"
timeZone="utc"
/>
</Link>
</h1>
)}
<h3
className={cx("gallery-header", { "no-studio": !gallery.studio })}
>
<TruncatedText lineCount={2} text={title} />
</h3>
</div>

<div className="gallery-subheader">
{!!gallery.date && (
<span className="date" data-value={gallery.date}>
<FormattedDate
value={gallery.date}
format="long"
timeZone="utc"
</span>
)}
</div>

<div className="gallery-toolbar">
<span className="gallery-toolbar-group">
<RatingSystem
value={gallery.rating100}
onSetRating={setRating}
clickToRate
withoutContext
/>
</span>
)}
</div>

<div className="gallery-toolbar">
<span className="gallery-toolbar-group">
<RatingSystem
value={gallery.rating100}
onSetRating={setRating}
clickToRate
withoutContext
/>
</span>
<span className="gallery-toolbar-group">
<span>
<OrganizedButton
loading={organizedLoading}
organized={gallery.organized}
onClick={onOrganizedClick}
/>
<span className="gallery-toolbar-group">
<span>
<OrganizedButton
loading={organizedLoading}
organized={gallery.organized}
onClick={onOrganizedClick}
/>
</span>
<span>{renderOperations()}</span>
</span>
<span>{renderOperations()}</span>
</span>
</div>
</div>
</div>
{renderTabs()}
Expand All @@ -446,6 +484,11 @@ export const GalleryPage: React.FC<IProps> = ({ gallery, add }) => {
<Icon className="fa-fw" icon={getCollapseButtonIcon()} />
</Button>
</div>
<div className="floating-gallery-divider">
<Button onClick={() => setCollapsed(!collapsed)}>
{collapsed ? "Show Details" : "Hide Details"}
</Button>
</div>
<div className={`gallery-container ${collapsed ? "expanded" : ""}`}>
{renderRightTabs()}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const GalleryChapterPanel: React.FC<IGalleryChapterPanelProps> = ({
);

return (
<div>
<div id="gallery-chapter-panel">
<Button onClick={() => onOpenEditor()}>
<FormattedMessage id="actions.create_chapters" />
</Button>
Expand Down
Loading
Loading