Update files

This commit is contained in:
glpshchn 2025-11-10 23:35:21 +03:00
parent b244fdcf13
commit 73c91b4ec5
2 changed files with 31 additions and 5 deletions

View File

@ -347,6 +347,13 @@
pointer-events: none; pointer-events: none;
} }
.viewer-content video {
max-width: 100%;
max-height: 100%;
object-fit: contain;
background: black;
}
.swipe-hint { .swipe-hint {
position: absolute; position: absolute;
bottom: 20px; bottom: 20px;

View File

@ -22,6 +22,12 @@ export default function Search({ user }) {
const touchStartX = useRef(0) const touchStartX = useRef(0)
const touchEndX = useRef(0) const touchEndX = useRef(0)
const isVideoUrl = (url = '') => {
if (!url) return false
const clean = url.split('?')[0].toLowerCase()
return clean.endsWith('.mp4') || clean.endsWith('.webm') || clean.endsWith('.mov') || clean.endsWith('.m4v')
}
useEffect(() => { useEffect(() => {
if (query.length > 1) { if (query.length > 1) {
loadTagSuggestions() loadTagSuggestions()
@ -476,11 +482,24 @@ export default function Search({ user }) {
onTouchMove={handleTouchMove} onTouchMove={handleTouchMove}
onTouchEnd={handleTouchEnd} onTouchEnd={handleTouchEnd}
> >
{isVideoUrl(results[currentIndex].url) ? (
<video
src={results[currentIndex].url}
controls
autoPlay
loop
muted
playsInline
poster={results[currentIndex].preview}
draggable={false}
/>
) : (
<img <img
src={results[currentIndex].url} src={results[currentIndex].url}
alt="Full view" alt="Full view"
draggable={false} draggable={false}
/> />
)}
{/* Индикатор свайпа */} {/* Индикатор свайпа */}
<div className="swipe-hint"> <div className="swipe-hint">