- Fix Chat Icon logger error - Fix Socket Robustness - added additional wss status for error - Installed ant-design icons Signed-off-by: Dave Richer <dave@imexsystems.ca>
34 lines
991 B
JavaScript
34 lines
991 B
JavaScript
import { connect } from "react-redux";
|
|
import { GlobalOutlined, WarningOutlined } from "@ant-design/icons";
|
|
import { createStructuredSelector } from "reselect";
|
|
import React from "react";
|
|
import { selectWssStatus } from "../../redux/application/application.selectors";
|
|
|
|
const mapStateToProps = createStructuredSelector({
|
|
wssStatus: selectWssStatus
|
|
});
|
|
|
|
const mapDispatchToProps = (dispatch) => ({});
|
|
|
|
export function WssStatusDisplay({ wssStatus }) {
|
|
console.log("🚀 ~ WssStatusDisplay ~ wssStatus:", wssStatus);
|
|
|
|
let icon;
|
|
let color;
|
|
|
|
if (wssStatus === "connected") {
|
|
icon = <GlobalOutlined />;
|
|
color = "green";
|
|
} else if (wssStatus === "error") {
|
|
icon = <WarningOutlined />;
|
|
color = "red";
|
|
} else {
|
|
icon = <GlobalOutlined />;
|
|
color = "gray"; // Default for other statuses like "disconnected"
|
|
}
|
|
|
|
return <span style={{ color, marginRight: ".5rem" }}>{icon}</span>;
|
|
}
|
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(WssStatusDisplay);
|