Nachrichten: Header/Input fixiert, Auto-Scroll instant beim Laden, mobiler Leerraum fix
This commit is contained in:
@@ -173,8 +173,12 @@ export default function Nachrichten({ toast, mobile }) {
|
||||
}, [messages, sharedKey]);
|
||||
|
||||
// ── Scroll to bottom ─────────────────────────────────────────────────────────
|
||||
const prevLengthRef = useRef(0);
|
||||
useEffect(() => {
|
||||
bottomRef.current?.scrollIntoView({ behavior: 'smooth' });
|
||||
const isFirstLoad = prevLengthRef.current === 0 && messages.length > 0;
|
||||
prevLengthRef.current = messages.length;
|
||||
if (!bottomRef.current) return;
|
||||
bottomRef.current.scrollIntoView({ behavior: isFirstLoad ? 'instant' : 'smooth' });
|
||||
}, [messages.length]);
|
||||
|
||||
// ── Handlers ─────────────────────────────────────────────────────────────────
|
||||
@@ -193,6 +197,7 @@ export default function Nachrichten({ toast, mobile }) {
|
||||
setActiveUser(u);
|
||||
setMessages([]);
|
||||
setDecrypted({});
|
||||
prevLengthRef.current = 0;
|
||||
};
|
||||
|
||||
const send = async (overrideText) => {
|
||||
@@ -239,8 +244,8 @@ export default function Nachrichten({ toast, mobile }) {
|
||||
);
|
||||
|
||||
return (
|
||||
<div style={{ display:'flex', flex:1, height: mobile ? '100%' : '100vh',
|
||||
overflow:'hidden', background:'#111114' }}>
|
||||
<div style={{ display:'flex', height: mobile ? '100%' : '100vh',
|
||||
overflow:'hidden', background:'#111114', flex: mobile ? 1 : undefined }}>
|
||||
|
||||
{/* ── Konversationsliste ─────────────────────────────────────────── */}
|
||||
{showList && (
|
||||
|
||||
Reference in New Issue
Block a user