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",
|
"name": "voipms-desktop",
|
||||||
"productName": "bubble",
|
"productName": "bubble",
|
||||||
"version": "0.8.3",
|
"version": "0.8.4",
|
||||||
"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.
@@ -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 members = group ? groupMembers(conv.contact).map((n) => senderName(n, contactMap)) : []
|
||||||
const [messages, setMessages] = useState<Message[]>()
|
const [messages, setMessages] = useState<Message[]>()
|
||||||
const [flashId, setFlashId] = useState<number>()
|
const [flashId, setFlashId] = useState<number>()
|
||||||
const [searchOpen, setSearchOpen] = useState(false)
|
|
||||||
const [q, setQ] = useState('')
|
const [q, setQ] = useState('')
|
||||||
const [hits, setHits] = useState<SearchHit[]>([])
|
const [hits, setHits] = useState<SearchHit[]>([])
|
||||||
const [hitIdx, setHitIdx] = useState(0)
|
const [hitIdx, setHitIdx] = useState(0)
|
||||||
@@ -199,7 +198,7 @@ export function ChatView({ conv, contact, contactMap, conversations, onOpen, nam
|
|||||||
|
|
||||||
// ---- in-chat search ----
|
// ---- in-chat search ----
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!searchOpen || !q.trim()) {
|
if (!q.trim()) {
|
||||||
setHits([])
|
setHits([])
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -217,7 +216,7 @@ export function ChatView({ conv, contact, contactMap, conversations, onOpen, nam
|
|||||||
clearTimeout(t)
|
clearTimeout(t)
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [q, searchOpen])
|
}, [q])
|
||||||
|
|
||||||
const stepHit = (dir: 1 | -1): void => {
|
const stepHit = (dir: 1 | -1): void => {
|
||||||
if (!hits.length) return
|
if (!hits.length) return
|
||||||
@@ -227,8 +226,8 @@ export function ChatView({ conv, contact, contactMap, conversations, onOpen, nam
|
|||||||
}
|
}
|
||||||
|
|
||||||
const openSearch = (): void => {
|
const openSearch = (): void => {
|
||||||
setSearchOpen(true)
|
searchInput.current?.focus()
|
||||||
setTimeout(() => searchInput.current?.focus(), 0)
|
searchInput.current?.select()
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -254,7 +253,7 @@ export function ChatView({ conv, contact, contactMap, conversations, onOpen, nam
|
|||||||
if (atBottom.current) virtuoso.current?.scrollToIndex({ index: 'LAST', align: 'end' })
|
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 isNew = messages !== undefined && messages.length === 0
|
||||||
const initialIndex = jump && messages ? Math.max(0, indexOf(jump.id)) : rows.length - 1
|
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()
|
onInfo()
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Avatar number={conv.contact} contact={contact} size={36} />
|
<Avatar number={conv.contact} contact={contact} size={28} />
|
||||||
</div>
|
</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-title clickable" onClick={onInfo} title="Get info">
|
||||||
<div className="chat-name">{name}</div>
|
<span className="chat-name">{name}</span>
|
||||||
{(group || smsDids.length > 1) && (
|
{group && <span className="chat-count">{members.length} people</span>}
|
||||||
<div className="chat-sub">
|
{smsDids.length > 1 && (
|
||||||
{group && `${members.length} people`}
|
<span className="chat-via">
|
||||||
{smsDids.length > 1 && (
|
<Via did={conv.did} gvNumber={gvNumber} tag />
|
||||||
<span className="chat-via">
|
</span>
|
||||||
{group ? ' · ' : ''}
|
|
||||||
<Via did={conv.did} gvNumber={gvNumber} tag />
|
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
)}
|
)}
|
||||||
</div>
|
<div
|
||||||
<button className="icon-btn" title="Search in chat (Ctrl+Shift+F)" onClick={openSearch}>
|
className="search-box chat-search-box"
|
||||||
<SearchIcon />
|
title=""
|
||||||
</button>
|
onClick={(e) => {
|
||||||
</header>
|
e.stopPropagation()
|
||||||
|
searchInput.current?.focus()
|
||||||
{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('')
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<CloseIcon />
|
<span className="search-glyph">
|
||||||
</button>
|
<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>
|
</div>
|
||||||
)}
|
</header>
|
||||||
|
|
||||||
<div className="messages">
|
<div className="messages">
|
||||||
{messages === undefined ? null : isNew ? (
|
{messages === undefined ? null : isNew ? (
|
||||||
|
|||||||
@@ -3439,31 +3439,34 @@ select {
|
|||||||
/* ---------- the chat ---------- */
|
/* ---------- the chat ---------- */
|
||||||
.chat-header {
|
.chat-header {
|
||||||
border-bottom: 0;
|
border-bottom: 0;
|
||||||
height: 58px;
|
height: 44px;
|
||||||
padding: 0 8px;
|
padding: 0 8px;
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
}
|
}
|
||||||
/* The chat's name is an info panel (debossed); a group's opens its info,
|
/* The chat's name is an info panel (debossed) that opens Get info, so it
|
||||||
so it pops out on hover and sinks while held (#clickable). */
|
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 {
|
.chat-title {
|
||||||
align-self: stretch;
|
align-self: stretch;
|
||||||
margin: 6px 0;
|
margin: 5px 0;
|
||||||
padding: 3px 12px;
|
padding: 0 4px 0 12px;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: row;
|
||||||
justify-content: center;
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
background: var(--deboss);
|
background: var(--deboss);
|
||||||
border: 1px solid var(--deboss-edge);
|
border: 1px solid var(--deboss-edge);
|
||||||
border-top-color: var(--deboss-edge2);
|
border-top-color: var(--deboss-edge2);
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
color: var(--panel-text);
|
color: var(--panel-text);
|
||||||
}
|
}
|
||||||
.chat-title.clickable:hover {
|
.chat-title.clickable:hover:not(:has(.chat-search-box:hover)) {
|
||||||
background: var(--deboss-hover);
|
background: var(--deboss-hover);
|
||||||
border-color: var(--btn-edge);
|
border-color: var(--btn-edge);
|
||||||
border-bottom-color: var(--btn-edge2);
|
border-bottom-color: var(--btn-edge2);
|
||||||
}
|
}
|
||||||
.chat-title.clickable:active {
|
.chat-title.clickable:active:not(:has(.chat-search-box:hover)) {
|
||||||
background: var(--deboss-down);
|
background: var(--deboss-down);
|
||||||
border-color: var(--btn-down-edge);
|
border-color: var(--btn-down-edge);
|
||||||
border-top-color: var(--btn-down-edge2);
|
border-top-color: var(--btn-down-edge2);
|
||||||
@@ -3872,4 +3875,52 @@ label.check {
|
|||||||
.lightbox-step:disabled {
|
.lightbox-step:disabled {
|
||||||
visibility: hidden;
|
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]')
|
const el = (e.target as Element).closest?.('[title], [data-tip]')
|
||||||
if (!el) return
|
if (!el) return
|
||||||
const text = adopt(el)
|
const text = adopt(el)
|
||||||
if (el === current || !text || !enabled) return
|
if (el === current) return
|
||||||
hide()
|
hide() // also when it's an empty title, there to hush its parent's
|
||||||
|
if (!text || !enabled) return
|
||||||
timer = window.setTimeout(() => {
|
timer = window.setTimeout(() => {
|
||||||
if (el.isConnected && enabled) show(el, el.getAttribute('data-tip') ?? text, x, y)
|
if (el.isConnected && enabled) show(el, el.getAttribute('data-tip') ?? text, x, y)
|
||||||
}, 600)
|
}, 600)
|
||||||
|
|||||||
Reference in New Issue
Block a user