update FDISK sync
This commit is contained in:
@@ -17,6 +17,16 @@ const ChatMessageView: React.FC = () => {
|
||||
const queryClient = useQueryClient();
|
||||
const messagesEndRef = useRef<HTMLDivElement>(null);
|
||||
const [input, setInput] = useState('');
|
||||
const prevActiveRef = useRef(false);
|
||||
|
||||
// Invalidate messages immediately when this room + panel becomes active
|
||||
useEffect(() => {
|
||||
const active = !!selectedRoomToken && chatPanelOpen;
|
||||
if (active && !prevActiveRef.current) {
|
||||
queryClient.invalidateQueries({ queryKey: ['nextcloud', 'messages', selectedRoomToken] });
|
||||
}
|
||||
prevActiveRef.current = active;
|
||||
}, [selectedRoomToken, chatPanelOpen, queryClient]);
|
||||
|
||||
const room = rooms.find((r) => r.token === selectedRoomToken);
|
||||
|
||||
|
||||
@@ -26,6 +26,27 @@ import type { Notification, NotificationSchwere } from '../../types/notification
|
||||
|
||||
const POLL_INTERVAL_MS = 15_000; // 15 seconds
|
||||
|
||||
function playNotificationSound() {
|
||||
try {
|
||||
const ctx = new AudioContext();
|
||||
const oscillator = ctx.createOscillator();
|
||||
const gain = ctx.createGain();
|
||||
oscillator.connect(gain);
|
||||
gain.connect(ctx.destination);
|
||||
oscillator.type = 'sine';
|
||||
oscillator.frequency.value = 600;
|
||||
const now = ctx.currentTime;
|
||||
gain.gain.setValueAtTime(0, now);
|
||||
gain.gain.linearRampToValueAtTime(0.3, now + 0.02);
|
||||
gain.gain.linearRampToValueAtTime(0, now + 0.15);
|
||||
oscillator.start(now);
|
||||
oscillator.stop(now + 0.15);
|
||||
oscillator.onended = () => ctx.close();
|
||||
} catch {
|
||||
// Audio blocked before first user interaction — fail silently
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Only allow window.open for URLs whose origin matches the current app origin.
|
||||
* External-looking URLs (different host or protocol-relative) are rejected to
|
||||
@@ -83,6 +104,9 @@ const NotificationBell: React.FC = () => {
|
||||
|
||||
// Find notifications we haven't seen before
|
||||
const newOnes = unread.filter((n) => !knownIdsRef.current!.has(n.id));
|
||||
if (newOnes.length > 0) {
|
||||
playNotificationSound();
|
||||
}
|
||||
newOnes.forEach((n) => {
|
||||
knownIdsRef.current!.add(n.id);
|
||||
const severity = n.schwere === 'fehler' ? 'error' : n.schwere === 'warnung' ? 'warning' : 'info';
|
||||
|
||||
Reference in New Issue
Block a user