v0.9.2: an unread view

A button with three outlined bubbles, between Check for new messages and Archived chats, lists only unread chats (archived ones too) under an "Unread chats" header, like the archive's. The chat you open from it reads as usual but stays in the list, to keep replying, until you open another one; then it drops out.

Tried on the sandbox's made-up chats: an archived unread chat listed, an opened chat kept until the next was opened, and the view emptying back to the still-unread ones when left and reopened.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-13 13:15:10 -08:00
co-authored by Claude Opus 5.5
parent 4129f72f39
commit 0b2338e1c0
4 changed files with 68 additions and 27 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "voipms-desktop",
"productName": "bubble",
"version": "0.9.1",
"version": "0.9.2",
"description": "Signal-style desktop SMS client for voip.ms",
"author": "trav <trav@teafry.me>",
"private": true,
+27 -6
View File
@@ -21,6 +21,11 @@ export interface Jump {
nonce: number
}
/** Which chats the sidebar lists. */
export type ListView = 'chats' | 'archived' | 'unread'
export const isUnread = (c: Conversation): boolean => c.unread > 0 || c.markedUnread
export const sameConv = (a?: ConvKey | null, b?: ConvKey | null): boolean => !!a && !!b && a.did === b.did && a.contact === b.contact
export function App() {
@@ -34,7 +39,13 @@ export function App() {
const [sync, setSync] = useState<SyncStatus>()
const [settingsOpen, setSettingsOpen] = useState(false)
const [msgVersion, setMsgVersion] = useState(0)
const [archiveView, setArchiveView] = useState(false)
const [view, setViewState] = useState<ListView>('chats')
// The chat opened from the unread view: it stays listed (read now) until another is opened.
const [kept, setKept] = useState<ConvKey | null>(null)
const setView = useCallback((v: ListView) => {
setViewState(v)
setKept(null)
}, [])
const [info, setInfo] = useState<ConvKey | null>(null)
const [exporting, setExporting] = useState<ConvKey | null>(null)
const [adding, setAdding] = useState<string | null>(null)
@@ -60,6 +71,7 @@ export function App() {
window.api.onOpenConversation((key) => {
setMode('chats')
setSelected(key)
setKept(key)
setJump(undefined)
})
]
@@ -78,6 +90,7 @@ export function App() {
const open = useCallback((key: ConvKey, jumpTo?: number) => {
setSelected(key)
setKept(key)
setJump(jumpTo !== undefined ? { id: jumpTo, nonce: Date.now() } : undefined)
}, [])
@@ -85,7 +98,14 @@ export function App() {
const onMarkUnread = useCallback((key: ConvKey) => setSelected((cur) => (sameConv(cur, key) ? null : cur)), [])
// The list currently shown in the sidebar (for Alt+↑/↓).
const listed = useMemo(() => conversations.filter((c) => c.archived === archiveView), [conversations, archiveView])
// The unread view takes archived chats too.
const listed = useMemo(
() =>
conversations.filter((c) =>
view === 'unread' ? isUnread(c) || sameConv(c, kept) : c.archived === (view === 'archived')
),
[conversations, view, kept]
)
useEffect(() => setTooltipsEnabled(state?.settings.showTooltips !== false), [state?.settings.showTooltips])
// Which look the stylesheet draws (styles.css): the house look unless Signal vibes are chosen.
@@ -103,10 +123,10 @@ export function App() {
document.getElementById('sidebar-search')?.focus()
} else if (c === 'newChat') setMode('compose')
else if (c === 'preferences') setSettingsOpen(true)
else if (c === 'archived') setArchiveView((v) => !v)
else if (c === 'archived') setView(view === 'archived' ? 'chats' : 'archived')
else if (c === 'checkNow') void window.api.pollNow()
}),
[state?.configured]
[state?.configured, view, setView]
)
// Keyboard shortcuts (Signal-like, plus the menu bar's).
@@ -166,8 +186,9 @@ export function App() {
gvNumber={state.gvoiceNumber}
defaultDid={state.settings.defaultDid ?? smsDids[0]?.did}
onSettings={() => setSettingsOpen(true)}
archiveView={archiveView}
setArchiveView={setArchiveView}
view={view}
setView={setView}
listed={listed}
onMarkUnread={onMarkUnread}
onInfo={setInfo}
onExport={setExporting}
+8
View File
@@ -90,6 +90,14 @@ export const ArchiveIcon = () => (
<path d="M5 9v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V9M10 13h4" />
</svg>
)
// Three outlined bubbles of different sizes: the unread view.
export const BubblesIcon = () => (
<svg {...base}>
<circle cx="9" cy="14" r="6" />
<circle cx="17" cy="6.5" r="3.5" />
<circle cx="19.5" cy="15.5" r="2" />
</svg>
)
export const GroupIcon = () => (
<svg {...base}>
<circle cx="9" cy="8" r="3.5" />
+32 -20
View File
@@ -1,13 +1,20 @@
import { useEffect, useRef, useState, type CSSProperties, type PointerEvent as ReactPointerEvent } from 'react'
import type { ContactInfo, Conversation, Did, SyncStatus } from '@shared/types'
import type { ConvKey } from '../App'
import type { ConvKey, ListView } from '../App'
import { ConversationList } from './ConversationList'
import { SearchResults } from './SearchResults'
import { NewChat } from './NewChat'
import { ArchiveIcon, BackIcon, CloseIcon, ComposeIcon, GearIcon, RefreshIcon, SearchIcon } from './Icons'
import { ArchiveIcon, BackIcon, BubblesIcon, CloseIcon, ComposeIcon, GearIcon, RefreshIcon, SearchIcon } from './Icons'
export type SidebarMode = 'chats' | 'search' | 'compose'
const VIEW_TITLE = { unread: 'Unread chats', archived: 'Archived chats' } as const
const EMPTY_TEXT: Record<ListView, string> = {
chats: 'No conversations yet.',
archived: 'No archived chats. Right-click a chat to archive it.',
unread: 'No unread chats.'
}
// Dragging below the default width shrinks the sidebar's contents
// proportionally (via --s) rather than dropping parts of each row.
const DEFAULT_WIDTH = 340
@@ -100,8 +107,10 @@ interface Props {
gvNumber?: string
defaultDid?: string
onSettings: () => void
archiveView: boolean
setArchiveView: (on: boolean) => void
view: ListView
setView: (v: ListView) => void
/** The chats the current view shows. */
listed: Conversation[]
onMarkUnread: (key: ConvKey) => void
onInfo: (key: ConvKey) => void
onExport: (key: ConvKey) => void
@@ -176,17 +185,20 @@ export function Sidebar(p: Props) {
<ComposeIcon />
</button>
<RefreshButton />
<button
className={`icon-btn${p.archiveView ? ' on' : ''}`}
title={p.archiveView ? 'Back to chats' : 'Archived chats'}
aria-pressed={p.archiveView}
onClick={() => {
p.setArchiveView(!p.archiveView)
if (p.mode === 'search') clearSearch()
}}
>
<ArchiveIcon />
</button>
{(['unread', 'archived'] as const).map((v) => (
<button
key={v}
className={`icon-btn${p.view === v ? ' on' : ''}`}
title={p.view === v ? 'Back to chats' : VIEW_TITLE[v]}
aria-pressed={p.view === v}
onClick={() => {
p.setView(p.view === v ? 'chats' : v)
if (p.mode === 'search') clearSearch()
}}
>
{v === 'unread' ? <BubblesIcon /> : <ArchiveIcon />}
</button>
))}
<button className="icon-btn" title="Preferences (Ctrl+,)" onClick={p.onSettings}>
<GearIcon />
</button>
@@ -204,21 +216,21 @@ export function Sidebar(p: Props) {
/>
) : (
<>
{p.archiveView && (
{p.view !== 'chats' && (
<div className="archive-header">
<button className="icon-btn inline" title="Back to chats" onClick={() => p.setArchiveView(false)}>
<button className="icon-btn inline" title="Back to chats" onClick={() => p.setView('chats')}>
<BackIcon />
</button>
Archived chats
{VIEW_TITLE[p.view]}
</div>
)}
<ConversationList
conversations={p.conversations.filter((c) => c.archived === p.archiveView)}
conversations={p.listed}
contactMap={p.contactMap}
selected={p.selected}
multiDid={p.multiDid}
gvNumber={p.gvNumber}
emptyText={p.archiveView ? 'No archived chats. Right-click a chat to archive it.' : 'No conversations yet.'}
emptyText={EMPTY_TEXT[p.view]}
onOpen={p.onOpen}
onMarkUnread={p.onMarkUnread}
onInfo={p.onInfo}