Перепиливание под чистый DDD
This commit is contained in:
@@ -285,6 +285,7 @@ const translations = {
|
||||
loadChatsError: 'Ошибка загрузки чатов',
|
||||
loadMessagesError: 'Ошибка загрузки сообщений',
|
||||
unreadMessages: 'Непрочитанные сообщения',
|
||||
attachmentDiscardConfirm: 'У вас есть прикрепленные вложения. Если вы перейдете в другой чат, они будут потеряны. Продолжить?',
|
||||
},
|
||||
en: {
|
||||
myProfile: 'My Profile',
|
||||
@@ -540,6 +541,7 @@ const translations = {
|
||||
loadChatsError: 'Error loading chats',
|
||||
loadMessagesError: 'Error loading messages',
|
||||
unreadMessages: 'Unread messages',
|
||||
attachmentDiscardConfirm: 'You have attached files. If you switch to another chat, they will be lost. Continue?',
|
||||
},
|
||||
} as const;
|
||||
|
||||
|
||||
@@ -13,8 +13,14 @@ interface ImageLightboxProps {
|
||||
export default function ImageLightbox({ url, images, initialIndex = 0, onClose }: ImageLightboxProps) {
|
||||
const gallery = images && images.length > 0;
|
||||
const [index, setIndex] = useState(initialIndex);
|
||||
const currentUrl = gallery ? images![index].url : url!;
|
||||
|
||||
useEffect(() => {
|
||||
setIndex(initialIndex);
|
||||
}, [initialIndex]);
|
||||
|
||||
const rawUrl = gallery ? images![index].url : url!;
|
||||
const currentType = gallery ? images![index].type : undefined;
|
||||
const currentUrl = currentType === 'video' ? rawUrl + (rawUrl.includes('?') ? '&lb=' + index : '?lb=' + index) : rawUrl;
|
||||
const total = gallery ? images!.length : 1;
|
||||
|
||||
const goPrev = useCallback(() => {
|
||||
@@ -101,6 +107,7 @@ export default function ImageLightbox({ url, images, initialIndex = 0, onClose }
|
||||
src={currentUrl}
|
||||
controls
|
||||
autoPlay
|
||||
playsInline
|
||||
preload="metadata"
|
||||
className="w-full h-full object-contain outline-none bg-black/50"
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user