v0.7.7 bugs fixes

This commit is contained in:
2026-03-11 19:11:18 -04:00
parent 03a8983b7d
commit 08243be745
9 changed files with 86 additions and 45 deletions

View File

@@ -7,7 +7,7 @@ TZ=UTC
# Copy this file to .env and customize # Copy this file to .env and customize
# Image version to run (set by build.sh, or use 'latest') # Image version to run (set by build.sh, or use 'latest')
JAMA_VERSION=0.7.5 JAMA_VERSION=0.7.7
# Default admin credentials (used on FIRST RUN only) # Default admin credentials (used on FIRST RUN only)
ADMIN_NAME=Admin User ADMIN_NAME=Admin User

View File

@@ -1,6 +1,6 @@
{ {
"name": "jama-backend", "name": "jama-backend",
"version": "0.7.5", "version": "0.7.7",
"description": "TeamChat backend server", "description": "TeamChat backend server",
"main": "src/index.js", "main": "src/index.js",
"scripts": { "scripts": {

View File

@@ -13,7 +13,7 @@
# ───────────────────────────────────────────────────────────── # ─────────────────────────────────────────────────────────────
set -euo pipefail set -euo pipefail
VERSION="${1:-0.7.5}" VERSION="${1:-0.7.7}"
ACTION="${2:-}" ACTION="${2:-}"
REGISTRY="${REGISTRY:-}" REGISTRY="${REGISTRY:-}"
IMAGE_NAME="jama" IMAGE_NAME="jama"

View File

@@ -1,6 +1,6 @@
{ {
"name": "jama-frontend", "name": "jama-frontend",
"version": "0.7.5", "version": "0.7.7",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",

View File

@@ -233,7 +233,7 @@ export default function ChatWindow({ group, onBack, onGroupUpdated, onDirectMess
{group.type === 'public' ? '#' : group.is_direct ? (group.peer_real_name || group.name)[0]?.toUpperCase() : group.name[0]?.toUpperCase()} {group.type === 'public' ? '#' : group.is_direct ? (group.peer_real_name || group.name)[0]?.toUpperCase() : group.name[0]?.toUpperCase()}
</div> </div>
)} )}
{!!group.is_direct && group.peer_id && onlineUserIds.has(group.peer_id) && ( {!!group.is_direct && group.peer_id && (onlineUserIds instanceof Set ? onlineUserIds.has(Number(group.peer_id)) : false) && (
<span style={{ <span style={{
position: 'absolute', bottom: 1, right: 1, position: 'absolute', bottom: 1, right: 1,
width: 11, height: 11, borderRadius: '50%', width: 11, height: 11, borderRadius: '50%',

View File

@@ -334,6 +334,43 @@
user-select: text; user-select: text;
} }
/* Triple-dot pin button wrapper */
.msg-pin-wrap {
position: relative;
display: flex;
align-items: center;
align-self: flex-end;
margin-bottom: 2px;
}
.msg-pin-btn {
opacity: 0;
transition: opacity 0.15s;
color: var(--text-tertiary);
padding: 2px 4px;
border-radius: 4px;
}
.msg-pin-btn:hover,
.msg-pin-btn.active {
opacity: 1 !important;
color: var(--text-primary);
background: var(--surface-variant);
}
/* Show pin button on message row hover */
.msg-bubble-wrap:hover .msg-pin-btn,
.msg-pin-btn.active {
opacity: 1;
}
/* On touch devices always show it so users know it's there */
@media (hover: none) {
.msg-pin-btn {
opacity: 0.45;
}
}
/* Message pin/options popup menu */ /* Message pin/options popup menu */
.msg-options-menu { .msg-options-menu {
position: absolute; position: absolute;
@@ -344,7 +381,8 @@
box-shadow: var(--shadow-md); box-shadow: var(--shadow-md);
padding: 4px 0; padding: 4px 0;
min-width: 170px; min-width: 170px;
top: calc(100% + 4px); bottom: calc(100% + 4px);
white-space: nowrap;
} }
.msg-options-menu.options-left { .msg-options-menu.options-left {

View File

@@ -108,8 +108,9 @@ export default function Message({ message: msg, prevMessage, currentUser, onRepl
setShowEmojiPicker(p => !p); setShowEmojiPicker(p => !p);
}; };
// Long press for mobile action menu // Long press for mobile action menu (DMs only)
const handleTouchStart = () => { const handleTouchStart = () => {
if (!isDirect) return;
longPressTimer.current = setTimeout(() => setShowOptionsMenu(true), 500); longPressTimer.current = setTimeout(() => setShowOptionsMenu(true), 500);
}; };
const handleTouchEnd = () => { const handleTouchEnd = () => {
@@ -165,13 +166,13 @@ export default function Message({ message: msg, prevMessage, currentUser, onRepl
{!isOwn && !prevSameUser && ( {!isOwn && !prevSameUser && (
<div <div
ref={avatarRef} ref={avatarRef}
style={{ position: 'relative', cursor: 'pointer', borderRadius: '50%', transition: 'box-shadow 0.15s', flexShrink: 0 }} style={{ position: 'relative', cursor: 'pointer', transition: 'box-shadow 0.15s', flexShrink: 0, borderRadius: '50%', display: 'inline-flex' }}
onClick={() => setShowProfile(p => !p)} onClick={() => setShowProfile(p => !p)}
onMouseEnter={e => e.currentTarget.style.boxShadow = '0 0 0 2px var(--primary)'} onMouseEnter={e => e.currentTarget.style.boxShadow = '0 0 0 2px var(--primary)'}
onMouseLeave={e => e.currentTarget.style.boxShadow = 'none'} onMouseLeave={e => e.currentTarget.style.boxShadow = 'none'}
> >
<Avatar user={msgUser} size="sm" className="msg-avatar" /> <Avatar user={msgUser} size="sm" className="msg-avatar" />
{onlineUserIds.has(msg.user_id) && ( {!!(onlineUserIds instanceof Set ? onlineUserIds.has(Number(msg.user_id)) : false) && (
<span style={{ <span style={{
position: 'absolute', bottom: 0, right: 0, position: 'absolute', bottom: 0, right: 0,
width: 9, height: 9, borderRadius: '50%', width: 9, height: 9, borderRadius: '50%',
@@ -211,10 +212,10 @@ export default function Message({ message: msg, prevMessage, currentUser, onRepl
<div className="msg-bubble-wrap"> <div className="msg-bubble-wrap">
<div className="msg-bubble-with-actions" <div className="msg-bubble-with-actions"
onMouseEnter={() => setShowActions(true)} onMouseEnter={() => setShowActions(true)}
onMouseLeave={() => { if (!showEmojiPicker) setShowActions(false); }} onMouseLeave={() => { if (!showEmojiPicker && !showOptionsMenu) setShowActions(false); }}
onTouchStart={isDirect ? handleTouchStart : undefined} onTouchStart={handleTouchStart}
onTouchEnd={isDirect ? handleTouchEnd : undefined} onTouchEnd={handleTouchEnd}
onTouchMove={isDirect ? handleTouchEnd : undefined} onTouchMove={handleTouchEnd}
> >
{/* Actions toolbar — floats above the bubble, aligned to correct side */} {/* Actions toolbar — floats above the bubble, aligned to correct side */}
{!isDeleted && (showActions || showEmojiPicker) && ( {!isDeleted && (showActions || showEmojiPicker) && (
@@ -238,14 +239,6 @@ export default function Message({ message: msg, prevMessage, currentUser, onRepl
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2"><polyline points="3 6 5 6 21 6"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2"/></svg> <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2"><polyline points="3 6 5 6 21 6"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2"/></svg>
</button> </button>
)} )}
{isDirect && (
<div style={{ position: 'relative' }}>
<button className="btn-icon action-btn" onClick={() => setShowOptionsMenu(p => !p)} title="More options">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2"><circle cx="12" cy="5" r="1"/><circle cx="12" cy="12" r="1"/><circle cx="12" cy="19" r="1"/></svg>
</button>
</div>
)}
{/* Emoji picker anchored to the toolbar */} {/* Emoji picker anchored to the toolbar */}
{showEmojiPicker && ( {showEmojiPicker && (
<div <div
@@ -282,27 +275,37 @@ export default function Message({ message: msg, prevMessage, currentUser, onRepl
<span className="msg-time">{formatTime(msg.created_at)}</span> <span className="msg-time">{formatTime(msg.created_at)}</span>
{/* Pin/unpin options menu — desktop triple-dot + mobile long-press */} {/* Triple-dot pin button — sits outside the hover toolbar so mouse-leave doesn't race */}
{isDirect && showOptionsMenu && ( {isDirect && (
<div <div className="msg-pin-wrap" ref={optionsMenuRef}>
ref={optionsMenuRef} <button
className={`msg-options-menu ${isOwn ? 'options-left' : 'options-right'}`} className={`btn-icon msg-pin-btn ${showOptionsMenu ? 'active' : ''}`}
onMouseDown={e => e.stopPropagation()} onClick={e => { e.stopPropagation(); setShowOptionsMenu(p => !p); }}
> title="Message options"
{isPinned ? ( >
<button onClick={() => { onUnpin(msg.id); setShowOptionsMenu(false); }}> <svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.2"><circle cx="12" cy="5" r="1.2" fill="currentColor"/><circle cx="12" cy="12" r="1.2" fill="currentColor"/><circle cx="12" cy="19" r="1.2" fill="currentColor"/></svg>
<svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor"><path d="M16 2v4l-3 3v7l-4-4-4 4V9L2 6V2h14zm2 0h2v2h-2V2z"/></svg> </button>
Unpin message {showOptionsMenu && (
</button> <div
) : ( className={`msg-options-menu ${isOwn ? 'options-left' : 'options-right'}`}
<button onMouseDown={e => e.stopPropagation()}
onClick={() => { if (pinCount < 5) { onPin(msg.id); setShowOptionsMenu(false); } }}
disabled={pinCount >= 5}
title={pinCount >= 5 ? 'Maximum 5 pinned messages reached' : ''}
> >
<svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor"><path d="M16 2v4l-3 3v7l-4-4-4 4V9L2 6V2h14zm2 0h2v2h-2V2z"/></svg> {isPinned ? (
{pinCount >= 5 ? 'Pin (5/5)' : `Pin (${pinCount + 1}/5)`} <button onClick={() => { onUnpin(msg.id); setShowOptionsMenu(false); }}>
</button> <svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor"><path d="M16 2v4l-3 3v7l-4-4-4 4V9L2 6V2h14zm2 0h2v2h-2V2z"/></svg>
Unpin message
</button>
) : (
<button
onClick={() => { if (pinCount < 5) { onPin(msg.id); setShowOptionsMenu(false); } }}
disabled={pinCount >= 5}
title={pinCount >= 5 ? 'Maximum 5 pinned messages reached' : ''}
>
<svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor"><path d="M16 2v4l-3 3v7l-4-4-4 4V9L2 6V2h14zm2 0h2v2h-2V2z"/></svg>
{pinCount >= 5 ? 'Pin (5/5)' : `Pin (${pinCount + 1}/5)`}
</button>
)}
</div>
)} )}
</div> </div>
)} )}

View File

@@ -102,7 +102,7 @@ export default function Sidebar({ groups, activeGroupId, onSelectGroup, notifica
const unreadCount = unreadGroups.get(group.id) || 0; const unreadCount = unreadGroups.get(group.id) || 0;
const hasUnread = unreadCount > 0; const hasUnread = unreadCount > 0;
const isActive = group.id === activeGroupId; const isActive = group.id === activeGroupId;
const isOnline = !!group.is_direct && !!group.peer_id && onlineUserIds.has(group.peer_id); const isOnline = !!group.is_direct && !!group.peer_id && (onlineUserIds instanceof Set ? onlineUserIds.has(Number(group.peer_id)) : false);
return ( return (
<div <div

View File

@@ -207,9 +207,9 @@ export default function Chat() {
}; };
// Online presence // Online presence
const handleUserOnline = ({ userId }) => setOnlineUserIds(prev => new Set([...prev, userId])); const handleUserOnline = ({ userId }) => setOnlineUserIds(prev => new Set([...prev, Number(userId)]));
const handleUserOffline = ({ userId }) => setOnlineUserIds(prev => { const n = new Set(prev); n.delete(userId); return n; }); const handleUserOffline = ({ userId }) => setOnlineUserIds(prev => { const n = new Set(prev); n.delete(Number(userId)); return n; });
const handleUsersOnline = ({ userIds }) => setOnlineUserIds(new Set(userIds)); const handleUsersOnline = ({ userIds }) => setOnlineUserIds(new Set((userIds || []).map(Number)));
socket.on('user:online', handleUserOnline); socket.on('user:online', handleUserOnline);
socket.on('user:offline', handleUserOffline); socket.on('user:offline', handleUserOffline);