From 82a9609f0cc856e009fe46394dd1ba67f13940e4 Mon Sep 17 00:00:00 2001 From: Dicken Date: Thu, 28 May 2026 14:56:11 +0200 Subject: [PATCH] =?UTF-8?q?Nachrichten:=20Emoji-Button=20volle=20H=C3=B6he?= =?UTF-8?q?,=20mIRC-Design-Toggle?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/tools/nachrichten.jsx | 205 ++++++++++++++++++----------- 1 file changed, 125 insertions(+), 80 deletions(-) diff --git a/frontend/src/tools/nachrichten.jsx b/frontend/src/tools/nachrichten.jsx index 096d005..d8fbbd0 100644 --- a/frontend/src/tools/nachrichten.jsx +++ b/frontend/src/tools/nachrichten.jsx @@ -82,6 +82,8 @@ export default function Nachrichten({ toast, mobile }) { const [text, setText] = useState(''); const [sending, setSending] = useState(false); const [showPicker, setShowPicker] = useState(false); + const [mirc, setMirc] = useState(() => localStorage.getItem('dd_chat_design') === 'mirc'); + const toggleDesign = () => setMirc(v => { const n = !v; localStorage.setItem('dd_chat_design', n ? 'mirc' : 'modern'); return n; }); const bottomRef = useRef(null); const pollRef = useRef(null); const pickerRef = useRef(null); @@ -244,10 +246,19 @@ export default function Nachrichten({ toast, mobile }) {
NACHRICHTEN
- +
+ + +
{users.length === 0 ? ( @@ -349,7 +360,10 @@ export default function Nachrichten({ toast, mobile }) {
{/* Nachrichten */} -
+
{!activeUser.public_key && ( ⚠ Dieser Benutzer hat die Nachrichten noch nicht geöffnet und besitzt noch kein Schlüsselpaar. @@ -357,90 +371,120 @@ export default function Nachrichten({ toast, mobile }) { )} {sharedKey === 'error' && ( - ⚠ Schlüssel inkompatibel – der Empfänger verwendet ein anderes Schlüsselformat (z. B. altes P-256). + ⚠ Schlüssel inkompatibel – der Empfänger verwendet ein anderes Schlüsselformat. Er muss in Einstellungen → Sicherheit einen neuen Schlüssel generieren. )} {messages.length === 0 && activeUser.public_key && sharedKey !== 'error' && (
- Noch keine Nachrichten + color: mirc ? '#808080' : 'rgba(255,255,255,0.18)', + fontFamily: mirc ? "'Courier New', monospace" : 'monospace', fontSize:11 }}> + {mirc ? '*** Noch keine Nachrichten ***' : 'Noch keine Nachrichten'}
)} - {/* Hinweis wenn Nachrichten nicht entschlüsselt werden können */} {Object.values(decrypted).some(v => v === null) && ( - 🔑 Einige Nachrichten können nicht entschlüsselt werden – dein privater Schlüssel passt nicht mehr.{' '} - Importiere deinen alten Schlüssel unter{' '} - Einstellungen → Sicherheit → Schlüssel importieren, - oder erzeuge einen neuen Schlüssel (löscht alle bisherigen Nachrichten). + 🔑 Einige Nachrichten können nicht entschlüsselt werden. + Importiere deinen alten Schlüssel unter Einstellungen → Sicherheit. )} - {messages.map(m => { - const isMine = !!m.is_mine; - const txt = decrypted[m.id]; - return ( -
- {!isMine && ( -
- -
- )} -
-
- {txt === undefined ? ( - - ) : txt === null ? ( - - 🔒 Nicht entschlüsselbar - - ) : ( - {txt} - )} -
-
- - {formatMsgTime(m.created_at)} + + {mirc ? ( + /* ── mIRC Design ─────────────────────────────────────── */ +
+ {messages.map(m => { + const isMine = !!m.is_mine; + const txt = decrypted[m.id]; + const time = m.created_at ? (() => { const d = new Date(m.created_at.replace(' ','T')); return isNaN(d)?'':d.toLocaleTimeString('de-DE',{hour:'2-digit',minute:'2-digit'}); })() : ''; + const nick = isMine ? 'du' : activeUser.username; + const nickColor = isMine ? '#00ff00' : '#00ffff'; + return ( +
e.currentTarget.style.background='rgba(255,255,255,0.04)'} + onMouseLeave={e=>e.currentTarget.style.background=isMine?'rgba(0,255,0,0.03)':'transparent'}> + [{time}] + < + {nick} + > + + {txt===undefined ? '…' : txt===null ? '[verschlüsselt]' : txt} - {isMine && ( - - {m.read_by_recipient ? '✓✓' : '✓'} - - )} + {isMine && m.read_by_recipient && ✓✓} + cursor:'pointer', color:'#400000', fontSize:9, padding:'0 0 0 6px', flexShrink:0, opacity:0.5 }}>✕
-
-
- ); - })} + ); + })} +
+ ) : ( + /* ── Modernes Design ─────────────────────────────────── */ + <> + {messages.map(m => { + const isMine = !!m.is_mine; + const txt = decrypted[m.id]; + return ( +
+ {!isMine && ( +
👤
+ )} +
+
+ {txt === undefined ? ( + + ) : txt === null ? ( + 🔒 Nicht entschlüsselbar + ) : ( + {txt} + )} +
+
+ + {formatMsgTime(m.created_at)} + + {isMine && ( + + {m.read_by_recipient ? '✓✓' : '✓'} + + )} + +
+
+
+ ); + })} + + )}
{/* Eingabe */} -
+
{!activeUser.public_key || sharedKey === 'error' ? (
Senden nicht möglich
) : ( -
+
{showPicker && ( )}
+ {mirc && ( + [du] + )}