diff --git a/packages/api/src/EmbeddedChatApi.ts b/packages/api/src/EmbeddedChatApi.ts
index 44cff0eaf4..633ede160e 100644
--- a/packages/api/src/EmbeddedChatApi.ts
+++ b/packages/api/src/EmbeddedChatApi.ts
@@ -485,6 +485,41 @@ export default class EmbeddedChatApi {
}
}
+ async getRoomInfo() {
+ try {
+ const { userId, authToken } = (await this.auth.getCurrentUser()) || {};
+ const response = await fetch(
+ `${this.host}/api/v1/method.call/rooms%3Aget`,
+ {
+ body: JSON.stringify({
+ message: JSON.stringify({
+ msg: "method",
+ id: null,
+ method: "rooms/get",
+ params: [],
+ }),
+ }),
+ headers: {
+ "Content-Type": "application/json",
+ "X-Auth-Token": authToken,
+ "X-User-Id": userId,
+ },
+ method: "POST",
+ }
+ );
+
+ const result = await response.json();
+
+ if (result.success && result.message) {
+ const parsedMessage = JSON.parse(result.message);
+ return parsedMessage;
+ }
+ return null;
+ } catch (err) {
+ console.error(err);
+ }
+ }
+
async permissionInfo() {
try {
const { userId, authToken } = (await this.auth.getCurrentUser()) || {};
diff --git a/packages/react/src/store/channelStore.js b/packages/react/src/store/channelStore.js
index f3acbb914f..21d036c52a 100644
--- a/packages/react/src/store/channelStore.js
+++ b/packages/react/src/store/channelStore.js
@@ -4,11 +4,14 @@ const useChannelStore = create((set) => ({
showChannelinfo: false,
isChannelPrivate: false,
isChannelReadOnly: false,
+ isChannelArchived: false,
isRoomTeam: false,
setShowChannelinfo: (showChannelinfo) => set(() => ({ showChannelinfo })),
channelInfo: {},
setChannelInfo: (channelInfo) => set(() => ({ channelInfo })),
setIsChannelPrivate: (isChannelPrivate) => set(() => ({ isChannelPrivate })),
+ setIsChannelArchived: (isChannelArchived) =>
+ set(() => ({ isChannelArchived })),
setIsRoomTeam: (isRoomTeam) => set(() => ({ isRoomTeam })),
setIsChannelReadOnly: (isChannelReadOnly) =>
set(() => ({ isChannelReadOnly })),
diff --git a/packages/react/src/views/ChatHeader/ChatHeader.js b/packages/react/src/views/ChatHeader/ChatHeader.js
index 0971ce7c77..cbeea22355 100644
--- a/packages/react/src/views/ChatHeader/ChatHeader.js
+++ b/packages/react/src/views/ChatHeader/ChatHeader.js
@@ -73,6 +73,9 @@ const ChatHeader = ({
const setIsChannelPrivate = useChannelStore(
(state) => state.setIsChannelPrivate
);
+ const setIsChannelArchived = useChannelStore(
+ (state) => state.setIsChannelArchived
+ );
const isRoomTeam = useChannelStore((state) => state.isRoomTeam);
const setIsRoomTeam = useChannelStore((state) => state.setIsRoomTeam);
const setIsChannelReadOnly = useChannelStore(
@@ -133,7 +136,6 @@ const ChatHeader = ({
};
const setCanSendMsg = useUserStore((state) => state.setCanSendMsg);
const authenticatedUserId = useUserStore((state) => state.userId);
-
const handleLogout = useCallback(async () => {
try {
await RCInstance.logout();
@@ -193,6 +195,14 @@ const ChatHeader = ({
message: "Channel doesn't exist. Logging out.",
});
await RCInstance.logout();
+ } else if (
+ 'errorType' in res &&
+ res.errorType === 'error-room-archived'
+ ) {
+ setIsChannelArchived(true);
+ const roomInfo = await RCInstance.getRoomInfo();
+ const roomData = roomInfo.result[roomInfo.result.length - 1];
+ setChannelInfo(roomData);
} else if ('errorType' in res && res.errorType === 'Not Allowed') {
dispatchToastMessage({
type: 'error',
@@ -372,9 +382,9 @@ const ChatHeader = ({
-
+
setExclusiveState(setShowChannelinfo)}
diff --git a/packages/react/src/views/ChatHeader/ChatHeader.styles.js b/packages/react/src/views/ChatHeader/ChatHeader.styles.js
index 54770d8a54..46a9ecd32c 100644
--- a/packages/react/src/views/ChatHeader/ChatHeader.styles.js
+++ b/packages/react/src/views/ChatHeader/ChatHeader.styles.js
@@ -32,8 +32,17 @@ const getChatHeaderStyles = ({ theme, mode }) => {
box-shadow: ${theme.shadows[1]};
`,
+ channelInfoContainer: css`
+ display: flex;
+ flex-direction: column;
+ min-width: 0;
+ flex: 1;
+ `,
+
channelDescription: css`
${rowCentreAlign}
+ flex: 1;
+ min-width: 0;
gap: 0.5rem;
`,
@@ -50,7 +59,13 @@ const getChatHeaderStyles = ({ theme, mode }) => {
`,
channelTopic: css`
opacity: 0.8rem;
+ display: -webkit-box;
+ -webkit-line-clamp: 1;
+ -webkit-box-orient: vertical;
+ word-break: break-word;
+ overflow: hidden;
font-size: 1rem;
+ text-overflow: ellipsis;
`,
};
return styles;
diff --git a/packages/react/src/views/ChatInput/ChatInput.js b/packages/react/src/views/ChatInput/ChatInput.js
index 34ebffb86f..fca0245841 100644
--- a/packages/react/src/views/ChatInput/ChatInput.js
+++ b/packages/react/src/views/ChatInput/ChatInput.js
@@ -74,13 +74,17 @@ const ChatInput = ({ scrollToBottom }) => {
name: state.name,
}));
- const { isChannelPrivate, isChannelReadOnly, channelInfo } = useChannelStore(
- (state) => ({
- isChannelPrivate: state.isChannelPrivate,
- isChannelReadOnly: state.isChannelReadOnly,
- channelInfo: state.channelInfo,
- })
- );
+ const {
+ isChannelPrivate,
+ isChannelReadOnly,
+ channelInfo,
+ isChannelArchived,
+ } = useChannelStore((state) => ({
+ isChannelPrivate: state.isChannelPrivate,
+ isChannelReadOnly: state.isChannelReadOnly,
+ channelInfo: state.channelInfo,
+ isChannelArchived: state.isChannelArchived,
+ }));
const { members, setMembersHandler } = useMemberStore((state) => ({
members: state.members,
@@ -521,15 +525,27 @@ const ChatInput = ({ scrollToBottom }) => {
{
sendTypingStop();
@@ -547,14 +563,16 @@ const ChatInput = ({ scrollToBottom }) => {
`}
>
{isUserAuthenticated ? (
- sendMessage()}
- type="primary"
- disabled={disableButton || isRecordingMessage}
- icon="send"
- />
+ !isChannelArchived ? (
+ sendMessage()}
+ type="primary"
+ disabled={disableButton || isRecordingMessage}
+ icon="send"
+ />
+ ) : null
) : (
- {isUserAuthenticated && (
+ {isUserAuthenticated && !isChannelArchived && (
{
- const { RCInstance } = useContext(RCContext);
- const styles = getRoomInformationStyles();
+ const { RCInstance, ECOptions } = useContext(RCContext);
const channelInfo = useChannelStore((state) => state.channelInfo);
const isChannelPrivate = useChannelStore((state) => state.isChannelPrivate);
const isRoomTeam = useChannelStore((state) => state.isRoomTeam);
@@ -26,8 +26,10 @@ const Roominfo = () => {
const host = RCInstance.getHost();
return `${host}/avatar/${channelname}`;
};
-
+ const { channelName } = ECOptions ?? {};
const ViewComponent = viewType === 'Popup' ? Popup : Sidebar;
+ const { theme, mode } = useTheme();
+ const styles = getRoomInformationStyles(theme, mode);
return (
{
justify-content: center;
`}
>
-
+
+
+
+ Room Archived
+
{
margin-right: 0.5rem;
`}
/>
- {channelInfo.name}
+ {channelInfo.name || channelName}
{channelInfo.description && (
<>
@@ -77,18 +94,18 @@ const Roominfo = () => {
{channelInfo.description}
>
)}
- {channelInfo.topic && (
- <>
- Topic
- {channelInfo.topic}
- >
- )}
{channelInfo.announcement && (
<>
Announcement
{channelInfo.announcement}
>
)}
+ {channelInfo.topic && (
+ <>
+ Topic
+ {channelInfo.topic}
+ >
+ )}
diff --git a/packages/react/src/views/RoomInformation/RoomInformation.styles.js b/packages/react/src/views/RoomInformation/RoomInformation.styles.js
index 5925297dcf..b77233120a 100644
--- a/packages/react/src/views/RoomInformation/RoomInformation.styles.js
+++ b/packages/react/src/views/RoomInformation/RoomInformation.styles.js
@@ -1,6 +1,6 @@
import { css } from '@emotion/react';
-const getRoomInformationStyles = () => {
+const getRoomInformationStyles = (theme, mode) => {
const styles = {
infoContainer: css`
margin: 16px;
@@ -19,6 +19,22 @@ const getRoomInformationStyles = () => {
opacity: 0.7;
font-size: 0.9rem;
`,
+
+ archivedRoomInfo: css`
+ display: flex;
+ border: 1px solid
+ ${mode === 'light'
+ ? theme.colors.warning
+ : theme.colors.warningForeground};
+ border-radius: ${theme.radius};
+ padding: 0.75rem 1rem;
+ width: 100%;
+ gap: 0.75rem;
+ margin-bottom: 1rem;
+ `,
+ archivedText: css`
+ font-size: 1rem;
+ `,
};
return styles;