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