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", "name": "voipms-desktop",
"productName": "bubble", "productName": "bubble",
"version": "0.9.1", "version": "0.9.2",
"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,
+27 -6
View File
@@ -21,6 +21,11 @@ export interface Jump {
nonce: number 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 const sameConv = (a?: ConvKey | null, b?: ConvKey | null): boolean => !!a && !!b && a.did === b.did && a.contact === b.contact
export function App() { export function App() {
@@ -34,7 +39,13 @@ export function App() {
const [sync, setSync] = useState<SyncStatus>() const [sync, setSync] = useState<SyncStatus>()
const [settingsOpen, setSettingsOpen] = useState(false) const [settingsOpen, setSettingsOpen] = useState(false)
const [msgVersion, setMsgVersion] = useState(0) 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 [info, setInfo] = useState<ConvKey | null>(null)
const [exporting, setExporting] = useState<ConvKey | null>(null) const [exporting, setExporting] = useState<ConvKey | null>(null)
const [adding, setAdding] = useState<string | null>(null) const [adding, setAdding] = useState<string | null>(null)
@@ -60,6 +71,7 @@ export function App() {
window.api.onOpenConversation((key) => { window.api.onOpenConversation((key) => {
setMode('chats') setMode('chats')
setSelected(key) setSelected(key)
setKept(key)
setJump(undefined) setJump(undefined)
}) })
] ]
@@ -78,6 +90,7 @@ export function App() {
const open = useCallback((key: ConvKey, jumpTo?: number) => { const open = useCallback((key: ConvKey, jumpTo?: number) => {
setSelected(key) setSelected(key)
setKept(key)
setJump(jumpTo !== undefined ? { id: jumpTo, nonce: Date.now() } : undefined) 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)), []) const onMarkUnread = useCallback((key: ConvKey) => setSelected((cur) => (sameConv(cur, key) ? null : cur)), [])
// The list currently shown in the sidebar (for Alt+↑/↓). // 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]) useEffect(() => setTooltipsEnabled(state?.settings.showTooltips !== false), [state?.settings.showTooltips])
// Which look the stylesheet draws (styles.css): the house look unless Signal vibes are chosen. // 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() document.getElementById('sidebar-search')?.focus()
} else if (c === 'newChat') setMode('compose') } else if (c === 'newChat') setMode('compose')
else if (c === 'preferences') setSettingsOpen(true) 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() else if (c === 'checkNow') void window.api.pollNow()
}), }),
[state?.configured] [state?.configured, view, setView]
) )
// Keyboard shortcuts (Signal-like, plus the menu bar's). // Keyboard shortcuts (Signal-like, plus the menu bar's).
@@ -166,8 +186,9 @@ export function App() {
gvNumber={state.gvoiceNumber} gvNumber={state.gvoiceNumber}
defaultDid={state.settings.defaultDid ?? smsDids[0]?.did} defaultDid={state.settings.defaultDid ?? smsDids[0]?.did}
onSettings={() => setSettingsOpen(true)} onSettings={() => setSettingsOpen(true)}
archiveView={archiveView} view={view}
setArchiveView={setArchiveView} setView={setView}
listed={listed}
onMarkUnread={onMarkUnread} onMarkUnread={onMarkUnread}
onInfo={setInfo} onInfo={setInfo}
onExport={setExporting} 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" /> <path d="M5 9v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V9M10 13h4" />
</svg> </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 = () => ( export const GroupIcon = () => (
<svg {...base}> <svg {...base}>
<circle cx="9" cy="8" r="3.5" /> <circle cx="9" cy="8" r="3.5" />
+26 -14
View File
@@ -1,13 +1,20 @@
import { useEffect, useRef, useState, type CSSProperties, type PointerEvent as ReactPointerEvent } from 'react' import { useEffect, useRef, useState, type CSSProperties, type PointerEvent as ReactPointerEvent } from 'react'
import type { ContactInfo, Conversation, Did, SyncStatus } from '@shared/types' 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 { ConversationList } from './ConversationList'
import { SearchResults } from './SearchResults' import { SearchResults } from './SearchResults'
import { NewChat } from './NewChat' 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' 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 // Dragging below the default width shrinks the sidebar's contents
// proportionally (via --s) rather than dropping parts of each row. // proportionally (via --s) rather than dropping parts of each row.
const DEFAULT_WIDTH = 340 const DEFAULT_WIDTH = 340
@@ -100,8 +107,10 @@ interface Props {
gvNumber?: string gvNumber?: string
defaultDid?: string defaultDid?: string
onSettings: () => void onSettings: () => void
archiveView: boolean view: ListView
setArchiveView: (on: boolean) => void setView: (v: ListView) => void
/** The chats the current view shows. */
listed: Conversation[]
onMarkUnread: (key: ConvKey) => void onMarkUnread: (key: ConvKey) => void
onInfo: (key: ConvKey) => void onInfo: (key: ConvKey) => void
onExport: (key: ConvKey) => void onExport: (key: ConvKey) => void
@@ -176,17 +185,20 @@ export function Sidebar(p: Props) {
<ComposeIcon /> <ComposeIcon />
</button> </button>
<RefreshButton /> <RefreshButton />
{(['unread', 'archived'] as const).map((v) => (
<button <button
className={`icon-btn${p.archiveView ? ' on' : ''}`} key={v}
title={p.archiveView ? 'Back to chats' : 'Archived chats'} className={`icon-btn${p.view === v ? ' on' : ''}`}
aria-pressed={p.archiveView} title={p.view === v ? 'Back to chats' : VIEW_TITLE[v]}
aria-pressed={p.view === v}
onClick={() => { onClick={() => {
p.setArchiveView(!p.archiveView) p.setView(p.view === v ? 'chats' : v)
if (p.mode === 'search') clearSearch() if (p.mode === 'search') clearSearch()
}} }}
> >
<ArchiveIcon /> {v === 'unread' ? <BubblesIcon /> : <ArchiveIcon />}
</button> </button>
))}
<button className="icon-btn" title="Preferences (Ctrl+,)" onClick={p.onSettings}> <button className="icon-btn" title="Preferences (Ctrl+,)" onClick={p.onSettings}>
<GearIcon /> <GearIcon />
</button> </button>
@@ -204,21 +216,21 @@ export function Sidebar(p: Props) {
/> />
) : ( ) : (
<> <>
{p.archiveView && ( {p.view !== 'chats' && (
<div className="archive-header"> <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 /> <BackIcon />
</button> </button>
Archived chats {VIEW_TITLE[p.view]}
</div> </div>
)} )}
<ConversationList <ConversationList
conversations={p.conversations.filter((c) => c.archived === p.archiveView)} conversations={p.listed}
contactMap={p.contactMap} contactMap={p.contactMap}
selected={p.selected} selected={p.selected}
multiDid={p.multiDid} multiDid={p.multiDid}
gvNumber={p.gvNumber} 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} onOpen={p.onOpen}
onMarkUnread={p.onMarkUnread} onMarkUnread={p.onMarkUnread}
onInfo={p.onInfo} onInfo={p.onInfo}