v0.8.4: a one-line chat header with the search field always there
The name, a group's size and the [GV]/[MS]/[SIM] tag (at the right) share one line, so the header, its picture included, is smaller. Search in chat is a field at the end of the name panel: click in and type; Esc clears it, Enter/Shift+Enter step, Ctrl+Shift+F still jumps there. The panel still opens Get info, except over the field.
This commit is contained in:
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "voipms-desktop",
|
||||
"productName": "bubble",
|
||||
"version": "0.8.3",
|
||||
"version": "0.8.4",
|
||||
"description": "Signal-style desktop SMS client for voip.ms",
|
||||
"author": "trav <trav@teafry.me>",
|
||||
"private": true,
|
||||
|
||||
Binary file not shown.
@@ -90,7 +90,6 @@ export function ChatView({ conv, contact, contactMap, conversations, onOpen, nam
|
||||
const members = group ? groupMembers(conv.contact).map((n) => senderName(n, contactMap)) : []
|
||||
const [messages, setMessages] = useState<Message[]>()
|
||||
const [flashId, setFlashId] = useState<number>()
|
||||
const [searchOpen, setSearchOpen] = useState(false)
|
||||
const [q, setQ] = useState('')
|
||||
const [hits, setHits] = useState<SearchHit[]>([])
|
||||
const [hitIdx, setHitIdx] = useState(0)
|
||||
@@ -199,7 +198,7 @@ export function ChatView({ conv, contact, contactMap, conversations, onOpen, nam
|
||||
|
||||
// ---- in-chat search ----
|
||||
useEffect(() => {
|
||||
if (!searchOpen || !q.trim()) {
|
||||
if (!q.trim()) {
|
||||
setHits([])
|
||||
return
|
||||
}
|
||||
@@ -217,7 +216,7 @@ export function ChatView({ conv, contact, contactMap, conversations, onOpen, nam
|
||||
clearTimeout(t)
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [q, searchOpen])
|
||||
}, [q])
|
||||
|
||||
const stepHit = (dir: 1 | -1): void => {
|
||||
if (!hits.length) return
|
||||
@@ -227,8 +226,8 @@ export function ChatView({ conv, contact, contactMap, conversations, onOpen, nam
|
||||
}
|
||||
|
||||
const openSearch = (): void => {
|
||||
setSearchOpen(true)
|
||||
setTimeout(() => searchInput.current?.focus(), 0)
|
||||
searchInput.current?.focus()
|
||||
searchInput.current?.select()
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
@@ -254,7 +253,7 @@ export function ChatView({ conv, contact, contactMap, conversations, onOpen, nam
|
||||
if (atBottom.current) virtuoso.current?.scrollToIndex({ index: 'LAST', align: 'end' })
|
||||
}, [])
|
||||
|
||||
const mark = searchOpen && q.trim() ? q : highlight
|
||||
const mark = q.trim() ? q : highlight
|
||||
const isNew = messages !== undefined && messages.length === 0
|
||||
const initialIndex = jump && messages ? Math.max(0, indexOf(jump.id)) : rows.length - 1
|
||||
|
||||
@@ -296,65 +295,60 @@ export function ChatView({ conv, contact, contactMap, conversations, onOpen, nam
|
||||
onInfo()
|
||||
}}
|
||||
>
|
||||
<Avatar number={conv.contact} contact={contact} size={36} />
|
||||
<Avatar number={conv.contact} contact={contact} size={28} />
|
||||
</div>
|
||||
{/* The number lives in Get info, not here. */}
|
||||
{/* One line: the name, the tag of the number it goes through at the
|
||||
right, then the search field. The number lives in Get info. */}
|
||||
<div className="chat-title clickable" onClick={onInfo} title="Get info">
|
||||
<div className="chat-name">{name}</div>
|
||||
{(group || smsDids.length > 1) && (
|
||||
<div className="chat-sub">
|
||||
{group && `${members.length} people`}
|
||||
{smsDids.length > 1 && (
|
||||
<span className="chat-via">
|
||||
{group ? ' · ' : ''}
|
||||
<Via did={conv.did} gvNumber={gvNumber} tag />
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
<span className="chat-name">{name}</span>
|
||||
{group && <span className="chat-count">{members.length} people</span>}
|
||||
{smsDids.length > 1 && (
|
||||
<span className="chat-via">
|
||||
<Via did={conv.did} gvNumber={gvNumber} tag />
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
<button className="icon-btn" title="Search in chat (Ctrl+Shift+F)" onClick={openSearch}>
|
||||
<SearchIcon />
|
||||
</button>
|
||||
</header>
|
||||
|
||||
{searchOpen && (
|
||||
<div className="chat-search">
|
||||
<SearchIcon size={16} />
|
||||
<input
|
||||
ref={searchInput}
|
||||
value={q}
|
||||
placeholder={`Search in ${name}`}
|
||||
onChange={(e) => setQ(e.target.value)}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === 'Enter') stepHit(e.shiftKey ? -1 : 1)
|
||||
else if (e.key === 'Escape') {
|
||||
setSearchOpen(false)
|
||||
setQ('')
|
||||
}
|
||||
}}
|
||||
/>
|
||||
<span className="hit-count">{q.trim() ? (hits.length ? `${hitIdx + 1} of ${hits.length}` : 'No results') : ''}</span>
|
||||
<div className="tiles">
|
||||
<button className="icon-btn small" title="Older (Enter)" disabled={!hits.length} onClick={() => stepHit(1)}>
|
||||
<UpIcon />
|
||||
</button>
|
||||
<button className="icon-btn small" title="Newer (Shift+Enter)" disabled={!hits.length} onClick={() => stepHit(-1)}>
|
||||
<DownIcon />
|
||||
</button>
|
||||
</div>
|
||||
<button
|
||||
className="icon-btn small"
|
||||
title="Close"
|
||||
onClick={() => {
|
||||
setSearchOpen(false)
|
||||
setQ('')
|
||||
<div
|
||||
className="search-box chat-search-box"
|
||||
title=""
|
||||
onClick={(e) => {
|
||||
e.stopPropagation()
|
||||
searchInput.current?.focus()
|
||||
}}
|
||||
>
|
||||
<CloseIcon />
|
||||
</button>
|
||||
<span className="search-glyph">
|
||||
<SearchIcon size={14} />
|
||||
</span>
|
||||
<input
|
||||
ref={searchInput}
|
||||
value={q}
|
||||
placeholder="Search in chat"
|
||||
aria-label="Search in chat (Ctrl+Shift+F)"
|
||||
onChange={(e) => setQ(e.target.value)}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === 'Enter') stepHit(e.shiftKey ? -1 : 1)
|
||||
else if (e.key === 'Escape') {
|
||||
setQ('')
|
||||
e.currentTarget.blur()
|
||||
}
|
||||
}}
|
||||
/>
|
||||
{q.trim() && (
|
||||
<>
|
||||
<span className="hit-count">{hits.length ? `${hitIdx + 1} of ${hits.length}` : 'No results'}</span>
|
||||
<button className="icon-btn inline" title="Older (Enter)" disabled={!hits.length} onClick={() => stepHit(1)}>
|
||||
<UpIcon />
|
||||
</button>
|
||||
<button className="icon-btn inline" title="Newer (Shift+Enter)" disabled={!hits.length} onClick={() => stepHit(-1)}>
|
||||
<DownIcon />
|
||||
</button>
|
||||
<button className="icon-btn inline" title="Clear (Esc)" onClick={() => setQ('')}>
|
||||
<CloseIcon size={14} />
|
||||
</button>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</header>
|
||||
|
||||
<div className="messages">
|
||||
{messages === undefined ? null : isNew ? (
|
||||
|
||||
@@ -3439,31 +3439,34 @@ select {
|
||||
/* ---------- the chat ---------- */
|
||||
.chat-header {
|
||||
border-bottom: 0;
|
||||
height: 58px;
|
||||
height: 44px;
|
||||
padding: 0 8px;
|
||||
gap: 8px;
|
||||
}
|
||||
/* The chat's name is an info panel (debossed); a group's opens its info,
|
||||
so it pops out on hover and sinks while held (#clickable). */
|
||||
/* The chat's name is an info panel (debossed) that opens Get info, so it
|
||||
pops out on hover and sinks while held (#clickable) -- except over the
|
||||
search field at its end, which is a text box of its own. One line:
|
||||
name, (group size), the number's tag at the right, the search field. */
|
||||
.chat-title {
|
||||
align-self: stretch;
|
||||
margin: 6px 0;
|
||||
padding: 3px 12px;
|
||||
margin: 5px 0;
|
||||
padding: 0 4px 0 12px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
background: var(--deboss);
|
||||
border: 1px solid var(--deboss-edge);
|
||||
border-top-color: var(--deboss-edge2);
|
||||
border-radius: 8px;
|
||||
color: var(--panel-text);
|
||||
}
|
||||
.chat-title.clickable:hover {
|
||||
.chat-title.clickable:hover:not(:has(.chat-search-box:hover)) {
|
||||
background: var(--deboss-hover);
|
||||
border-color: var(--btn-edge);
|
||||
border-bottom-color: var(--btn-edge2);
|
||||
}
|
||||
.chat-title.clickable:active {
|
||||
.chat-title.clickable:active:not(:has(.chat-search-box:hover)) {
|
||||
background: var(--deboss-down);
|
||||
border-color: var(--btn-down-edge);
|
||||
border-top-color: var(--btn-down-edge2);
|
||||
@@ -3872,4 +3875,52 @@ label.check {
|
||||
.lightbox-step:disabled {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
/* ---------- chat header: one line, search always there ---------- */
|
||||
.chat-title .chat-name {
|
||||
font-size: 15px;
|
||||
min-width: 0;
|
||||
}
|
||||
.chat-count {
|
||||
flex: none;
|
||||
font-size: 12px;
|
||||
color: var(--muted);
|
||||
}
|
||||
.chat-via {
|
||||
flex: none;
|
||||
margin-left: auto;
|
||||
font-size: 11px;
|
||||
color: var(--faint);
|
||||
display: flex;
|
||||
}
|
||||
.chat-via .gv-tag {
|
||||
margin-right: 0;
|
||||
}
|
||||
.chat-title > .chat-name + .chat-search-box,
|
||||
.chat-title > .chat-count + .chat-search-box {
|
||||
margin-left: auto;
|
||||
}
|
||||
.chat-search-box {
|
||||
flex: 0 1 260px;
|
||||
min-width: 140px;
|
||||
height: 26px;
|
||||
cursor: text;
|
||||
padding: 0 2px 0 6px;
|
||||
}
|
||||
.chat-search-box .search-glyph {
|
||||
padding-right: 4px;
|
||||
}
|
||||
.chat-search-box input {
|
||||
font-size: 13px;
|
||||
}
|
||||
.chat-search-box .hit-count {
|
||||
flex: none;
|
||||
font-size: 11px;
|
||||
color: var(--muted);
|
||||
margin: 0 2px;
|
||||
}
|
||||
.chat-search-box .icon-btn.inline {
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,8 +56,9 @@ export function installTooltips(): void {
|
||||
const el = (e.target as Element).closest?.('[title], [data-tip]')
|
||||
if (!el) return
|
||||
const text = adopt(el)
|
||||
if (el === current || !text || !enabled) return
|
||||
hide()
|
||||
if (el === current) return
|
||||
hide() // also when it's an empty title, there to hush its parent's
|
||||
if (!text || !enabled) return
|
||||
timer = window.setTimeout(() => {
|
||||
if (el.isConnected && enabled) show(el, el.getAttribute('data-tip') ?? text, x, y)
|
||||
}, 600)
|
||||
|
||||
Reference in New Issue
Block a user