-
+
+
+
+
+
+
+
+
+
+
+
+
+ {chat && (
+
+ {}} />
+
+ {}} />
+
+
+ )}
+
-
-
-
-
-
+
);
};
diff --git a/app/soapbox/features/ui/index.tsx b/app/soapbox/features/ui/index.tsx
index b136ebdb8..1328999fd 100644
--- a/app/soapbox/features/ui/index.tsx
+++ b/app/soapbox/features/ui/index.tsx
@@ -29,6 +29,7 @@ import ThumbNavigation from 'soapbox/components/thumb_navigation';
import { Layout } from 'soapbox/components/ui';
import { useAppSelector, useOwnAccount, useSoapboxConfig, useFeatures } from 'soapbox/hooks';
import AdminPage from 'soapbox/pages/admin_page';
+import ChatsPage from 'soapbox/pages/chats-page';
import DefaultPage from 'soapbox/pages/default_page';
// import GroupsPage from 'soapbox/pages/groups_page';
// import GroupPage from 'soapbox/pages/group_page';
@@ -265,8 +266,8 @@ const SwitchingColumnsArea: React.FC = ({ children }) => {
{features.suggestions &&
}
{features.profileDirectory &&
}
- {features.chats &&
}
- {features.chats &&
}
+ {features.chats &&
}
+ {features.chats &&
}
diff --git a/app/soapbox/locales/en.json b/app/soapbox/locales/en.json
index 88d96cf7d..58d37d736 100644
--- a/app/soapbox/locales/en.json
+++ b/app/soapbox/locales/en.json
@@ -194,7 +194,7 @@
"column.birthdays": "Birthdays",
"column.blocks": "Blocked users",
"column.bookmarks": "Bookmarks",
- "column.chats": "Chats",
+ "column.chats": "Messages",
"column.community": "Local timeline",
"column.crypto_donate": "Donate Cryptocurrency",
"column.developers": "Developers",
diff --git a/app/soapbox/pages/chats-page.tsx b/app/soapbox/pages/chats-page.tsx
new file mode 100644
index 000000000..b822f3d85
--- /dev/null
+++ b/app/soapbox/pages/chats-page.tsx
@@ -0,0 +1,12 @@
+import React from 'react';
+
+/** Custom layout for chats on desktop. */
+const ChatsPage: React.FC = ({ children }) => {
+ return (
+
+ {children}
+
+ );
+};
+
+export default ChatsPage;
diff --git a/app/soapbox/queries/chats.ts b/app/soapbox/queries/chats.ts
index 82dd400d5..738e0ca21 100644
--- a/app/soapbox/queries/chats.ts
+++ b/app/soapbox/queries/chats.ts
@@ -3,8 +3,10 @@ import { useEffect, useState } from 'react';
import { fetchRelationships } from 'soapbox/actions/accounts';
import snackbar from 'soapbox/actions/snackbar';
+import compareId from 'soapbox/compare_id';
import { useChatContext } from 'soapbox/contexts/chat-context';
import { useApi, useAppDispatch } from 'soapbox/hooks';
+import { normalizeChatMessage } from 'soapbox/normalizers';
import { queryClient } from './client';
@@ -40,11 +42,7 @@ export interface IChatMessage {
pending?: boolean
}
-const reverseOrder = (a: IChat, b: IChat): number => {
- if (Number(a.id) < Number(b.id)) return -1;
- if (Number(a.id) > Number(b.id)) return 1;
- return 0;
-};
+const reverseOrder = (a: IChat, b: IChat): number => compareId(a.id, b.id);
const useChatMessages = (chatId: string) => {
const api = useApi();
@@ -57,7 +55,7 @@ const useChatMessages = (chatId: string) => {
});
const hasMore = !!headers.link;
- const result = data.sort(reverseOrder);
+ const result = data.sort(reverseOrder).map(normalizeChatMessage);
const nextMaxId = result[0]?.id;
return {