Merge branch 'main' of github.com:cheeaun/phanpy
This commit is contained in:
commit
e21cf30f39
|
@ -176,6 +176,7 @@ function MediaModal({
|
|||
left: carouselRef.current.clientWidth * i,
|
||||
behavior: 'smooth',
|
||||
});
|
||||
carouselRef.current.focus();
|
||||
}}
|
||||
>
|
||||
•
|
||||
|
@ -245,6 +246,7 @@ function MediaModal({
|
|||
left: carouselRef.current.clientWidth * (currentIndex - 1),
|
||||
behavior: 'smooth',
|
||||
});
|
||||
carouselRef.current.focus();
|
||||
}}
|
||||
>
|
||||
<Icon icon="arrow-left" />
|
||||
|
@ -260,6 +262,7 @@ function MediaModal({
|
|||
left: carouselRef.current.clientWidth * (currentIndex + 1),
|
||||
behavior: 'smooth',
|
||||
});
|
||||
carouselRef.current.focus();
|
||||
}}
|
||||
>
|
||||
<Icon icon="arrow-right" />
|
||||
|
@ -272,6 +275,7 @@ function MediaModal({
|
|||
onClick={(e) => {
|
||||
if (e.target === e.currentTarget) {
|
||||
setShowMediaAlt(false);
|
||||
carouselRef.current.focus();
|
||||
}
|
||||
}}
|
||||
>
|
||||
|
|
|
@ -116,12 +116,18 @@ function Media({ media, to, showOriginal, autoAnimate, onClick = () => {} }) {
|
|||
if (smaller) setImageSmallerThanParent(smaller);
|
||||
}, [width, height]);
|
||||
|
||||
const maxAspectHeight =
|
||||
window.innerHeight * (orientation === 'portrait' ? 0.45 : 0.33);
|
||||
const maxHeight = orientation === 'portrait' ? 0 : 160;
|
||||
const mediaStyles = {
|
||||
'--width': `${width}px`,
|
||||
'--height': `${height}px`,
|
||||
// Calculate '--aspectWidth' based on aspect ratio calculated from '--width' and '--height', max height has to be 160px
|
||||
'--aspectWidth': `${
|
||||
(width / height) * Math.max(maxHeight, maxAspectHeight)
|
||||
}px`,
|
||||
aspectRatio: `${width} / ${height}`,
|
||||
};
|
||||
const fixedWidth = width > height * 2;
|
||||
|
||||
if (isImage) {
|
||||
// Note: type: unknown might not have width/height
|
||||
|
@ -143,7 +149,7 @@ function Media({ media, to, showOriginal, autoAnimate, onClick = () => {} }) {
|
|||
return (
|
||||
<Parent
|
||||
ref={parentRef}
|
||||
class={`media media-image ${fixedWidth ? 'media-fixed-width' : ''}`}
|
||||
class={`media media-image`}
|
||||
onClick={onClick}
|
||||
data-orientation={orientation}
|
||||
style={
|
||||
|
@ -245,7 +251,7 @@ function Media({ media, to, showOriginal, autoAnimate, onClick = () => {} }) {
|
|||
<Parent
|
||||
class={`media media-${isGIF ? 'gif' : 'video'} ${
|
||||
autoGIFAnimate ? 'media-contain' : ''
|
||||
} ${fixedWidth ? 'media-fixed-width' : ''}`}
|
||||
}`}
|
||||
data-orientation={orientation}
|
||||
data-formatted-duration={formattedDuration}
|
||||
data-label={isGIF && !showOriginal && !autoGIFAnimate ? 'GIF' : ''}
|
||||
|
|
|
@ -395,10 +395,14 @@
|
|||
align-items: center;
|
||||
}
|
||||
.status
|
||||
.content-container.has-spoiler
|
||||
.content-container.has-spoiler:not(.show-spoiler)
|
||||
.spoiler
|
||||
~ *:not(.media-container, .card),
|
||||
.status .content-container.has-spoiler .spoiler ~ .card .meta-container {
|
||||
.status
|
||||
.content-container.has-spoiler:not(.show-spoiler)
|
||||
.spoiler
|
||||
~ .card
|
||||
.meta-container {
|
||||
filter: blur(5px) invert(0.5);
|
||||
image-rendering: crisp-edges;
|
||||
image-rendering: pixelated;
|
||||
|
@ -408,8 +412,17 @@
|
|||
transform: scale(0.97);
|
||||
transition: transform 0.1s ease-in-out;
|
||||
}
|
||||
.status .content-container.has-spoiler .spoiler ~ .media-container .media > *,
|
||||
.status .content-container.has-spoiler .spoiler ~ .card > img {
|
||||
.status
|
||||
.content-container.has-spoiler:not(.show-spoiler)
|
||||
.spoiler
|
||||
~ .media-container
|
||||
.media
|
||||
> *,
|
||||
.status
|
||||
.content-container.has-spoiler:not(.show-spoiler)
|
||||
.spoiler
|
||||
~ .card
|
||||
> img {
|
||||
filter: blur(32px);
|
||||
image-rendering: crisp-edges;
|
||||
image-rendering: pixelated;
|
||||
|
@ -418,7 +431,7 @@
|
|||
.status .content-container.show-spoiler .spoiler {
|
||||
border-style: dotted;
|
||||
}
|
||||
.status
|
||||
/* .status
|
||||
.content-container.show-spoiler
|
||||
.spoiler
|
||||
~ *:not(.media-container, .card),
|
||||
|
@ -434,7 +447,7 @@
|
|||
.status .content-container.show-spoiler .spoiler ~ .card > img {
|
||||
filter: none;
|
||||
image-rendering: auto;
|
||||
}
|
||||
} */
|
||||
/* .status .content a:not(.mention):not(:has(span)) {
|
||||
color: inherit;
|
||||
} */
|
||||
|
@ -597,28 +610,31 @@
|
|||
display: inline-block;
|
||||
max-width: 100% !important;
|
||||
min-width: 44px;
|
||||
width: auto;
|
||||
/* width: auto; */
|
||||
min-height: 44px;
|
||||
/* width: min(var(--width), 100%); */
|
||||
/* max-height: min(var(--height), 33vh); */
|
||||
height: min(160px, var(--height), 33vh);
|
||||
}
|
||||
.status .media-container.media-eq1 .media.media-fixed-width {
|
||||
width: min(var(--width), 100%);
|
||||
height: auto;
|
||||
/* --maxAspectHeight: max(160px, 33vh);
|
||||
--aspectWidth: calc(--width / --height * var(--maxAspectHeight)); */
|
||||
width: min(var(--aspectWidth), var(--width), 100%);
|
||||
max-height: min(var(--height), 33vh);
|
||||
}
|
||||
.status .media-container.media-eq1 .media[data-orientation='portrait'] {
|
||||
width: auto;
|
||||
/* width: auto;
|
||||
height: min(var(--height), 45vh);
|
||||
max-height: none;
|
||||
max-height: none; */
|
||||
max-height: min(var(--height), 45vh);
|
||||
}
|
||||
.status.large .media-container.media-eq1 {
|
||||
max-height: min(var(--height), 60vh);
|
||||
}
|
||||
.status.large .media-container.media-eq1 .media[data-orientation='portrait'] {
|
||||
height: min(var(--height), 60vh);
|
||||
.status.large
|
||||
.media-container:not(.status-card .media-container).media-eq1
|
||||
.media {
|
||||
width: min(var(--width), 100%);
|
||||
max-height: min(var(--height), 80vh);
|
||||
}
|
||||
/* .status.large .media-container.media-eq1 .media[data-orientation='portrait'] {
|
||||
height: min(var(--height), 60vh);
|
||||
} */
|
||||
.status-carousel .status .media-container.media-eq1 .media {
|
||||
width: min(var(--width), 100%);
|
||||
height: auto;
|
||||
|
@ -999,6 +1015,9 @@ a:focus-visible .card img {
|
|||
overflow: hidden;
|
||||
display: block;
|
||||
}
|
||||
.card .meta.domain * {
|
||||
vertical-align: middle;
|
||||
}
|
||||
a.card {
|
||||
text-decoration: none;
|
||||
transition: opacity 0.2s ease-in-out;
|
||||
|
|
|
@ -1449,7 +1449,7 @@ function Card({ card, instance }) {
|
|||
|
||||
if (snapStates.unfurledLinks[url]) return null;
|
||||
|
||||
if (hasText && (image || (!type !== 'photo' && blurhash))) {
|
||||
if (hasText && (image || (type === 'photo' && blurhash))) {
|
||||
const domain = new URL(url).hostname.replace(/^www\./, '');
|
||||
let blurhashImage;
|
||||
if (!image) {
|
||||
|
@ -1541,7 +1541,9 @@ function Card({ card, instance }) {
|
|||
class={`card link no-image`}
|
||||
>
|
||||
<div class="meta-container">
|
||||
<p class="meta domain">{domain}</p>
|
||||
<p class="meta domain">
|
||||
<Icon icon="link" size="s" /> <span>{domain}</span>
|
||||
</p>
|
||||
<p class="title">{title}</p>
|
||||
<p class="meta">{description || providerName || authorName}</p>
|
||||
</div>
|
||||
|
|
|
@ -843,24 +843,24 @@ function StatusThread({ id, closeLink = '/', instance: propInstance }) {
|
|||
weight,
|
||||
} = status;
|
||||
const isHero = statusID === id;
|
||||
const StatusParent = useCallback(
|
||||
(props) =>
|
||||
isThread || thread ? (
|
||||
<Link
|
||||
class="status-link"
|
||||
to={
|
||||
instance ? `/${instance}/s/${statusID}` : `/s/${statusID}`
|
||||
}
|
||||
onClick={() => {
|
||||
resetScrollPosition(statusID);
|
||||
}}
|
||||
{...props}
|
||||
/>
|
||||
) : (
|
||||
<div class="status-focus" tabIndex={0} {...props} />
|
||||
),
|
||||
[isThread, thread],
|
||||
);
|
||||
// const StatusParent = useCallback(
|
||||
// (props) =>
|
||||
// isThread || thread || ancestor ? (
|
||||
// <Link
|
||||
// class="status-link"
|
||||
// to={
|
||||
// instance ? `/${instance}/s/${statusID}` : `/s/${statusID}`
|
||||
// }
|
||||
// onClick={() => {
|
||||
// resetScrollPosition(statusID);
|
||||
// }}
|
||||
// {...props}
|
||||
// />
|
||||
// ) : (
|
||||
// <div class="status-focus" tabIndex={0} {...props} />
|
||||
// ),
|
||||
// [isThread, thread],
|
||||
// );
|
||||
return (
|
||||
<li
|
||||
key={statusID}
|
||||
|
@ -941,7 +941,16 @@ function StatusThread({ id, closeLink = '/', instance: propInstance }) {
|
|||
)}
|
||||
</>
|
||||
) : (
|
||||
<StatusParent>
|
||||
// <StatusParent>
|
||||
<Link
|
||||
class="status-link"
|
||||
to={
|
||||
instance ? `/${instance}/s/${statusID}` : `/s/${statusID}`
|
||||
}
|
||||
onClick={() => {
|
||||
resetScrollPosition(statusID);
|
||||
}}
|
||||
>
|
||||
<Status
|
||||
statusID={statusID}
|
||||
instance={instance}
|
||||
|
@ -969,7 +978,8 @@ function StatusThread({ id, closeLink = '/', instance: propInstance }) {
|
|||
</span>
|
||||
</div>
|
||||
)} */}
|
||||
</StatusParent>
|
||||
{/* </StatusParent> */}
|
||||
</Link>
|
||||
)}
|
||||
{descendant && replies?.length > 0 && (
|
||||
<SubComments
|
||||
|
@ -1184,14 +1194,14 @@ function SubComments({
|
|||
<ul>
|
||||
{replies.map((r) => (
|
||||
<li key={r.id}>
|
||||
{/* <Link
|
||||
<Link
|
||||
class="status-link"
|
||||
to={instance ? `/${instance}/s/${r.id}` : `/s/${r.id}`}
|
||||
onClick={() => {
|
||||
resetScrollPosition(r.id);
|
||||
}}
|
||||
> */}
|
||||
<div class="status-focus" tabIndex={0}>
|
||||
>
|
||||
{/* <div class="status-focus" tabIndex={0}> */}
|
||||
<Status
|
||||
statusID={r.id}
|
||||
instance={instance}
|
||||
|
@ -1208,8 +1218,8 @@ function SubComments({
|
|||
</span>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
{/* </Link> */}
|
||||
{/* </div> */}
|
||||
</Link>
|
||||
{r.replies?.length && (
|
||||
<SubComments
|
||||
instance={instance}
|
||||
|
|
Loading…
Reference in a new issue