From 328ca9abdb9418cc48190c2015348db1466c5215 Mon Sep 17 00:00:00 2001 From: mkbeefcake Date: Thu, 31 Aug 2023 00:00:37 +0000 Subject: [PATCH] Fix [4485, 4484]: lint issue --- .../ThreadCard/ThreadCard.stories.tsx | 50 +++++++++--------- .../components/threads/LatestActivity.tsx | 1 + .../components/threads/ThreadList.stories.tsx | 50 +++++++++--------- .../forum/modals/DeleteThreadModal.test.tsx | 50 +++++++++--------- .../ui/test/forum/pages/ForumThread.test.tsx | 52 ++++++++++--------- 5 files changed, 106 insertions(+), 97 deletions(-) diff --git a/packages/ui/src/forum/components/ThreadCard/ThreadCard.stories.tsx b/packages/ui/src/forum/components/ThreadCard/ThreadCard.stories.tsx index 45d49a07a2..68cae07dc5 100644 --- a/packages/ui/src/forum/components/ThreadCard/ThreadCard.stories.tsx +++ b/packages/ui/src/forum/components/ThreadCard/ThreadCard.stories.tsx @@ -23,30 +23,32 @@ const forumThread: ForumThreadWithDetails = { tags: [], visiblePostsCount: 5, status: { __typename: 'ThreadStatusActive' }, - posts: [{ - id: "1", - createdAt: "2023-06-28T19:14:00.000Z", - text: "Test text", - status: "PostStatusActive", - threadId: "459", - categoryId: "2", - author: { - id: "4129", - handle: "Codefikeyz", - rootAccount: "j4TZJCACAWao9bnh5k86qeRW2QhNVNkf9eEw1Vz4V8ZeqD4u4", - controllerAccount: "j4TZJCACAWao9bnh5k86qeRW2QhNVNkf9eEw1Vz4V8ZeqD4u4", - isCouncilMember: false, - isFoundingMember: true, - inviteCount: 1, - roles: [], - boundAccounts: [ - "j4TZJCACAWao9bnh5k86qeRW2QhNVNkf9eEw1Vz4V8ZeqD4u4", - "j4WJoUb8xxQucAUFtmF18r41gzb1AG22nzypW1PT4LMLJqzU5" - ], - isVerified: true, - createdAt:"2023-06-28T19:14:00.000Z", - } - }] + posts: [ + { + id: '1', + createdAt: '2023-06-28T19:14:00.000Z', + text: 'Test text', + status: 'PostStatusActive', + threadId: '459', + categoryId: '2', + author: { + id: '4129', + handle: 'Codefikeyz', + rootAccount: 'j4TZJCACAWao9bnh5k86qeRW2QhNVNkf9eEw1Vz4V8ZeqD4u4', + controllerAccount: 'j4TZJCACAWao9bnh5k86qeRW2QhNVNkf9eEw1Vz4V8ZeqD4u4', + isCouncilMember: false, + isFoundingMember: true, + inviteCount: 1, + roles: [], + boundAccounts: [ + 'j4TZJCACAWao9bnh5k86qeRW2QhNVNkf9eEw1Vz4V8ZeqD4u4', + 'j4WJoUb8xxQucAUFtmF18r41gzb1AG22nzypW1PT4LMLJqzU5', + ], + isVerified: true, + createdAt: '2023-06-28T19:14:00.000Z', + }, + }, + ], } const Template: Story = (args) => diff --git a/packages/ui/src/forum/components/threads/LatestActivity.tsx b/packages/ui/src/forum/components/threads/LatestActivity.tsx index ad09e8e93c..e6575071fd 100644 --- a/packages/ui/src/forum/components/threads/LatestActivity.tsx +++ b/packages/ui/src/forum/components/threads/LatestActivity.tsx @@ -13,6 +13,7 @@ export interface LatestActivitydProps { posts: ForumPost[] } export const LatestActivity = memo(({ /*threadId,*/ posts }: LatestActivitydProps) => { + posts.sort((a: ForumPost, b: ForumPost) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()) const post = posts[0] // const { post } = useThreadLatestPost(threadId) if (!post) return diff --git a/packages/ui/src/forum/components/threads/ThreadList.stories.tsx b/packages/ui/src/forum/components/threads/ThreadList.stories.tsx index ca331e0c44..b02f3258ad 100644 --- a/packages/ui/src/forum/components/threads/ThreadList.stories.tsx +++ b/packages/ui/src/forum/components/threads/ThreadList.stories.tsx @@ -32,30 +32,32 @@ const forumThread: ForumThreadWithDetails = { tags: [], visiblePostsCount: 5, status: { __typename: 'ThreadStatusActive' }, - posts: [{ - id: "1", - createdAt: "2023-06-28T19:14:00.000Z", - text: "Test text", - status: "PostStatusActive", - threadId: "459", - categoryId: "2", - author: { - id: "4129", - handle: "Codefikeyz", - rootAccount: "j4TZJCACAWao9bnh5k86qeRW2QhNVNkf9eEw1Vz4V8ZeqD4u4", - controllerAccount: "j4TZJCACAWao9bnh5k86qeRW2QhNVNkf9eEw1Vz4V8ZeqD4u4", - isCouncilMember: false, - isFoundingMember: true, - inviteCount: 1, - roles: [], - boundAccounts: [ - "j4TZJCACAWao9bnh5k86qeRW2QhNVNkf9eEw1Vz4V8ZeqD4u4", - "j4WJoUb8xxQucAUFtmF18r41gzb1AG22nzypW1PT4LMLJqzU5" - ], - isVerified: true, - createdAt:"2023-06-28T19:14:00.000Z", - } - }] + posts: [ + { + id: '1', + createdAt: '2023-06-28T19:14:00.000Z', + text: 'Test text', + status: 'PostStatusActive', + threadId: '459', + categoryId: '2', + author: { + id: '4129', + handle: 'Codefikeyz', + rootAccount: 'j4TZJCACAWao9bnh5k86qeRW2QhNVNkf9eEw1Vz4V8ZeqD4u4', + controllerAccount: 'j4TZJCACAWao9bnh5k86qeRW2QhNVNkf9eEw1Vz4V8ZeqD4u4', + isCouncilMember: false, + isFoundingMember: true, + inviteCount: 1, + roles: [], + boundAccounts: [ + 'j4TZJCACAWao9bnh5k86qeRW2QhNVNkf9eEw1Vz4V8ZeqD4u4', + 'j4WJoUb8xxQucAUFtmF18r41gzb1AG22nzypW1PT4LMLJqzU5', + ], + isVerified: true, + createdAt: '2023-06-28T19:14:00.000Z', + }, + }, + ], } const Template: Story = ({ isArchive, type, initialPostText, categoryTitle, title }) => { diff --git a/packages/ui/test/forum/modals/DeleteThreadModal.test.tsx b/packages/ui/test/forum/modals/DeleteThreadModal.test.tsx index 1e93cf86de..95d5284a50 100644 --- a/packages/ui/test/forum/modals/DeleteThreadModal.test.tsx +++ b/packages/ui/test/forum/modals/DeleteThreadModal.test.tsx @@ -41,30 +41,32 @@ const modalData: ModalCallData = { tags: [], visiblePostsCount: 5, status: { __typename: 'ThreadStatusActive' }, - posts: [{ - id: "1", - createdAt: "2023-06-28T19:14:00.000Z", - text: "Test text", - status: "PostStatusActive", - threadId: "459", - categoryId: "2", - author: { - id: "4129", - handle: "Codefikeyz", - rootAccount: "j4TZJCACAWao9bnh5k86qeRW2QhNVNkf9eEw1Vz4V8ZeqD4u4", - controllerAccount: "j4TZJCACAWao9bnh5k86qeRW2QhNVNkf9eEw1Vz4V8ZeqD4u4", - isCouncilMember: false, - isFoundingMember: true, - inviteCount: 1, - roles: [], - boundAccounts: [ - "j4TZJCACAWao9bnh5k86qeRW2QhNVNkf9eEw1Vz4V8ZeqD4u4", - "j4WJoUb8xxQucAUFtmF18r41gzb1AG22nzypW1PT4LMLJqzU5" - ], - isVerified: true, - createdAt:"2023-06-28T19:14:00.000Z", - } - }] + posts: [ + { + id: '1', + createdAt: '2023-06-28T19:14:00.000Z', + text: 'Test text', + status: 'PostStatusActive', + threadId: '459', + categoryId: '2', + author: { + id: '4129', + handle: 'Codefikeyz', + rootAccount: 'j4TZJCACAWao9bnh5k86qeRW2QhNVNkf9eEw1Vz4V8ZeqD4u4', + controllerAccount: 'j4TZJCACAWao9bnh5k86qeRW2QhNVNkf9eEw1Vz4V8ZeqD4u4', + isCouncilMember: false, + isFoundingMember: true, + inviteCount: 1, + roles: [], + boundAccounts: [ + 'j4TZJCACAWao9bnh5k86qeRW2QhNVNkf9eEw1Vz4V8ZeqD4u4', + 'j4WJoUb8xxQucAUFtmF18r41gzb1AG22nzypW1PT4LMLJqzU5', + ], + isVerified: true, + createdAt: '2023-06-28T19:14:00.000Z', + }, + }, + ], }, } diff --git a/packages/ui/test/forum/pages/ForumThread.test.tsx b/packages/ui/test/forum/pages/ForumThread.test.tsx index b0ef3a5fce..82ddf4da61 100644 --- a/packages/ui/test/forum/pages/ForumThread.test.tsx +++ b/packages/ui/test/forum/pages/ForumThread.test.tsx @@ -62,31 +62,33 @@ describe('UI: Forum Thread Page', () => { tags: [], visiblePostsCount: 0, status: { __typename: 'ThreadStatusActive' }, - posts: [{ - id: "1", - createdAt: "2023-06-28T19:14:00.000Z", - text: "Test text", - status: "PostStatusActive", - threadId: "459", - categoryId: "2", - author: { - id: "4129", - handle: "Codefikeyz", - rootAccount: "j4TZJCACAWao9bnh5k86qeRW2QhNVNkf9eEw1Vz4V8ZeqD4u4", - controllerAccount: "j4TZJCACAWao9bnh5k86qeRW2QhNVNkf9eEw1Vz4V8ZeqD4u4", - isCouncilMember: false, - isFoundingMember: true, - inviteCount: 1, - roles: [], - boundAccounts: [ - "j4TZJCACAWao9bnh5k86qeRW2QhNVNkf9eEw1Vz4V8ZeqD4u4", - "j4WJoUb8xxQucAUFtmF18r41gzb1AG22nzypW1PT4LMLJqzU5" - ], - isVerified: true, - createdAt:"2023-06-28T19:14:00.000Z", - } - }] - } + posts: [ + { + id: '1', + createdAt: '2023-06-28T19:14:00.000Z', + text: 'Test text', + status: 'PostStatusActive', + threadId: '459', + categoryId: '2', + author: { + id: '4129', + handle: 'Codefikeyz', + rootAccount: 'j4TZJCACAWao9bnh5k86qeRW2QhNVNkf9eEw1Vz4V8ZeqD4u4', + controllerAccount: 'j4TZJCACAWao9bnh5k86qeRW2QhNVNkf9eEw1Vz4V8ZeqD4u4', + isCouncilMember: false, + isFoundingMember: true, + inviteCount: 1, + roles: [], + boundAccounts: [ + 'j4TZJCACAWao9bnh5k86qeRW2QhNVNkf9eEw1Vz4V8ZeqD4u4', + 'j4WJoUb8xxQucAUFtmF18r41gzb1AG22nzypW1PT4LMLJqzU5', + ], + isVerified: true, + createdAt: '2023-06-28T19:14:00.000Z', + }, + }, + ], + } beforeAll(() => { stubAccounts([alice, bob])