From e8d163608f5eff8cd356d24ebf23ab5eeb829a35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Sat, 2 Aug 2025 09:19:54 +0200 Subject: Update current conversation name when changed --- src/Main.hs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/Main.hs') diff --git a/src/Main.hs b/src/Main.hs index 5788a37..df8caf2 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -253,6 +253,20 @@ watchConversations gs@GlobalState {..} = do conversations <- zip [1 ..] . fst <$> runLocalHeadT lookupConversations globalStorage (headStoredObject ls) + modifyMVar_ currentConversationVar $ \case + x@(SelectedConversation selected) -> do + let updateCurrent [] = return x + updateCurrent (( _, c ) : cs) + | c `isSameConversation` selected = do + when (conversationName c /= conversationName selected) $ do + header <- JS.getElementById "msg_header" + js_set_textContent header $ toJSString $ T.unpack $ conversationName c + return $ SelectedConversation c + | otherwise = do + updateCurrent cs + updateCurrent conversations + x -> return x + convList <- JS.getElementById "conversation_list" ul <- js_document_createElement (toJSString "ul") forM_ conversations $ \( _, conv ) -> do -- cgit v1.2.3