feature/IO-3499-React-19 Checkpoint

This commit is contained in:
Dave
2026-01-22 11:53:29 -05:00
parent 7fe9098f69
commit 48336b88e0
4 changed files with 20 additions and 7 deletions

View File

@@ -15,17 +15,19 @@ import LoadingSpinner from "../loading-spinner/loading-spinner.component";
import "./chat-popup.styles.scss"; import "./chat-popup.styles.scss";
import { useSocket } from "../../contexts/SocketIO/useSocket.js"; import { useSocket } from "../../contexts/SocketIO/useSocket.js";
import { selectDarkMode } from "../../redux/application/application.selectors.js";
const mapStateToProps = createStructuredSelector({ const mapStateToProps = createStructuredSelector({
selectedConversation: selectSelectedConversation, selectedConversation: selectSelectedConversation,
chatVisible: selectChatVisible chatVisible: selectChatVisible,
isDarkMode: selectDarkMode
}); });
const mapDispatchToProps = (dispatch) => ({ const mapDispatchToProps = (dispatch) => ({
toggleChatVisible: () => dispatch(toggleChatVisible()) toggleChatVisible: () => dispatch(toggleChatVisible())
}); });
export function ChatPopupComponent({ chatVisible, selectedConversation, toggleChatVisible }) { export function ChatPopupComponent({ chatVisible, selectedConversation, toggleChatVisible, isDarkMode }) {
const { t } = useTranslation(); const { t } = useTranslation();
const { socket } = useSocket(); const { socket } = useSocket();
const client = useApolloClient(); const client = useApolloClient();
@@ -113,7 +115,7 @@ export function ChatPopupComponent({ chatVisible, selectedConversation, toggleCh
const handleManualRefresh = async () => { const handleManualRefresh = async () => {
try { try {
if (called && typeof refetch === "function") { if (called && typeof refetch === "function") {
await refetch({ variables: { offset: 0 } }); await refetch({ offset: 0 });
} else { } else {
await getConversations({ variables: { offset: 0 } }); await getConversations({ variables: { offset: 0 } });
} }
@@ -154,7 +156,7 @@ export function ChatPopupComponent({ chatVisible, selectedConversation, toggleCh
<Badge count={unreadCount}> <Badge count={unreadCount}>
<Card size="small"> <Card size="small">
{chatVisible ? ( {chatVisible ? (
<div className="chat-popup"> <div className={`chat-popup ${isDarkMode ? "chat-popup--dark" : "chat-popup--light"}`}>
<Space align="center"> <Space align="center">
<Typography.Title level={4}>{t("messaging.labels.messaging")}</Typography.Title> <Typography.Title level={4}>{t("messaging.labels.messaging")}</Typography.Title>
<ChatNewConversation /> <ChatNewConversation />

View File

@@ -26,3 +26,11 @@
flex-direction: column; flex-direction: column;
} }
} }
.chat-popup--dark {
color-scheme: dark;
}
.chat-popup--light {
color-scheme: light;
}

View File

@@ -45,6 +45,9 @@ export const CONVERSATION_LIST_QUERY = gql`
} }
} }
job_conversations { job_conversations {
jobid
conversationid
id
job { job {
id id
ro_number ro_number
@@ -87,6 +90,7 @@ export const GET_CONVERSATION_DETAILS = gql`
job_conversations { job_conversations {
jobid jobid
conversationid conversationid
id
job { job {
id id
ownr_fn ownr_fn
@@ -122,6 +126,7 @@ export const CONVERSATION_ID_BY_PHONE = gql`
unreadcnt unreadcnt
created_at created_at
job_conversations { job_conversations {
id
jobid jobid
conversationid conversationid
job { job {
@@ -151,6 +156,7 @@ export const CREATE_CONVERSATION = gql`
label label
unreadcnt unreadcnt
job_conversations { job_conversations {
id
jobid jobid
conversationid conversationid
job { job {

View File

@@ -175,9 +175,6 @@ const cache = new InMemoryCache({
masterdata: { masterdata: {
keyFields: ["key"] keyFields: ["key"]
}, },
job_conversations: {
keyFields: ["conversationid", "jobid"]
},
Query: { Query: {
fields: { fields: {
job_watchers: { job_watchers: {