v0.8.1: Get info shows the newest photos first
The thumbnails run newest first, like Signal; the full-size view still steps ← older, → newer, as in the chat.
This commit is contained in:
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "voipms-desktop",
|
||||
"productName": "bubble",
|
||||
"version": "0.8.0",
|
||||
"version": "0.8.1",
|
||||
"description": "Signal-style desktop SMS client for voip.ms",
|
||||
"author": "trav <trav@teafry.me>",
|
||||
"private": true,
|
||||
|
||||
Binary file not shown.
@@ -1,4 +1,4 @@
|
||||
import { useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react'
|
||||
import { useEffect, useMemo, useState } from 'react'
|
||||
import { formatNumber, groupMembers, isGroup } from '@shared/phone'
|
||||
import type { ContactInfo, Message } from '@shared/types'
|
||||
import type { ConvKey } from '../App'
|
||||
@@ -18,13 +18,12 @@ interface Props {
|
||||
onClose: () => void
|
||||
}
|
||||
|
||||
// Every picture and video in the chat as thumbnails, oldest first like the
|
||||
// chat itself, scrolled to the newest. Each opens full size; ← → step through.
|
||||
// Every picture and video in the chat as thumbnails, newest first. Each opens
|
||||
// full size, where ← is older and → newer, as in the chat.
|
||||
function MediaGrid({ conv }: { conv: ConvKey }) {
|
||||
const [messages, setMessages] = useState<Message[]>()
|
||||
const [open, setOpen] = useState<number>()
|
||||
const [broken, setBroken] = useState<Set<string>>(new Set())
|
||||
const grid = useRef<HTMLDivElement>(null)
|
||||
useEffect(() => {
|
||||
let cancelled = false
|
||||
void window.api.getMessages(conv.did, conv.contact).then((m) => !cancelled && setMessages(m))
|
||||
@@ -33,9 +32,6 @@ function MediaGrid({ conv }: { conv: ConvKey }) {
|
||||
}
|
||||
}, [conv.did, conv.contact])
|
||||
const items = useMemo(() => conversationMedia(messages ?? []), [messages])
|
||||
useLayoutEffect(() => {
|
||||
if (grid.current) grid.current.scrollTop = grid.current.scrollHeight
|
||||
}, [items])
|
||||
|
||||
if (!messages) return null
|
||||
const key = (it: MediaItem): string => `${it.id}:${it.index}`
|
||||
@@ -45,8 +41,8 @@ function MediaGrid({ conv }: { conv: ConvKey }) {
|
||||
Media{items.length ? <span className="muted"> · {items.length}</span> : null}
|
||||
</h3>
|
||||
{items.length ? (
|
||||
<div className="media-grid" ref={grid}>
|
||||
{items.map((it, i) => (
|
||||
<div className="media-grid">
|
||||
{items.map((it, i) => ({ it, i })).reverse().map(({ it, i }) => (
|
||||
<div
|
||||
key={key(it)}
|
||||
className="media-thumb"
|
||||
|
||||
Reference in New Issue
Block a user