Nachrichten: Header/Input fixiert, Auto-Scroll instant beim Laden, mobiler Leerraum fix
This commit is contained in:
@@ -1664,8 +1664,10 @@ export default function App() {
|
|||||||
const mainStyle = {
|
const mainStyle = {
|
||||||
flex:1,
|
flex:1,
|
||||||
overflowY: (mobile && isNachrichten) ? 'hidden' : 'auto',
|
overflowY: (mobile && isNachrichten) ? 'hidden' : 'auto',
|
||||||
display: (mobile && isNachrichten) ? 'flex' : undefined,
|
...(mobile && isNachrichten ? {
|
||||||
flexDirection: (mobile && isNachrichten) ? 'column' : undefined,
|
height: 'calc(100dvh - 56px - env(safe-area-inset-bottom, 0px))',
|
||||||
|
display:'flex', flexDirection:'column',
|
||||||
|
} : {}),
|
||||||
...(mobile && !isNachrichten ? { paddingBottom:'calc(56px + env(safe-area-inset-bottom, 0px))' } : {}),
|
...(mobile && !isNachrichten ? { paddingBottom:'calc(56px + env(safe-area-inset-bottom, 0px))' } : {}),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -173,8 +173,12 @@ export default function Nachrichten({ toast, mobile }) {
|
|||||||
}, [messages, sharedKey]);
|
}, [messages, sharedKey]);
|
||||||
|
|
||||||
// ── Scroll to bottom ─────────────────────────────────────────────────────────
|
// ── Scroll to bottom ─────────────────────────────────────────────────────────
|
||||||
|
const prevLengthRef = useRef(0);
|
||||||
useEffect(() => {
|
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]);
|
}, [messages.length]);
|
||||||
|
|
||||||
// ── Handlers ─────────────────────────────────────────────────────────────────
|
// ── Handlers ─────────────────────────────────────────────────────────────────
|
||||||
@@ -193,6 +197,7 @@ export default function Nachrichten({ toast, mobile }) {
|
|||||||
setActiveUser(u);
|
setActiveUser(u);
|
||||||
setMessages([]);
|
setMessages([]);
|
||||||
setDecrypted({});
|
setDecrypted({});
|
||||||
|
prevLengthRef.current = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
const send = async (overrideText) => {
|
const send = async (overrideText) => {
|
||||||
@@ -239,8 +244,8 @@ export default function Nachrichten({ toast, mobile }) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div style={{ display:'flex', flex:1, height: mobile ? '100%' : '100vh',
|
<div style={{ display:'flex', height: mobile ? '100%' : '100vh',
|
||||||
overflow:'hidden', background:'#111114' }}>
|
overflow:'hidden', background:'#111114', flex: mobile ? 1 : undefined }}>
|
||||||
|
|
||||||
{/* ── Konversationsliste ─────────────────────────────────────────── */}
|
{/* ── Konversationsliste ─────────────────────────────────────────── */}
|
||||||
{showList && (
|
{showList && (
|
||||||
|
|||||||
Reference in New Issue
Block a user