From 05c6ec78e59da507801f2d96021317cb0a84401e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Tib=C3=BArcio?= <104370112+pt-tsl@users.noreply.github.com> Date: Tue, 17 Dec 2024 17:04:45 -0500 Subject: [PATCH] BA-1917: Archive Rooms (#154) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * BA-1809 [FE] Simplify CurrentProfileProvider (#142) * BA-1809 squash all previous commits * BA-1809 Replacing catalogs temporarily, revert later * BA-1809 Fix rebase mistakes * Revert "BA-1809 Replacing catalogs temporarily, revert later" This reverts commit 1071e6e2098c27d40eb28bce840c285805db1b80. * BA-1809 Do not pass currentProfile as props * BA-1809 Fix component tests * BA-1809 Remove duplicated try ... catch * BA-1809 Move useCurrentProfile into authentication package * BA-1809 Remove profileId from Comment props and use useCurrentProfile instead * BA-1809 set current profile in useLogin hook * BA-1809 Fix tests * BA-1809 changesets * BA-1809 pnpm-lock.yaml * BA-1809 Replace catalogs, revert later! * BA-1809 Remove profile id from comment props * BA-1809 Make image paths absolute * BA-1809 Implement remaining gitlab suggestions * BA-1809 Test whether env variable is undefined before using it * tweaks --------- Co-authored-by: Alexandre Anicio * chore: versioning * feat: archived room mutation and filter * chore: versioning * fix: PR fixes * chore: fix changelog * feat: unarchive chat * chore: versioning --------- Co-authored-by: tsl-ps2 Co-authored-by: Alexandre Anicio Co-authored-by: Pedro Tibúrcio --- packages/components/CHANGELOG.md | 14 + .../ArchiveChatRoomMutation.graphql.ts | 151 +++ .../__generated__/ChatRoomsQuery.graphql.ts | 15 +- .../RoomsListFragment.graphql.ts | 14 +- .../chatRoomsPaginationQuery.graphql.ts | 147 ++- .../ChatRoomsList/ChatRoomItem/index.tsx | 54 +- .../ChatRoomsList/ChatRoomItem/types.ts | 2 + .../modules/messages/ChatRoomsList/index.tsx | 12 +- .../ChatRoomListItem/index.tsx | 6 +- .../graphql/mutations/ArchiveChatRoom.ts | 46 + .../messages/graphql/queries/RoomsList.ts | 10 +- .../subscriptions/useRoomListSubscription.tsx | 3 +- packages/components/package.json | 2 +- packages/components/schema.graphql | 1164 +++++------------ packages/design-system/CHANGELOG.md | 6 + .../components/icons/UnarchiveIcon/index.tsx | 20 + .../design-system/components/icons/index.ts | 1 + packages/design-system/package.json | 2 +- packages/wagtail/CHANGELOG.md | 7 + packages/wagtail/package.json | 2 +- 20 files changed, 789 insertions(+), 889 deletions(-) create mode 100644 packages/components/__generated__/ArchiveChatRoomMutation.graphql.ts create mode 100644 packages/components/modules/messages/graphql/mutations/ArchiveChatRoom.ts create mode 100644 packages/design-system/components/icons/UnarchiveIcon/index.tsx diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md index 35d6bdb2..c3337ace 100644 --- a/packages/components/CHANGELOG.md +++ b/packages/components/CHANGELOG.md @@ -1,5 +1,19 @@ # @baseapp-frontend/components +## 0.0.32 + +### Patch Changes + +- Added unarchiving chat room UX updates (icon and label change) +- Added archiving/unarchiving chat rooms functionality +- Enhanced ChatRoomItem with isInArchivedTab and isInUnreadTab props +- Updated ChatRoomsList to support archived filters +- Added new GraphQL mutation for archiving chat rooms +- Updated RoomsListFragment to support archived status +- Modified useRoomListSubscription to handle archived rooms +- Updated dependencies + - @baseapp-frontend/design-system@0.0.24 + ## 0.0.31 ### Patch Changes diff --git a/packages/components/__generated__/ArchiveChatRoomMutation.graphql.ts b/packages/components/__generated__/ArchiveChatRoomMutation.graphql.ts new file mode 100644 index 00000000..239315cd --- /dev/null +++ b/packages/components/__generated__/ArchiveChatRoomMutation.graphql.ts @@ -0,0 +1,151 @@ +/** + * @generated SignedSource<> + * @lightSyntaxTransform + * @nogrep + */ + +/* tslint:disable */ + +/* eslint-disable */ +// @ts-nocheck +import { ConcreteRequest, Mutation } from 'relay-runtime' + +export type ChatRoomArchiveInput = { + archive: boolean + clientMutationId?: string | null | undefined + profileId: string + roomId: string +} +export type ArchiveChatRoomMutation$variables = { + input: ChatRoomArchiveInput +} +export type ArchiveChatRoomMutation$data = { + readonly chatRoomArchive: + | { + readonly errors: + | ReadonlyArray< + | { + readonly field: string + readonly messages: ReadonlyArray + } + | null + | undefined + > + | null + | undefined + readonly room: + | { + readonly id: string + } + | null + | undefined + } + | null + | undefined +} +export type ArchiveChatRoomMutation = { + response: ArchiveChatRoomMutation$data + variables: ArchiveChatRoomMutation$variables +} + +const node: ConcreteRequest = (function () { + var v0 = [ + { + defaultValue: null, + kind: 'LocalArgument', + name: 'input', + }, + ], + v1 = [ + { + alias: null, + args: [ + { + kind: 'Variable', + name: 'input', + variableName: 'input', + }, + ], + concreteType: 'ChatRoomArchivePayload', + kind: 'LinkedField', + name: 'chatRoomArchive', + plural: false, + selections: [ + { + alias: null, + args: null, + concreteType: 'ChatRoom', + kind: 'LinkedField', + name: 'room', + plural: false, + selections: [ + { + alias: null, + args: null, + kind: 'ScalarField', + name: 'id', + storageKey: null, + }, + ], + storageKey: null, + }, + { + alias: null, + args: null, + concreteType: 'ErrorType', + kind: 'LinkedField', + name: 'errors', + plural: true, + selections: [ + { + alias: null, + args: null, + kind: 'ScalarField', + name: 'field', + storageKey: null, + }, + { + alias: null, + args: null, + kind: 'ScalarField', + name: 'messages', + storageKey: null, + }, + ], + storageKey: null, + }, + ], + storageKey: null, + }, + ] + return { + fragment: { + argumentDefinitions: v0 /*: any*/, + kind: 'Fragment', + metadata: null, + name: 'ArchiveChatRoomMutation', + selections: v1 /*: any*/, + type: 'Mutation', + abstractKey: null, + }, + kind: 'Request', + operation: { + argumentDefinitions: v0 /*: any*/, + kind: 'Operation', + name: 'ArchiveChatRoomMutation', + selections: v1 /*: any*/, + }, + params: { + cacheID: 'bb8d4b659a98b51a62538601cd17a068', + id: null, + metadata: {}, + name: 'ArchiveChatRoomMutation', + operationKind: 'mutation', + text: 'mutation ArchiveChatRoomMutation(\n $input: ChatRoomArchiveInput!\n) {\n chatRoomArchive(input: $input) {\n room {\n id\n }\n errors {\n field\n messages\n }\n }\n}\n', + }, + } +})() + +;(node as any).hash = 'c78639eb713e79457e32bc4388498618' + +export default node diff --git a/packages/components/__generated__/ChatRoomsQuery.graphql.ts b/packages/components/__generated__/ChatRoomsQuery.graphql.ts index 674901a5..d3ca1774 100644 --- a/packages/components/__generated__/ChatRoomsQuery.graphql.ts +++ b/packages/components/__generated__/ChatRoomsQuery.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<695af55d052edd1aad2d6691f70c56ea>> + * @generated SignedSource<<60e7201406e289f6409bf11cc8b81e94>> * @lightSyntaxTransform * @nogrep */ @@ -138,6 +138,11 @@ const node: ConcreteRequest = (function () { storageKey: null, }, v10 = [ + { + kind: 'Literal', + name: 'archived', + value: false, + }, v1 /*: any*/, { kind: 'Literal', @@ -543,12 +548,12 @@ const node: ConcreteRequest = (function () { }, v4 /*: any*/, ], - storageKey: 'chatRooms(first:5,unreadMessages:false)', + storageKey: 'chatRooms(archived:false,first:5,unreadMessages:false)', }, { alias: null, args: v10 /*: any*/, - filters: ['q', 'unreadMessages'], + filters: ['q', 'unreadMessages', 'archived'], handle: 'connection', key: 'roomsList_chatRooms', kind: 'LinkedHandle', @@ -567,12 +572,12 @@ const node: ConcreteRequest = (function () { ], }, params: { - cacheID: 'ef4b0c7849fadb741c400b8acb9ddf75', + cacheID: '4943fd77373dd62f8b74a60a66373294', id: null, metadata: {}, name: 'ChatRoomsQuery', operationKind: 'query', - text: 'query ChatRoomsQuery {\n ...AllProfilesListFragment\n me {\n id\n profile {\n id\n ...RoomsListFragment\n }\n }\n}\n\nfragment AllProfilesListFragment on Query {\n allProfiles(first: 5, orderBy: "-created") {\n totalCount\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n node {\n id\n ...ProfileItemFragment\n __typename\n }\n cursor\n }\n }\n}\n\nfragment MessageItemFragment on Message {\n id\n content\n created\n extraData\n inReplyTo {\n id\n }\n isRead\n pk\n profile {\n id\n }\n verb\n}\n\nfragment MessagesListFragment on ChatRoom {\n id\n participants {\n totalCount\n }\n unreadMessagesCount\n allMessages(first: 20) {\n totalCount\n edges {\n node {\n id\n created\n profile {\n id\n name\n image(height: 32, width: 32) {\n url\n }\n }\n isRead\n ...MessageItemFragment\n __typename\n }\n cursor\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n}\n\nfragment ProfileItemFragment on Profile {\n id\n name\n image(width: 100, height: 100) {\n url\n }\n urlPath {\n path\n id\n }\n}\n\nfragment RoomFragment on ChatRoom {\n id\n unreadMessagesCount\n image(width: 100, height: 100) {\n url\n }\n lastMessageTime\n lastMessage {\n id\n content\n }\n title\n participants {\n totalCount\n edges {\n node {\n id\n profile {\n id\n __typename\n name\n image(width: 100, height: 100) {\n url\n }\n }\n }\n }\n }\n ...MessagesListFragment\n}\n\nfragment RoomsListFragment on ChatRoomsInterface {\n __isChatRoomsInterface: __typename\n chatRooms(first: 5, unreadMessages: false) {\n edges {\n node {\n id\n ...RoomFragment\n __typename\n }\n cursor\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n id\n}\n', + text: 'query ChatRoomsQuery {\n ...AllProfilesListFragment\n me {\n id\n profile {\n id\n ...RoomsListFragment\n }\n }\n}\n\nfragment AllProfilesListFragment on Query {\n allProfiles(first: 5, orderBy: "-created") {\n totalCount\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n node {\n id\n ...ProfileItemFragment\n __typename\n }\n cursor\n }\n }\n}\n\nfragment MessageItemFragment on Message {\n id\n content\n created\n extraData\n inReplyTo {\n id\n }\n isRead\n pk\n profile {\n id\n }\n verb\n}\n\nfragment MessagesListFragment on ChatRoom {\n id\n participants {\n totalCount\n }\n unreadMessagesCount\n allMessages(first: 20) {\n totalCount\n edges {\n node {\n id\n created\n profile {\n id\n name\n image(height: 32, width: 32) {\n url\n }\n }\n isRead\n ...MessageItemFragment\n __typename\n }\n cursor\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n}\n\nfragment ProfileItemFragment on Profile {\n id\n name\n image(width: 100, height: 100) {\n url\n }\n urlPath {\n path\n id\n }\n}\n\nfragment RoomFragment on ChatRoom {\n id\n unreadMessagesCount\n image(width: 100, height: 100) {\n url\n }\n lastMessageTime\n lastMessage {\n id\n content\n }\n title\n participants {\n totalCount\n edges {\n node {\n id\n profile {\n id\n __typename\n name\n image(width: 100, height: 100) {\n url\n }\n }\n }\n }\n }\n ...MessagesListFragment\n}\n\nfragment RoomsListFragment on ChatRoomsInterface {\n __isChatRoomsInterface: __typename\n chatRooms(first: 5, unreadMessages: false, archived: false) {\n edges {\n node {\n id\n ...RoomFragment\n __typename\n }\n cursor\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n id\n}\n', }, } })() diff --git a/packages/components/__generated__/RoomsListFragment.graphql.ts b/packages/components/__generated__/RoomsListFragment.graphql.ts index a7876f78..754c17ab 100644 --- a/packages/components/__generated__/RoomsListFragment.graphql.ts +++ b/packages/components/__generated__/RoomsListFragment.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<38e0add85315f14cc90ee08389420fe7>> + * @generated SignedSource<> * @lightSyntaxTransform * @nogrep */ @@ -53,6 +53,11 @@ const node: ReaderFragment = (function () { } return { argumentDefinitions: [ + { + defaultValue: false, + kind: 'LocalArgument', + name: 'archived', + }, { defaultValue: 5, kind: 'LocalArgument', @@ -106,6 +111,11 @@ const node: ReaderFragment = (function () { { alias: 'chatRooms', args: [ + { + kind: 'Variable', + name: 'archived', + variableName: 'archived', + }, { kind: 'Variable', name: 'q', @@ -199,6 +209,6 @@ const node: ReaderFragment = (function () { } })() -;(node as any).hash = 'f7a5e744317c2621d3e82752cdd1459b' +;(node as any).hash = '7fe57d53d40a4295a9eb2ea600d96f11' export default node diff --git a/packages/components/__generated__/chatRoomsPaginationQuery.graphql.ts b/packages/components/__generated__/chatRoomsPaginationQuery.graphql.ts index 7fea7cbb..8aa1870d 100644 --- a/packages/components/__generated__/chatRoomsPaginationQuery.graphql.ts +++ b/packages/components/__generated__/chatRoomsPaginationQuery.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<> + * @generated SignedSource<<9b43b3a39cbb4c8c92d5209a5a7c8242>> * @lightSyntaxTransform * @nogrep */ @@ -12,6 +12,7 @@ import { ConcreteRequest, Query } from 'relay-runtime' import { FragmentRefs } from 'relay-runtime' export type chatRoomsPaginationQuery$variables = { + archived?: boolean | null | undefined count?: number | null | undefined cursor?: string | null | undefined id: string @@ -33,76 +34,87 @@ export type chatRoomsPaginationQuery = { const node: ConcreteRequest = (function () { var v0 = { + defaultValue: false, + kind: 'LocalArgument', + name: 'archived', + }, + v1 = { defaultValue: 5, kind: 'LocalArgument', name: 'count', }, - v1 = { + v2 = { defaultValue: null, kind: 'LocalArgument', name: 'cursor', }, - v2 = { + v3 = { defaultValue: null, kind: 'LocalArgument', name: 'id', }, - v3 = { + v4 = { defaultValue: null, kind: 'LocalArgument', name: 'q', }, - v4 = { + v5 = { defaultValue: false, kind: 'LocalArgument', name: 'unreadMessages', }, - v5 = [ + v6 = [ { kind: 'Variable', name: 'id', variableName: 'id', }, ], - v6 = { + v7 = { + kind: 'Variable', + name: 'archived', + variableName: 'archived', + }, + v8 = { kind: 'Variable', name: 'q', variableName: 'q', }, - v7 = { + v9 = { kind: 'Variable', name: 'unreadMessages', variableName: 'unreadMessages', }, - v8 = { + v10 = { alias: null, args: null, kind: 'ScalarField', name: '__typename', storageKey: null, }, - v9 = { + v11 = { alias: null, args: null, kind: 'ScalarField', name: 'id', storageKey: null, }, - v10 = [ + v12 = [ { kind: 'Variable', name: 'after', variableName: 'cursor', }, + v7 /*: any*/, { kind: 'Variable', name: 'first', variableName: 'count', }, - v6 /*: any*/, - v7 /*: any*/, + v8 /*: any*/, + v9 /*: any*/, ], - v11 = [ + v13 = [ { alias: null, args: null, @@ -111,7 +123,7 @@ const node: ConcreteRequest = (function () { storageKey: null, }, ], - v12 = { + v14 = { alias: null, args: [ { @@ -129,45 +141,45 @@ const node: ConcreteRequest = (function () { kind: 'LinkedField', name: 'image', plural: false, - selections: v11 /*: any*/, + selections: v13 /*: any*/, storageKey: 'image(height:100,width:100)', }, - v13 = { + v15 = { alias: null, args: null, kind: 'ScalarField', name: 'content', storageKey: null, }, - v14 = { + v16 = { alias: null, args: null, kind: 'ScalarField', name: 'totalCount', storageKey: null, }, - v15 = { + v17 = { alias: null, args: null, kind: 'ScalarField', name: 'name', storageKey: null, }, - v16 = [ + v18 = [ { kind: 'Literal', name: 'first', value: 20, }, ], - v17 = { + v19 = { alias: null, args: null, kind: 'ScalarField', name: 'cursor', storageKey: null, }, - v18 = { + v20 = { alias: null, args: null, concreteType: 'PageInfo', @@ -194,14 +206,21 @@ const node: ConcreteRequest = (function () { } return { fragment: { - argumentDefinitions: [v0 /*: any*/, v1 /*: any*/, v2 /*: any*/, v3 /*: any*/, v4 /*: any*/], + argumentDefinitions: [ + v0 /*: any*/, + v1 /*: any*/, + v2 /*: any*/, + v3 /*: any*/, + v4 /*: any*/, + v5 /*: any*/, + ], kind: 'Fragment', metadata: null, name: 'chatRoomsPaginationQuery', selections: [ { alias: null, - args: v5 /*: any*/, + args: v6 /*: any*/, concreteType: null, kind: 'LinkedField', name: 'node', @@ -209,6 +228,7 @@ const node: ConcreteRequest = (function () { selections: [ { args: [ + v7 /*: any*/, { kind: 'Variable', name: 'count', @@ -219,8 +239,8 @@ const node: ConcreteRequest = (function () { name: 'cursor', variableName: 'cursor', }, - v6 /*: any*/, - v7 /*: any*/, + v8 /*: any*/, + v9 /*: any*/, ], kind: 'FragmentSpread', name: 'RoomsListFragment', @@ -234,26 +254,33 @@ const node: ConcreteRequest = (function () { }, kind: 'Request', operation: { - argumentDefinitions: [v0 /*: any*/, v1 /*: any*/, v3 /*: any*/, v4 /*: any*/, v2 /*: any*/], + argumentDefinitions: [ + v0 /*: any*/, + v1 /*: any*/, + v2 /*: any*/, + v4 /*: any*/, + v5 /*: any*/, + v3 /*: any*/, + ], kind: 'Operation', name: 'chatRoomsPaginationQuery', selections: [ { alias: null, - args: v5 /*: any*/, + args: v6 /*: any*/, concreteType: null, kind: 'LinkedField', name: 'node', plural: false, selections: [ - v8 /*: any*/, - v9 /*: any*/, + v10 /*: any*/, + v11 /*: any*/, { kind: 'InlineFragment', selections: [ { alias: null, - args: v10 /*: any*/, + args: v12 /*: any*/, concreteType: 'ChatRoomConnection', kind: 'LinkedField', name: 'chatRooms', @@ -275,7 +302,7 @@ const node: ConcreteRequest = (function () { name: 'node', plural: false, selections: [ - v9 /*: any*/, + v11 /*: any*/, { alias: null, args: null, @@ -283,7 +310,7 @@ const node: ConcreteRequest = (function () { name: 'unreadMessagesCount', storageKey: null, }, - v12 /*: any*/, + v14 /*: any*/, { alias: null, args: null, @@ -298,7 +325,7 @@ const node: ConcreteRequest = (function () { kind: 'LinkedField', name: 'lastMessage', plural: false, - selections: [v9 /*: any*/, v13 /*: any*/], + selections: [v11 /*: any*/, v15 /*: any*/], storageKey: null, }, { @@ -316,7 +343,7 @@ const node: ConcreteRequest = (function () { name: 'participants', plural: false, selections: [ - v14 /*: any*/, + v16 /*: any*/, { alias: null, args: null, @@ -333,7 +360,7 @@ const node: ConcreteRequest = (function () { name: 'node', plural: false, selections: [ - v9 /*: any*/, + v11 /*: any*/, { alias: null, args: null, @@ -342,10 +369,10 @@ const node: ConcreteRequest = (function () { name: 'profile', plural: false, selections: [ - v9 /*: any*/, - v8 /*: any*/, - v15 /*: any*/, - v12 /*: any*/, + v11 /*: any*/, + v10 /*: any*/, + v17 /*: any*/, + v14 /*: any*/, ], storageKey: null, }, @@ -360,13 +387,13 @@ const node: ConcreteRequest = (function () { }, { alias: null, - args: v16 /*: any*/, + args: v18 /*: any*/, concreteType: 'MessageConnection', kind: 'LinkedField', name: 'allMessages', plural: false, selections: [ - v14 /*: any*/, + v16 /*: any*/, { alias: null, args: null, @@ -383,7 +410,7 @@ const node: ConcreteRequest = (function () { name: 'node', plural: false, selections: [ - v9 /*: any*/, + v11 /*: any*/, { alias: null, args: null, @@ -399,8 +426,8 @@ const node: ConcreteRequest = (function () { name: 'profile', plural: false, selections: [ - v9 /*: any*/, - v15 /*: any*/, + v11 /*: any*/, + v17 /*: any*/, { alias: null, args: [ @@ -419,7 +446,7 @@ const node: ConcreteRequest = (function () { kind: 'LinkedField', name: 'image', plural: false, - selections: v11 /*: any*/, + selections: v13 /*: any*/, storageKey: 'image(height:32,width:32)', }, ], @@ -432,7 +459,7 @@ const node: ConcreteRequest = (function () { name: 'isRead', storageKey: null, }, - v13 /*: any*/, + v15 /*: any*/, { alias: null, args: null, @@ -447,7 +474,7 @@ const node: ConcreteRequest = (function () { kind: 'LinkedField', name: 'inReplyTo', plural: false, - selections: [v9 /*: any*/], + selections: [v11 /*: any*/], storageKey: null, }, { @@ -464,43 +491,43 @@ const node: ConcreteRequest = (function () { name: 'verb', storageKey: null, }, - v8 /*: any*/, + v10 /*: any*/, ], storageKey: null, }, - v17 /*: any*/, + v19 /*: any*/, ], storageKey: null, }, - v18 /*: any*/, + v20 /*: any*/, ], storageKey: 'allMessages(first:20)', }, { alias: null, - args: v16 /*: any*/, + args: v18 /*: any*/, filters: null, handle: 'connection', key: 'chatRoom_allMessages', kind: 'LinkedHandle', name: 'allMessages', }, - v8 /*: any*/, + v10 /*: any*/, ], storageKey: null, }, - v17 /*: any*/, + v19 /*: any*/, ], storageKey: null, }, - v18 /*: any*/, + v20 /*: any*/, ], storageKey: null, }, { alias: null, - args: v10 /*: any*/, - filters: ['q', 'unreadMessages'], + args: v12 /*: any*/, + filters: ['q', 'unreadMessages', 'archived'], handle: 'connection', key: 'roomsList_chatRooms', kind: 'LinkedHandle', @@ -516,16 +543,16 @@ const node: ConcreteRequest = (function () { ], }, params: { - cacheID: 'c85e5fe29ec282b3e60ce3840257a16e', + cacheID: '9d5821f21109199a09d4de0b3aab46a7', id: null, metadata: {}, name: 'chatRoomsPaginationQuery', operationKind: 'query', - text: 'query chatRoomsPaginationQuery(\n $count: Int = 5\n $cursor: String\n $q: String = null\n $unreadMessages: Boolean = false\n $id: ID!\n) {\n node(id: $id) {\n __typename\n ...RoomsListFragment_4kOb3U\n id\n }\n}\n\nfragment MessageItemFragment on Message {\n id\n content\n created\n extraData\n inReplyTo {\n id\n }\n isRead\n pk\n profile {\n id\n }\n verb\n}\n\nfragment MessagesListFragment on ChatRoom {\n id\n participants {\n totalCount\n }\n unreadMessagesCount\n allMessages(first: 20) {\n totalCount\n edges {\n node {\n id\n created\n profile {\n id\n name\n image(height: 32, width: 32) {\n url\n }\n }\n isRead\n ...MessageItemFragment\n __typename\n }\n cursor\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n}\n\nfragment RoomFragment on ChatRoom {\n id\n unreadMessagesCount\n image(width: 100, height: 100) {\n url\n }\n lastMessageTime\n lastMessage {\n id\n content\n }\n title\n participants {\n totalCount\n edges {\n node {\n id\n profile {\n id\n __typename\n name\n image(width: 100, height: 100) {\n url\n }\n }\n }\n }\n }\n ...MessagesListFragment\n}\n\nfragment RoomsListFragment_4kOb3U on ChatRoomsInterface {\n __isChatRoomsInterface: __typename\n chatRooms(first: $count, after: $cursor, q: $q, unreadMessages: $unreadMessages) {\n edges {\n node {\n id\n ...RoomFragment\n __typename\n }\n cursor\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n id\n}\n', + text: 'query chatRoomsPaginationQuery(\n $archived: Boolean = false\n $count: Int = 5\n $cursor: String\n $q: String = null\n $unreadMessages: Boolean = false\n $id: ID!\n) {\n node(id: $id) {\n __typename\n ...RoomsListFragment_3I5PKK\n id\n }\n}\n\nfragment MessageItemFragment on Message {\n id\n content\n created\n extraData\n inReplyTo {\n id\n }\n isRead\n pk\n profile {\n id\n }\n verb\n}\n\nfragment MessagesListFragment on ChatRoom {\n id\n participants {\n totalCount\n }\n unreadMessagesCount\n allMessages(first: 20) {\n totalCount\n edges {\n node {\n id\n created\n profile {\n id\n name\n image(height: 32, width: 32) {\n url\n }\n }\n isRead\n ...MessageItemFragment\n __typename\n }\n cursor\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n}\n\nfragment RoomFragment on ChatRoom {\n id\n unreadMessagesCount\n image(width: 100, height: 100) {\n url\n }\n lastMessageTime\n lastMessage {\n id\n content\n }\n title\n participants {\n totalCount\n edges {\n node {\n id\n profile {\n id\n __typename\n name\n image(width: 100, height: 100) {\n url\n }\n }\n }\n }\n }\n ...MessagesListFragment\n}\n\nfragment RoomsListFragment_3I5PKK on ChatRoomsInterface {\n __isChatRoomsInterface: __typename\n chatRooms(first: $count, after: $cursor, q: $q, unreadMessages: $unreadMessages, archived: $archived) {\n edges {\n node {\n id\n ...RoomFragment\n __typename\n }\n cursor\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n id\n}\n', }, } })() -;(node as any).hash = 'f7a5e744317c2621d3e82752cdd1459b' +;(node as any).hash = '7fe57d53d40a4295a9eb2ea600d96f11' export default node diff --git a/packages/components/modules/messages/ChatRoomsList/ChatRoomItem/index.tsx b/packages/components/modules/messages/ChatRoomsList/ChatRoomItem/index.tsx index 7cf80223..0e53a768 100644 --- a/packages/components/modules/messages/ChatRoomsList/ChatRoomItem/index.tsx +++ b/packages/components/modules/messages/ChatRoomsList/ChatRoomItem/index.tsx @@ -1,14 +1,21 @@ import { FC, SyntheticEvent, useRef } from 'react' import { useCurrentProfile } from '@baseapp-frontend/authentication' -import { ArchiveIcon, AvatarWithPlaceholder, UnreadIcon } from '@baseapp-frontend/design-system' +import { + ArchiveIcon, + AvatarWithPlaceholder, + UnarchiveIcon, + UnreadIcon, +} from '@baseapp-frontend/design-system' import { Box, Badge as DefaultBadge, Typography } from '@mui/material' -import { useFragment } from 'react-relay' +import { ConnectionHandler, useFragment } from 'react-relay' +import { RecordSourceSelectorProxy } from 'relay-runtime' import { RoomFragment$key } from '../../../../__generated__/RoomFragment.graphql' import ActionsOverlay from '../../../__shared__/ActionsOverlay' import { MINIMUM_AMOUNT_OF_PARTICIPANTS_TO_SHOW_ROOM_TITLE } from '../../constants' +import { useArchiveChatRoomMutation } from '../../graphql/mutations/ArchiveChatRoom' import { RoomFragment } from '../../graphql/queries/Room' import { StyledChatCard } from './styled' import { ChatRoomItemProps } from './types' @@ -20,6 +27,8 @@ const ChatRoomItem: FC = ({ handleClick, Badge = DefaultBadge, BadgeProps = {}, + isInArchivedTab = false, + isInUnreadTab = false, }) => { const room = useFragment(RoomFragment, roomRef) @@ -30,7 +39,7 @@ const ChatRoomItem: FC = ({ const chatCardRef = useRef(null) - const { currentProfile: profile } = useCurrentProfile() + const { currentProfile } = useCurrentProfile() const roomData = { title: room.title, @@ -42,7 +51,7 @@ const ChatRoomItem: FC = ({ room.participants?.totalCount < MINIMUM_AMOUNT_OF_PARTICIPANTS_TO_SHOW_ROOM_TITLE ) { const otherParticipant = room.participants.edges.find( - (edge) => edge?.node?.profile?.id && edge?.node?.profile?.id !== profile?.id, + (edge) => edge?.node?.profile?.id && edge?.node?.profile?.id !== currentProfile?.id, ) roomData.title = otherParticipant?.node?.profile?.name roomData.avatarUrl = otherParticipant?.node?.profile?.image?.url @@ -53,16 +62,45 @@ const ChatRoomItem: FC = ({ const showBadge = room.unreadMessagesCount && room.unreadMessagesCount > 0 + const [commit, isMutationInFlight] = useArchiveChatRoomMutation() + return ( , - label: 'Archive Chat', - onClick: () => {}, + disabled: isMutationInFlight, + icon: !isInArchivedTab ? : , + label: !isInArchivedTab ? 'Archive Chat' : 'Unarchive Chat', + onClick: () => { + if (currentProfile?.id) { + commit({ + variables: { + input: { + roomId: room.id, + profileId: currentProfile.id, + archive: !isInArchivedTab, + }, + }, + updater: (store: RecordSourceSelectorProxy, data: any) => { + if (!data?.errors) { + const storyRecord = store.get(currentProfile.id) + if (storyRecord) { + const connectionRecord = ConnectionHandler.getConnection( + storyRecord, + 'roomsList_chatRooms', + { unreadMessages: isInUnreadTab, archived: isInArchivedTab }, + ) + if (connectionRecord) { + ConnectionHandler.deleteNode(connectionRecord, room.id) + } + } + } + }, + }) + } + }, hasPermission: true, }, { diff --git a/packages/components/modules/messages/ChatRoomsList/ChatRoomItem/types.ts b/packages/components/modules/messages/ChatRoomsList/ChatRoomItem/types.ts index d200e0bf..69de481f 100644 --- a/packages/components/modules/messages/ChatRoomsList/ChatRoomItem/types.ts +++ b/packages/components/modules/messages/ChatRoomsList/ChatRoomItem/types.ts @@ -10,6 +10,8 @@ export interface ChatRoomItemProps { handleClick?: () => void Badge?: FC BadgeProps?: Partial + isInArchivedTab: boolean + isInUnreadTab: boolean } export interface StyledChatCardProps extends BoxProps { diff --git a/packages/components/modules/messages/ChatRoomsList/index.tsx b/packages/components/modules/messages/ChatRoomsList/index.tsx index eb7736ae..79658a81 100644 --- a/packages/components/modules/messages/ChatRoomsList/index.tsx +++ b/packages/components/modules/messages/ChatRoomsList/index.tsx @@ -38,6 +38,9 @@ const ChatRoomsList: FC = ({ const [isPending, startTransition] = useTransition() const { control, reset, watch } = useForm({ defaultValues: { search: '' } }) + const isInUnreadTab = tab === CHAT_TAB_VALUES.unread + const isInArchivedTab = tab === CHAT_TAB_VALUES.archived + const handleSearchChange: ChangeEventHandler = (e) => { const value = e.target.value || '' startTransition(() => { @@ -56,7 +59,10 @@ const ChatRoomsList: FC = ({ setTab(newTab as ChatTabValues) startRefetchTransition(() => { refetch( - { unreadMessages: newTab === CHAT_TAB_VALUES.unread }, + { + unreadMessages: newTab === CHAT_TAB_VALUES.unread, + archived: newTab === CHAT_TAB_VALUES.archived, + }, { fetchPolicy: 'store-and-network' }, ) }) @@ -81,11 +87,13 @@ const ChatRoomsList: FC = ({ handleClick={() => { setChatRoom({ id: room.id }) }} + isInUnreadTab={isInUnreadTab} + isInArchivedTab={isInArchivedTab} {...ChatRoomItemProps} /> ) }, - [selectedRoom, setChatRoom, ChatRoomItemProps, ChatRoomItem], + [selectedRoom, setChatRoom, ChatRoomItemProps, ChatRoomItem, isInUnreadTab, isInArchivedTab], ) const renderLoadingState = () => { diff --git a/packages/components/modules/messages/CreateChatRoomList/ChatRoomListItem/index.tsx b/packages/components/modules/messages/CreateChatRoomList/ChatRoomListItem/index.tsx index 5254243a..42aa764d 100644 --- a/packages/components/modules/messages/CreateChatRoomList/ChatRoomListItem/index.tsx +++ b/packages/components/modules/messages/CreateChatRoomList/ChatRoomListItem/index.tsx @@ -47,9 +47,13 @@ const ChatRoomListItem: FC = ({ variables: { input: { profileId: currentProfile.id, participants: [id] }, connections: [ - // TODO: add filter handling (for now we can default 'unreadMessages' to false) ConnectionHandler.getConnectionID(currentProfile.id, 'roomsList_chatRooms', { unreadMessages: false, + archived: false, + }), + ConnectionHandler.getConnectionID(currentProfile.id, 'roomsList_chatRooms', { + unreadMessages: true, + archived: false, }), ], }, diff --git a/packages/components/modules/messages/graphql/mutations/ArchiveChatRoom.ts b/packages/components/modules/messages/graphql/mutations/ArchiveChatRoom.ts new file mode 100644 index 00000000..78bf099d --- /dev/null +++ b/packages/components/modules/messages/graphql/mutations/ArchiveChatRoom.ts @@ -0,0 +1,46 @@ +import { useNotification } from '@baseapp-frontend/utils' + +import { Disposable, UseMutationConfig, graphql, useMutation } from 'react-relay' + +import { ArchiveChatRoomMutation } from '../../../../__generated__/ArchiveChatRoomMutation.graphql' + +export const ArchiveChatRoomMutationQuery = graphql` + mutation ArchiveChatRoomMutation($input: ChatRoomArchiveInput!) { + chatRoomArchive(input: $input) { + room { + id + } + errors { + field + messages + } + } + } +` + +export const useArchiveChatRoomMutation = (): [ + (config: UseMutationConfig) => Disposable, + boolean, +] => { + const { sendToast } = useNotification() + const [commitMutation, isMutationInFlight] = useMutation( + ArchiveChatRoomMutationQuery, + ) + + const commit = (config: UseMutationConfig) => + commitMutation({ + ...config, + onCompleted: (response, errors) => { + errors?.forEach((error) => { + sendToast(error.message, { type: 'error' }) + }) + config?.onCompleted?.(response, errors) + }, + onError: (error) => { + sendToast(error.message, { type: 'error' }) + config?.onError?.(error) + }, + }) + + return [commit, isMutationInFlight] +} diff --git a/packages/components/modules/messages/graphql/queries/RoomsList.ts b/packages/components/modules/messages/graphql/queries/RoomsList.ts index 41dd34d5..c75e7f9c 100644 --- a/packages/components/modules/messages/graphql/queries/RoomsList.ts +++ b/packages/components/modules/messages/graphql/queries/RoomsList.ts @@ -10,10 +10,16 @@ export const RoomsListFragment = graphql` count: { type: "Int", defaultValue: 5 } q: { type: "String", defaultValue: null } unreadMessages: { type: "Boolean", defaultValue: false } + archived: { type: "Boolean", defaultValue: false } ) @refetchable(queryName: "chatRoomsPaginationQuery") { - chatRooms(first: $count, after: $cursor, q: $q, unreadMessages: $unreadMessages) - @connection(key: "roomsList_chatRooms") { + chatRooms( + first: $count + after: $cursor + q: $q + unreadMessages: $unreadMessages + archived: $archived + ) @connection(key: "roomsList_chatRooms") { edges { node { id diff --git a/packages/components/modules/messages/graphql/subscriptions/useRoomListSubscription.tsx b/packages/components/modules/messages/graphql/subscriptions/useRoomListSubscription.tsx index fe80a400..40bb3530 100644 --- a/packages/components/modules/messages/graphql/subscriptions/useRoomListSubscription.tsx +++ b/packages/components/modules/messages/graphql/subscriptions/useRoomListSubscription.tsx @@ -17,12 +17,13 @@ const RoomListSubscriptionQuery = graphql` const useRoomListSubscription = (profileId: string) => { const config = useMemo(() => { - // TODO: add filter handling (for now we can default 'unreadMessages' to false) const connectionIdActive = ConnectionHandler.getConnectionID(profileId, 'roomsList_chatRooms', { unreadMessages: false, + archived: false, }) const connectionIdUnread = ConnectionHandler.getConnectionID(profileId, 'roomsList_chatRooms', { unreadMessages: true, + archived: false, }) return { subscription: RoomListSubscriptionQuery, diff --git a/packages/components/package.json b/packages/components/package.json index 0c11112d..a04f67f6 100644 --- a/packages/components/package.json +++ b/packages/components/package.json @@ -1,7 +1,7 @@ { "name": "@baseapp-frontend/components", "description": "BaseApp components modules such as comments, notifications, messages, and more.", - "version": "0.0.31", + "version": "0.0.32", "main": "./index.ts", "types": "dist/index.d.ts", "sideEffects": false, diff --git a/packages/components/schema.graphql b/packages/components/schema.graphql index b20acf89..a0fe1b70 100644 --- a/packages/components/schema.graphql +++ b/packages/components/schema.graphql @@ -1,17 +1,46 @@ -""" -Exposes a URL that specifies the behaviour of this scalar. -""" +"""Exposes a URL that specifies the behaviour of this scalar.""" directive @specifiedBy( - """ - The URL that specifies the behaviour of this scalar. - """ + """The URL that specifies the behaviour of this scalar.""" url: String! ) on SCALAR +type ActivityLog implements Node { + """The ID of the object""" + id: ID! + createdAt: DateTime! + updatedAt: DateTime! + pk: Int! + metadata: GenericScalar + events(offset: Int, before: String, after: String, first: Int, last: Int, createdFrom: Date, createdTo: Date, userPk: Decimal): NodeLogEventConnection + user: User + profile: Profile + visibility: VisibilityTypes + verb: String + ipAddress: String + url: String +} + +type ActivityLogConnection { + """Pagination data for this connection.""" + pageInfo: PageInfo! + + """Contains the nodes in this connection.""" + edges: [ActivityLogEdge]! + totalCount: Int + edgeCount: Int +} + +"""A Relay edge containing a `ActivityLog` and its cursor.""" +type ActivityLogEdge { + """The item at the end of the edge""" + node: ActivityLog + + """A cursor for use in pagination""" + cursor: String! +} + type Block implements Node { - """ - The ID of the object - """ + """The ID of the object""" id: ID! created: DateTime! modified: DateTime! @@ -22,38 +51,26 @@ type Block implements Node { } type BlockConnection { - """ - Pagination data for this connection. - """ + """Pagination data for this connection.""" pageInfo: PageInfo! - """ - Contains the nodes in this connection. - """ + """Contains the nodes in this connection.""" edges: [BlockEdge]! totalCount: Int edgeCount: Int } -""" -A Relay edge containing a `Block` and its cursor. -""" +"""A Relay edge containing a `Block` and its cursor.""" type BlockEdge { - """ - The item at the end of the edge - """ + """The item at the end of the edge""" node: Block - """ - A cursor for use in pagination - """ + """A cursor for use in pagination""" cursor: String! } interface BlocksInterface { - """ - The ID of the object - """ + """The ID of the object""" id: ID! blockers(offset: Int, before: String, after: String, first: Int, last: Int): BlockConnection blocking(offset: Int, before: String, after: String, first: Int, last: Int): BlockConnection @@ -69,9 +86,7 @@ input BlockToggleInput { } type BlockTogglePayload { - """ - May contain more than one error for same field. - """ + """May contain more than one error for same field.""" errors: [ErrorType] _debug: DjangoDebug block: BlockEdge @@ -82,32 +97,17 @@ type BlockTogglePayload { } type ChatRoom implements Node { - """ - The ID of the object - """ + """The ID of the object""" id: ID! title: String image(width: Int!, height: Int!): File lastMessage: Message lastMessageTime: DateTime - participants( - offset: Int - before: String - after: String - first: Int - last: Int - ): ChatRoomParticipantConnection + participants(offset: Int, before: String, after: String, first: Int, last: Int): ChatRoomParticipantConnection pk: Int! - allMessages( - offset: Int - before: String - after: String - first: Int - last: Int - verb: Verbs - ): MessageConnection + allMessages(offset: Int, before: String, after: String, first: Int, last: Int, verb: Verbs): MessageConnection unreadMessagesCount(profileId: ID): Int - isArchivedByCurrentProfile: Boolean + isArchived(profileId: ID): Boolean } input ChatRoomArchiveInput { @@ -126,14 +126,10 @@ type ChatRoomArchivePayload { } type ChatRoomConnection { - """ - Pagination data for this connection. - """ + """Pagination data for this connection.""" pageInfo: PageInfo! - """ - Contains the nodes in this connection. - """ + """Contains the nodes in this connection.""" edges: [ChatRoomEdge]! totalCount: Int edgeCount: Int @@ -146,9 +142,7 @@ input ChatRoomCreateInput { } type ChatRoomCreatePayload { - """ - May contain more than one error for same field. - """ + """May contain more than one error for same field.""" errors: [ErrorType] _debug: DjangoDebug room: ChatRoomEdge @@ -156,18 +150,12 @@ type ChatRoomCreatePayload { clientMutationId: String } -""" -A Relay edge containing a `ChatRoom` and its cursor. -""" +"""A Relay edge containing a `ChatRoom` and its cursor.""" type ChatRoomEdge { - """ - The item at the end of the edge - """ + """The item at the end of the edge""" node: ChatRoom - """ - A cursor for use in pagination - """ + """A cursor for use in pagination""" cursor: String! } @@ -184,9 +172,7 @@ type ChatRoomOnRoomUpdate { } type ChatRoomParticipant implements Node { - """ - The ID of the object - """ + """The ID of the object""" id: ID! profile: Profile hasArchivedRoom: Boolean! @@ -194,31 +180,21 @@ type ChatRoomParticipant implements Node { } type ChatRoomParticipantConnection { - """ - Pagination data for this connection. - """ + """Pagination data for this connection.""" pageInfo: PageInfo! - """ - Contains the nodes in this connection. - """ + """Contains the nodes in this connection.""" edges: [ChatRoomParticipantEdge]! totalCount: Int edgeCount: Int } -""" -A Relay edge containing a `ChatRoomParticipant` and its cursor. -""" +"""A Relay edge containing a `ChatRoomParticipant` and its cursor.""" type ChatRoomParticipantEdge { - """ - The item at the end of the edge - """ + """The item at the end of the edge""" node: ChatRoomParticipant - """ - A cursor for use in pagination - """ + """A cursor for use in pagination""" cursor: String! } @@ -230,9 +206,7 @@ input ChatRoomReadMessagesInput { } type ChatRoomReadMessagesPayload { - """ - May contain more than one error for same field. - """ + """May contain more than one error for same field.""" errors: [ErrorType] _debug: DjangoDebug room: ChatRoom @@ -250,9 +224,7 @@ input ChatRoomSendMessageInput { } type ChatRoomSendMessagePayload { - """ - May contain more than one error for same field. - """ + """May contain more than one error for same field.""" errors: [ErrorType] _debug: DjangoDebug message: MessageEdge @@ -260,9 +232,7 @@ type ChatRoomSendMessagePayload { } interface ChatRoomsInterface { - """ - The ID of the object - """ + """The ID of the object""" id: ID! chatRooms( offset: Int @@ -272,9 +242,7 @@ interface ChatRoomsInterface { last: Int q: String - """ - Ordering - """ + """Ordering""" orderBy: String profileId: String unreadMessages: Boolean @@ -283,25 +251,21 @@ interface ChatRoomsInterface { unreadMessagesCount: Int } -type Comment implements Node & CommentsInterface & ReactionsInterface & PermissionsInterface { +type Comment implements Node & CommentsInterface & ReactionsInterface & PermissionsInterface & NodeActivityLogInterface { created: DateTime! modified: DateTime! user: User profile: Profile body: String - """ - languaged used in the comment - """ + """languaged used in the comment""" language: String isEdited: Boolean! isPinned: Boolean! inReplyTo: Comment status: CommentStatus - """ - The ID of the object - """ + """The ID of the object""" id: ID! commentsCount: CommentsCount! comments( @@ -312,21 +276,12 @@ type Comment implements Node & CommentsInterface & ReactionsInterface & Permissi last: Int q: String - """ - Ordering - """ + """Ordering""" orderBy: String ): CommentConnection isCommentsEnabled: Boolean! reactionsCount: ReactionsCount - reactions( - offset: Int - before: String - after: String - first: Int - last: Int - id: ID - ): ReactionConnection + reactions(offset: Int, before: String, after: String, first: Int, last: Int, id: ID): ReactionConnection isReactionsEnabled: Boolean! myReaction(profileId: ID): Reaction @@ -334,19 +289,16 @@ type Comment implements Node & CommentsInterface & ReactionsInterface & Permissi Determine if the logged in user has a specific permission for this object. """ hasPerm(perm: String!): Boolean + nodeActivityLogs(visibility: VisibilityTypes, first: Int = 10, offset: Int, before: String, after: String, last: Int, createdFrom: Date, createdTo: Date, userPk: Decimal, profilePk: Decimal): ActivityLogConnection pk: Int! target: CommentsInterface } type CommentConnection { - """ - Pagination data for this connection. - """ + """Pagination data for this connection.""" pageInfo: PageInfo! - """ - Contains the nodes in this connection. - """ + """Contains the nodes in this connection.""" edges: [CommentEdge]! totalCount: Int edgeCount: Int @@ -361,9 +313,7 @@ input CommentCreateInput { } type CommentCreatePayload { - """ - May contain more than one error for same field. - """ + """May contain more than one error for same field.""" errors: [ErrorType] _debug: DjangoDebug comment: CommentEdge @@ -376,9 +326,7 @@ input CommentDeleteInput { } type CommentDeletePayload { - """ - May contain more than one error for same field. - """ + """May contain more than one error for same field.""" errors: [ErrorType] _debug: DjangoDebug deletedId: ID @@ -387,18 +335,12 @@ type CommentDeletePayload { clientMutationId: String } -""" -A Relay edge containing a `Comment` and its cursor. -""" +"""A Relay edge containing a `Comment` and its cursor.""" type CommentEdge { - """ - The item at the end of the edge - """ + """The item at the end of the edge""" node: Comment - """ - A cursor for use in pagination - """ + """A cursor for use in pagination""" cursor: String! } @@ -408,9 +350,7 @@ input CommentPinInput { } type CommentPinPayload { - """ - May contain more than one error for same field. - """ + """May contain more than one error for same field.""" errors: [ErrorType] _debug: DjangoDebug comment: Comment @@ -426,9 +366,7 @@ type CommentsCount { } interface CommentsInterface { - """ - The ID of the object - """ + """The ID of the object""" id: ID! commentsCount: CommentsCount! comments( @@ -439,17 +377,13 @@ interface CommentsInterface { last: Int q: String - """ - Ordering - """ + """Ordering""" orderBy: String ): CommentConnection isCommentsEnabled: Boolean! } -""" -An enumeration. -""" +"""An enumeration.""" enum CommentStatus { DELETED PUBLISHED @@ -462,9 +396,7 @@ input CommentUpdateInput { } type CommentUpdatePayload { - """ - May contain more than one error for same field. - """ + """May contain more than one error for same field.""" errors: [ErrorType] _debug: DjangoDebug comment: Comment @@ -472,119 +404,85 @@ type CommentUpdatePayload { } """ -The `DateTime` scalar type represents a DateTime +The `Date` scalar type represents a Date value as specified by [iso8601](https://en.wikipedia.org/wiki/ISO_8601). """ -scalar DateTime +scalar Date """ -Debugging information for the current query. +The `DateTime` scalar type represents a DateTime +value as specified by +[iso8601](https://en.wikipedia.org/wiki/ISO_8601). """ +scalar DateTime + +"""The `Decimal` scalar type represents a python Decimal.""" +scalar Decimal + +"""Debugging information for the current query.""" type DjangoDebug { - """ - Executed SQL queries for this API query. - """ + """Executed SQL queries for this API query.""" sql: [DjangoDebugSQL] - """ - Raise exceptions for this API query. - """ + """Raise exceptions for this API query.""" exceptions: [DjangoDebugException] } -""" -Represents a single exception raised. -""" +"""Represents a single exception raised.""" type DjangoDebugException { - """ - The class of the exception - """ + """The class of the exception""" excType: String! - """ - The message of the exception - """ + """The message of the exception""" message: String! - """ - The stack trace - """ + """The stack trace""" stack: String! } -""" -Represents a single database query made to a Django managed DB. -""" +"""Represents a single database query made to a Django managed DB.""" type DjangoDebugSQL { - """ - The type of database being used (e.g. postrgesql, mysql, sqlite). - """ + """The type of database being used (e.g. postrgesql, mysql, sqlite).""" vendor: String! - """ - The Django database alias (e.g. 'default'). - """ + """The Django database alias (e.g. 'default').""" alias: String! - """ - The actual SQL sent to this database. - """ + """The actual SQL sent to this database.""" sql: String - """ - Duration of this database query in seconds. - """ + """Duration of this database query in seconds.""" duration: Float! - """ - The raw SQL of this query, without params. - """ + """The raw SQL of this query, without params.""" rawSql: String! - """ - JSON encoded database query parameters. - """ + """JSON encoded database query parameters.""" params: String! - """ - Start time of this database query. - """ + """Start time of this database query.""" startTime: Float! - """ - Stop time of this database query. - """ + """Stop time of this database query.""" stopTime: Float! - """ - Whether this database query took more than 10 seconds. - """ + """Whether this database query took more than 10 seconds.""" isSlow: Boolean! - """ - Whether this database query was a SELECT. - """ + """Whether this database query was a SELECT.""" isSelect: Boolean! - """ - Postgres transaction ID if available. - """ + """Postgres transaction ID if available.""" transId: String - """ - Postgres transaction status if available. - """ + """Postgres transaction status if available.""" transStatus: String - """ - Postgres isolation level if available. - """ + """Postgres isolation level if available.""" isoLevel: String - """ - Postgres connection encoding if available. - """ + """Postgres connection encoding if available.""" encoding: String } @@ -598,9 +496,7 @@ type File { } type Follow implements Node { - """ - The ID of the object - """ + """The ID of the object""" id: ID! created: DateTime! modified: DateTime! @@ -612,55 +508,29 @@ type Follow implements Node { } type FollowConnection { - """ - Pagination data for this connection. - """ + """Pagination data for this connection.""" pageInfo: PageInfo! - """ - Contains the nodes in this connection. - """ + """Contains the nodes in this connection.""" edges: [FollowEdge]! totalCount: Int edgeCount: Int } -""" -A Relay edge containing a `Follow` and its cursor. -""" +"""A Relay edge containing a `Follow` and its cursor.""" type FollowEdge { - """ - The item at the end of the edge - """ + """The item at the end of the edge""" node: Follow - """ - A cursor for use in pagination - """ + """A cursor for use in pagination""" cursor: String! } interface FollowsInterface { - """ - The ID of the object - """ + """The ID of the object""" id: ID! - followers( - offset: Int - before: String - after: String - first: Int - last: Int - targetIsFollowingBack: Boolean - ): FollowConnection - following( - offset: Int - before: String - after: String - first: Int - last: Int - targetIsFollowingBack: Boolean - ): FollowConnection + followers(offset: Int, before: String, after: String, first: Int, last: Int, targetIsFollowingBack: Boolean): FollowConnection + following(offset: Int, before: String, after: String, first: Int, last: Int, targetIsFollowingBack: Boolean): FollowConnection followersCount: Int followingCount: Int isFollowedByMe(profileId: ID): Boolean @@ -673,9 +543,7 @@ input FollowToggleInput { } type FollowTogglePayload { - """ - May contain more than one error for same field. - """ + """May contain more than one error for same field.""" errors: [ErrorType] _debug: DjangoDebug follow: FollowEdge @@ -700,9 +568,7 @@ schema (one of the key benefits of GraphQL). """ scalar JSONString -""" -Languages available -""" +"""Languages available""" enum Languages { en es @@ -710,9 +576,7 @@ enum Languages { } type Message implements Node { - """ - The ID of the object - """ + """The ID of the object""" id: ID! created: DateTime! content: String @@ -728,31 +592,21 @@ type Message implements Node { } type MessageConnection { - """ - Pagination data for this connection. - """ + """Pagination data for this connection.""" pageInfo: PageInfo! - """ - Contains the nodes in this connection. - """ + """Contains the nodes in this connection.""" edges: [MessageEdge]! totalCount: Int edgeCount: Int } -""" -A Relay edge containing a `Message` and its cursor. -""" +"""A Relay edge containing a `Message` and its cursor.""" type MessageEdge { - """ - The item at the end of the edge - """ + """The item at the end of the edge""" node: Message - """ - A cursor for use in pagination - """ + """A cursor for use in pagination""" cursor: String! } @@ -780,12 +634,8 @@ type Mutation { blockToggle(input: BlockToggleInput!): BlockTogglePayload reactionToggle(input: ReactionToggleInput!): ReactionTogglePayload notificationsMarkAsRead(input: NotificationsMarkAsReadInput!): NotificationsMarkAsReadPayload - notificationsMarkAllAsRead( - input: NotificationsMarkAllAsReadInput! - ): NotificationsMarkAllAsReadPayload - notificationSettingToggle( - input: NotificationSettingToggleInput! - ): NotificationSettingTogglePayload + notificationsMarkAllAsRead(input: NotificationsMarkAllAsReadInput!): NotificationsMarkAllAsReadPayload + notificationSettingToggle(input: NotificationSettingToggleInput!): NotificationSettingTogglePayload commentCreate(input: CommentCreateInput!): CommentCreatePayload commentUpdate(input: CommentUpdateInput!): CommentUpdatePayload commentPin(input: CommentPinInput!): CommentPinPayload @@ -797,20 +647,61 @@ type Mutation { profileDelete(input: ProfileDeleteInput!): ProfileDeletePayload } -""" -An object with an ID -""" +"""An object with an ID""" interface Node { - """ - The ID of the object - """ + """The ID of the object""" id: ID! } +interface NodeActivityLogInterface { + nodeActivityLogs(visibility: VisibilityTypes, first: Int = 10, offset: Int, before: String, after: String, last: Int, createdFrom: Date, createdTo: Date, userPk: Decimal, profilePk: Decimal): ActivityLogConnection +} + +type NodeLogEvent implements Node { + """The user associated with the event.""" + user: User + + """The ID of the object""" + id: ID! + pk: Int! + + """The object of the event.""" + obj: Node + + """The event label.""" + label: String + + """The raw data of the event.""" + data: GenericScalar + + """The diff between the previous event of the same label.""" + diff: GenericScalar + + """When the event was created.""" + createdAt: DateTime +} + +type NodeLogEventConnection { + """Pagination data for this connection.""" + pageInfo: PageInfo! + + """Contains the nodes in this connection.""" + edges: [NodeLogEventEdge]! + totalCount: Int + edgeCount: Int +} + +"""A Relay edge containing a `NodeLogEvent` and its cursor.""" +type NodeLogEventEdge { + """The item at the end of the edge""" + node: NodeLogEvent + + """A cursor for use in pagination""" + cursor: String! +} + type Notification implements Node { - """ - The ID of the object - """ + """The ID of the object""" id: ID! level: NotificationsNotificationLevelChoices! recipient: User! @@ -831,64 +722,42 @@ type Notification implements Node { actionObject: Node } -""" -An enumeration. -""" +"""An enumeration.""" enum NotificationChannelTypes { - """ - All - """ + """All""" ALL - """ - Email - """ + """Email""" EMAIL - """ - Push - """ + """Push""" PUSH - """ - In-App - """ + """In-App""" IN_APP } type NotificationConnection { - """ - Pagination data for this connection. - """ + """Pagination data for this connection.""" pageInfo: PageInfo! - """ - Contains the nodes in this connection. - """ + """Contains the nodes in this connection.""" edges: [NotificationEdge]! totalCount: Int edgeCount: Int } -""" -A Relay edge containing a `Notification` and its cursor. -""" +"""A Relay edge containing a `Notification` and its cursor.""" type NotificationEdge { - """ - The item at the end of the edge - """ + """The item at the end of the edge""" node: Notification - """ - A cursor for use in pagination - """ + """A cursor for use in pagination""" cursor: String! } type NotificationSetting implements Node { - """ - The ID of the object - """ + """The ID of the object""" id: ID! created: DateTime! modified: DateTime! @@ -900,31 +769,21 @@ type NotificationSetting implements Node { } type NotificationSettingConnection { - """ - Pagination data for this connection. - """ + """Pagination data for this connection.""" pageInfo: PageInfo! - """ - Contains the nodes in this connection. - """ + """Contains the nodes in this connection.""" edges: [NotificationSettingEdge]! totalCount: Int edgeCount: Int } -""" -A Relay edge containing a `NotificationSetting` and its cursor. -""" +"""A Relay edge containing a `NotificationSetting` and its cursor.""" type NotificationSettingEdge { - """ - The item at the end of the edge - """ + """The item at the end of the edge""" node: NotificationSetting - """ - A cursor for use in pagination - """ + """A cursor for use in pagination""" cursor: String! } @@ -935,9 +794,7 @@ input NotificationSettingToggleInput { } type NotificationSettingTogglePayload { - """ - May contain more than one error for same field. - """ + """May contain more than one error for same field.""" errors: [ErrorType] _debug: DjangoDebug notificationSetting: NotificationSetting @@ -945,43 +802,22 @@ type NotificationSettingTogglePayload { } interface NotificationsInterface { - """ - The ID of the object - """ + """The ID of the object""" id: ID! notificationsUnreadCount: Int - notifications( - offset: Int - before: String - after: String - first: Int - last: Int - level: NotificationsNotificationLevelChoices - unread: Boolean - verbs: String - ): NotificationConnection - notificationSettings( - offset: Int - before: String - after: String - first: Int - last: Int - ): NotificationSettingConnection + notifications(offset: Int, before: String, after: String, first: Int, last: Int, level: NotificationsNotificationLevelChoices, unread: Boolean, verbs: String): NotificationConnection + notificationSettings(offset: Int, before: String, after: String, first: Int, last: Int): NotificationSettingConnection isNotificationSettingActive(verb: String!, channel: NotificationChannelTypes!): Boolean } input NotificationsMarkAllAsReadInput { - """ - Mark as read or unread - """ + """Mark as read or unread""" read: Boolean! clientMutationId: String } type NotificationsMarkAllAsReadPayload { - """ - May contain more than one error for same field. - """ + """May contain more than one error for same field.""" errors: [ErrorType] _debug: DjangoDebug recipient: NotificationsInterface @@ -989,18 +825,14 @@ type NotificationsMarkAllAsReadPayload { } input NotificationsMarkAsReadInput { - """ - Mark as read or unread - """ + """Mark as read or unread""" read: Boolean! notificationIds: [ID!] clientMutationId: String } type NotificationsMarkAsReadPayload { - """ - May contain more than one error for same field. - """ + """May contain more than one error for same field.""" errors: [ErrorType] _debug: DjangoDebug recipient: NotificationsInterface @@ -1008,28 +840,18 @@ type NotificationsMarkAsReadPayload { clientMutationId: String } -""" -An enumeration. -""" +"""An enumeration.""" enum NotificationsNotificationLevelChoices { - """ - success - """ + """success""" SUCCESS - """ - info - """ + """info""" INFO - """ - warning - """ + """warning""" WARNING - """ - error - """ + """error""" ERROR } @@ -1045,13 +867,16 @@ type OnNotificationChange { deletedNotificationId: ID } -type Organization implements Node { +type Organization implements Node & PermissionsInterface { profile: Profile + """The ID of the object""" + id: ID! + """ - The ID of the object + Determine if the logged in user has a specific permission for this object. """ - id: ID! + hasPerm(perm: String!): Boolean pk: Int! } @@ -1062,9 +887,7 @@ input OrganizationCreateInput { } type OrganizationCreatePayload { - """ - May contain more than one error for same field. - """ + """May contain more than one error for same field.""" errors: [ErrorType] _debug: DjangoDebug organization: OrganizationEdge @@ -1072,18 +895,12 @@ type OrganizationCreatePayload { clientMutationId: String } -""" -A Relay edge containing a `Organization` and its cursor. -""" +"""A Relay edge containing a `Organization` and its cursor.""" type OrganizationEdge { - """ - The item at the end of the edge - """ + """The item at the end of the edge""" node: Organization - """ - A cursor for use in pagination - """ + """A cursor for use in pagination""" cursor: String! } @@ -1093,9 +910,7 @@ type Page implements Node & PageInterface & PermissionsInterface & CommentsInter user: User status: PageStatus - """ - The ID of the object - """ + """The ID of the object""" id: ID! urlPath: URLPath urlPaths: [URLPath] @@ -1114,9 +929,7 @@ type Page implements Node & PageInterface & PermissionsInterface & CommentsInter last: Int q: String - """ - Ordering - """ + """Ordering""" orderBy: String ): CommentConnection isCommentsEnabled: Boolean! @@ -1126,14 +939,10 @@ type Page implements Node & PageInterface & PermissionsInterface & CommentsInter } type PageConnection { - """ - Pagination data for this connection. - """ + """Pagination data for this connection.""" pageInfo: PageInfo! - """ - Contains the nodes in this connection. - """ + """Contains the nodes in this connection.""" edges: [PageEdge]! totalCount: Int edgeCount: Int @@ -1148,27 +957,19 @@ input PageCreateInput { } type PageCreatePayload { - """ - May contain more than one error for same field. - """ + """May contain more than one error for same field.""" errors: [ErrorType] _debug: DjangoDebug page: PageEdge clientMutationId: String } -""" -A Relay edge containing a `Page` and its cursor. -""" +"""A Relay edge containing a `Page` and its cursor.""" type PageEdge { - """ - The item at the end of the edge - """ + """The item at the end of the edge""" node: Page - """ - A cursor for use in pagination - """ + """A cursor for use in pagination""" cursor: String! } @@ -1182,9 +983,7 @@ input PageEditInput { } type PageEditPayload { - """ - May contain more than one error for same field. - """ + """May contain more than one error for same field.""" errors: [ErrorType] _debug: DjangoDebug page: Page @@ -1195,56 +994,38 @@ type PageEditPayload { The Relay compliant `PageInfo` type, containing data necessary to paginate this connection. """ type PageInfo { - """ - When paginating forwards, are there more items? - """ + """When paginating forwards, are there more items?""" hasNextPage: Boolean! - """ - When paginating backwards, are there more items? - """ + """When paginating backwards, are there more items?""" hasPreviousPage: Boolean! - """ - When paginating backwards, the cursor to continue. - """ + """When paginating backwards, the cursor to continue.""" startCursor: String - """ - When paginating forwards, the cursor to continue. - """ + """When paginating forwards, the cursor to continue.""" endCursor: String } interface PageInterface { - """ - The ID of the object - """ + """The ID of the object""" id: ID! urlPath: URLPath urlPaths: [URLPath] metadata: Metadata } -""" -An enumeration. -""" +"""An enumeration.""" enum PageStatus { - """ - Draft - """ + """Draft""" DRAFT - """ - Published - """ + """Published""" PUBLISHED } interface PermissionsInterface { - """ - The ID of the object - """ + """The ID of the object""" id: ID! """ @@ -1254,9 +1035,7 @@ interface PermissionsInterface { } type Profile implements Node & PermissionsInterface & PageInterface & FollowsInterface & BlocksInterface & ChatRoomsInterface { - """ - The ID of the object - """ + """The ID of the object""" id: ID! created: DateTime! modified: DateTime! @@ -1282,19 +1061,10 @@ type Profile implements Node & PermissionsInterface & PageInterface & FollowsInt last: Int q: String - """ - Ordering - """ + """Ordering""" orderBy: String ): CommentConnection! - reactions( - offset: Int - before: String - after: String - first: Int - last: Int - id: ID - ): ReactionConnection! + reactions(offset: Int, before: String, after: String, first: Int, last: Int, id: ID): ReactionConnection! ratings(offset: Int, before: String, after: String, first: Int, last: Int): RateConnection! user: User members( @@ -1305,43 +1075,13 @@ type Profile implements Node & PermissionsInterface & PageInterface & FollowsInt last: Int role: ProfileRoles - """ - Ordering - """ + """Ordering""" orderBy: String ): ProfileUserRoleConnection - chatroomparticipantSet( - offset: Int - before: String - after: String - first: Int - last: Int - profile_TargetContentType: ID - ): ChatRoomParticipantConnection! - messageSet( - offset: Int - before: String - after: String - first: Int - last: Int - verb: Verbs - ): MessageConnection! - following( - offset: Int - before: String - after: String - first: Int - last: Int - targetIsFollowingBack: Boolean - ): FollowConnection - followers( - offset: Int - before: String - after: String - first: Int - last: Int - targetIsFollowingBack: Boolean - ): FollowConnection + chatroomparticipantSet(offset: Int, before: String, after: String, first: Int, last: Int, profile_TargetContentType: ID): ChatRoomParticipantConnection! + messageSet(offset: Int, before: String, after: String, first: Int, last: Int, verb: Verbs): MessageConnection! + following(offset: Int, before: String, after: String, first: Int, last: Int, targetIsFollowingBack: Boolean): FollowConnection + followers(offset: Int, before: String, after: String, first: Int, last: Int, targetIsFollowingBack: Boolean): FollowConnection blocking(offset: Int, before: String, after: String, first: Int, last: Int): BlockConnection blockers(offset: Int, before: String, after: String, first: Int, last: Int): BlockConnection organization: Organization @@ -1363,9 +1103,7 @@ type Profile implements Node & PermissionsInterface & PageInterface & FollowsInt last: Int q: String - """ - Ordering - """ + """Ordering""" orderBy: String profileId: String unreadMessages: Boolean @@ -1373,18 +1111,15 @@ type Profile implements Node & PermissionsInterface & PageInterface & FollowsInt ): ChatRoomConnection unreadMessagesCount: Int pk: Int! + activityLogs(visibility: VisibilityTypes, first: Int = 10, offset: Int, before: String, after: String, last: Int, createdFrom: Date, createdTo: Date, userPk: Decimal, profilePk: Decimal): ActivityLogConnection target: ProfileInterface } type ProfileConnection { - """ - Pagination data for this connection. - """ + """Pagination data for this connection.""" pageInfo: PageInfo! - """ - Contains the nodes in this connection. - """ + """Contains the nodes in this connection.""" edges: [ProfileEdge]! totalCount: Int edgeCount: Int @@ -1404,9 +1139,7 @@ input ProfileCreateInput { } type ProfileCreatePayload { - """ - May contain more than one error for same field. - """ + """May contain more than one error for same field.""" errors: [ErrorType] _debug: DjangoDebug profile: ProfileEdge @@ -1419,77 +1152,51 @@ input ProfileDeleteInput { } type ProfileDeletePayload { - """ - May contain more than one error for same field. - """ + """May contain more than one error for same field.""" errors: [ErrorType] _debug: DjangoDebug deletedId: ID clientMutationId: String } -""" -A Relay edge containing a `Profile` and its cursor. -""" +"""A Relay edge containing a `Profile` and its cursor.""" type ProfileEdge { - """ - The item at the end of the edge - """ + """The item at the end of the edge""" node: Profile - """ - A cursor for use in pagination - """ + """A cursor for use in pagination""" cursor: String! } interface ProfileInterface { - """ - The ID of the object - """ + """The ID of the object""" id: ID! profile: Profile } -""" -An enumeration. -""" +"""An enumeration.""" enum ProfileRoles { - """ - admin - """ + """admin""" ADMIN - """ - manager - """ + """manager""" MANAGER } -""" -An enumeration. -""" +"""An enumeration.""" enum ProfileRoleStatus { - """ - active - """ + """active""" ACTIVE - """ - pending - """ + """pending""" PENDING - """ - inactive - """ + """inactive""" INACTIVE } interface ProfilesInterface { - """ - The ID of the object - """ + """The ID of the object""" id: ID! profiles( offset: Int @@ -1497,22 +1204,19 @@ interface ProfilesInterface { after: String first: Int last: Int - name: String + q: String + + """Ordering""" + orderBy: String ): ProfileConnection } -""" -An enumeration. -""" +"""An enumeration.""" enum ProfilesProfileStatusChoices { - """ - public - """ + """public""" A_1 - """ - private - """ + """private""" A_2 } @@ -1529,9 +1233,7 @@ input ProfileUpdateInput { } type ProfileUpdatePayload { - """ - May contain more than one error for same field. - """ + """May contain more than one error for same field.""" errors: [ErrorType] _debug: DjangoDebug profile: Profile @@ -1539,9 +1241,7 @@ type ProfileUpdatePayload { } type ProfileUserRole implements Node { - """ - The ID of the object - """ + """The ID of the object""" id: ID! user: User! role: ProfileRoles @@ -1550,63 +1250,44 @@ type ProfileUserRole implements Node { } type ProfileUserRoleConnection { - """ - Pagination data for this connection. - """ + """Pagination data for this connection.""" pageInfo: PageInfo! - """ - Contains the nodes in this connection. - """ + """Contains the nodes in this connection.""" edges: [ProfileUserRoleEdge]! totalCount: Int edgeCount: Int } -""" -A Relay edge containing a `ProfileUserRole` and its cursor. -""" +"""A Relay edge containing a `ProfileUserRole` and its cursor.""" type ProfileUserRoleEdge { - """ - The item at the end of the edge - """ + """The item at the end of the edge""" node: ProfileUserRole - """ - A cursor for use in pagination - """ + """A cursor for use in pagination""" cursor: String! } type Query { + activityLogs(visibility: VisibilityTypes, first: Int = 10, offset: Int, before: String, after: String, last: Int, createdFrom: Date, createdTo: Date, userPk: Decimal, profilePk: Decimal): ActivityLogConnection organization( - """ - The ID of the object - """ + """The ID of the object""" id: ID! ): Organization chatRoom( - """ - The ID of the object - """ + """The ID of the object""" id: ID! ): ChatRoom rate( - """ - The ID of the object - """ + """The ID of the object""" id: ID! ): Rate report( - """ - The ID of the object - """ + """The ID of the object""" id: ID! ): Report comment( - """ - The ID of the object - """ + """The ID of the object""" id: ID! ): Comment allComments( @@ -1617,24 +1298,13 @@ type Query { last: Int q: String - """ - Ordering - """ + """Ordering""" orderBy: String ): CommentConnection urlPath(path: String!): URLPath - allPages( - offset: Int - before: String - after: String - first: Int - last: Int - status: PageStatus - ): PageConnection + allPages(offset: Int, before: String, after: String, first: Int, last: Int, status: PageStatus): PageConnection page( - """ - The ID of the object - """ + """The ID of the object""" id: ID! ): Page allProfiles( @@ -1645,15 +1315,11 @@ type Query { last: Int q: String - """ - Ordering - """ + """Ordering""" orderBy: String ): ProfileConnection profile( - """ - The ID of the object - """ + """The ID of the object""" id: ID! ): Profile users( @@ -1664,31 +1330,23 @@ type Query { last: Int q: String - """ - Ordering - """ + """Ordering""" orderBy: String ): UserConnection user( - """ - The ID of the object - """ + """The ID of the object""" id: ID! ): User me: User node( - """ - The ID of the object - """ + """The ID of the object""" id: ID! ): Node _debug: DjangoDebug } type Rate implements Node { - """ - The ID of the object - """ + """The ID of the object""" id: ID! created: DateTime! modified: DateTime! @@ -1700,38 +1358,26 @@ type Rate implements Node { } type RateConnection { - """ - Pagination data for this connection. - """ + """Pagination data for this connection.""" pageInfo: PageInfo! - """ - Contains the nodes in this connection. - """ + """Contains the nodes in this connection.""" edges: [RateEdge]! totalCount: Int edgeCount: Int } -""" -A Relay edge containing a `Rate` and its cursor. -""" +"""A Relay edge containing a `Rate` and its cursor.""" type RateEdge { - """ - The item at the end of the edge - """ + """The item at the end of the edge""" node: Rate - """ - A cursor for use in pagination - """ + """A cursor for use in pagination""" cursor: String! } interface RatingsInterface { - """ - The ID of the object - """ + """The ID of the object""" id: ID! ratingsCount: Int ratingsSum: Int @@ -1742,9 +1388,7 @@ interface RatingsInterface { } type Reaction implements Node { - """ - The ID of the object - """ + """The ID of the object""" id: ID! created: DateTime! modified: DateTime! @@ -1755,31 +1399,21 @@ type Reaction implements Node { } type ReactionConnection { - """ - Pagination data for this connection. - """ + """Pagination data for this connection.""" pageInfo: PageInfo! - """ - Contains the nodes in this connection. - """ + """Contains the nodes in this connection.""" edges: [ReactionEdge]! totalCount: Int edgeCount: Int } -""" -A Relay edge containing a `Reaction` and its cursor. -""" +"""A Relay edge containing a `Reaction` and its cursor.""" type ReactionEdge { - """ - The item at the end of the edge - """ + """The item at the end of the edge""" node: Reaction - """ - A cursor for use in pagination - """ + """A cursor for use in pagination""" cursor: String! } @@ -1790,19 +1424,10 @@ type ReactionsCount { } interface ReactionsInterface { - """ - The ID of the object - """ + """The ID of the object""" id: ID! reactionsCount: ReactionsCount - reactions( - offset: Int - before: String - after: String - first: Int - last: Int - id: ID - ): ReactionConnection + reactions(offset: Int, before: String, after: String, first: Int, last: Int, id: ID): ReactionConnection isReactionsEnabled: Boolean! myReaction(profileId: ID): Reaction } @@ -1815,9 +1440,7 @@ input ReactionToggleInput { } type ReactionTogglePayload { - """ - May contain more than one error for same field. - """ + """May contain more than one error for same field.""" errors: [ErrorType] _debug: DjangoDebug reaction: ReactionEdge @@ -1826,25 +1449,17 @@ type ReactionTogglePayload { clientMutationId: String } -""" -An enumeration. -""" +"""An enumeration.""" enum ReactionTypes { - """ - like - """ + """like""" LIKE - """ - dislike - """ + """dislike""" DISLIKE } type Report implements Node { - """ - The ID of the object - """ + """The ID of the object""" id: ID! created: DateTime! modified: DateTime! @@ -1856,14 +1471,10 @@ type Report implements Node { } type ReportConnection { - """ - Pagination data for this connection. - """ + """Pagination data for this connection.""" pageInfo: PageInfo! - """ - Contains the nodes in this connection. - """ + """Contains the nodes in this connection.""" edges: [ReportEdge]! totalCount: Int edgeCount: Int @@ -1877,9 +1488,7 @@ input ReportCreateInput { } type ReportCreatePayload { - """ - May contain more than one error for same field. - """ + """May contain more than one error for same field.""" errors: [ErrorType] _debug: DjangoDebug report: ReportEdge @@ -1887,18 +1496,12 @@ type ReportCreatePayload { clientMutationId: String } -""" -A Relay edge containing a `Report` and its cursor. -""" +"""A Relay edge containing a `Report` and its cursor.""" type ReportEdge { - """ - The item at the end of the edge - """ + """The item at the end of the edge""" node: Report - """ - A cursor for use in pagination - """ + """A cursor for use in pagination""" cursor: String! } @@ -1911,44 +1514,25 @@ type ReportsCount { } interface ReportsInterface { - """ - The ID of the object - """ + """The ID of the object""" id: ID! reportsCount: ReportsCount - reports( - offset: Int - before: String - after: String - first: Int - last: Int - id: ID - ): ReportConnection + reports(offset: Int, before: String, after: String, first: Int, last: Int, id: ID): ReportConnection myReports: Report } -""" -An enumeration. -""" +"""An enumeration.""" enum ReportTypes { - """ - Spam - """ + """Spam""" SPAM - """ - Inappropriate - """ + """Inappropriate""" INAPPROPRIATE - """ - Fake - """ + """Fake""" FAKE - """ - Other - """ + """Other""" OTHER } @@ -1961,9 +1545,7 @@ type Subscription { } type URLPath implements Node { - """ - The ID of the object - """ + """The ID of the object""" id: ID! created: DateTime! modified: DateTime! @@ -1992,14 +1574,7 @@ type User implements Node & PermissionsInterface & NotificationsInterface & Page """ isActive: Boolean! isStaff: Boolean - reactions( - offset: Int - before: String - after: String - first: Int - last: Int - id: ID - ): ReactionConnection! + reactions(offset: Int, before: String, after: String, first: Int, last: Int, id: ID): ReactionConnection! comments( offset: Int before: String @@ -2008,23 +1583,12 @@ type User implements Node & PermissionsInterface & NotificationsInterface & Page last: Int q: String - """ - Ordering - """ + """Ordering""" orderBy: String ): CommentConnection! - pages( - offset: Int - before: String - after: String - first: Int - last: Int - status: PageStatus - ): PageConnection! + pages(offset: Int, before: String, after: String, first: Int, last: Int, status: PageStatus): PageConnection! - """ - The ID of the object - """ + """The ID of the object""" id: ID! """ @@ -2032,23 +1596,8 @@ type User implements Node & PermissionsInterface & NotificationsInterface & Page """ hasPerm(perm: String!): Boolean notificationsUnreadCount: Int - notifications( - offset: Int - before: String - after: String - first: Int - last: Int - level: NotificationsNotificationLevelChoices - unread: Boolean - verbs: String - ): NotificationConnection - notificationSettings( - offset: Int - before: String - after: String - first: Int - last: Int - ): NotificationSettingConnection + notifications(offset: Int, before: String, after: String, first: Int, last: Int, level: NotificationsNotificationLevelChoices, unread: Boolean, verbs: String): NotificationConnection + notificationSettings(offset: Int, before: String, after: String, first: Int, last: Int): NotificationSettingConnection isNotificationSettingActive(verb: String!, channel: NotificationChannelTypes!): Boolean urlPath: URLPath urlPaths: [URLPath] @@ -2065,10 +1614,14 @@ type User implements Node & PermissionsInterface & NotificationsInterface & Page after: String first: Int last: Int - name: String + q: String + + """Ordering""" + orderBy: String ): ProfileConnection profile: Profile pk: Int! + activityLogs(visibility: VisibilityTypes, first: Int = 10, offset: Int, before: String, after: String, last: Int, createdFrom: Date, createdTo: Date, userPk: Decimal, profilePk: Decimal): ActivityLogConnection isAuthenticated: Boolean fullName: String shortName: String @@ -2076,37 +1629,38 @@ type User implements Node & PermissionsInterface & NotificationsInterface & Page } type UserConnection { - """ - Pagination data for this connection. - """ + """Pagination data for this connection.""" pageInfo: PageInfo! - """ - Contains the nodes in this connection. - """ + """Contains the nodes in this connection.""" edges: [UserEdge]! totalCount: Int edgeCount: Int } -""" -A Relay edge containing a `User` and its cursor. -""" +"""A Relay edge containing a `User` and its cursor.""" type UserEdge { - """ - The item at the end of the edge - """ + """The item at the end of the edge""" node: User - """ - A cursor for use in pagination - """ + """A cursor for use in pagination""" cursor: String! } -""" -An enumeration. -""" +"""An enumeration.""" enum Verbs { SENT_MESSAGE } + +"""An enumeration.""" +enum VisibilityTypes { + """public""" + PUBLIC + + """private""" + PRIVATE + + """internal""" + INTERNAL +} + diff --git a/packages/design-system/CHANGELOG.md b/packages/design-system/CHANGELOG.md index 1c932bf7..280965c3 100644 --- a/packages/design-system/CHANGELOG.md +++ b/packages/design-system/CHANGELOG.md @@ -1,5 +1,11 @@ # @baseapp-frontend/design-system +## 0.0.24 + +### Patch Changes + +- Added Unarchive icon + ## 0.0.23 ### Patch Changes diff --git a/packages/design-system/components/icons/UnarchiveIcon/index.tsx b/packages/design-system/components/icons/UnarchiveIcon/index.tsx new file mode 100644 index 00000000..45860504 --- /dev/null +++ b/packages/design-system/components/icons/UnarchiveIcon/index.tsx @@ -0,0 +1,20 @@ +import { FC } from 'react' + +import { SvgIcon, SvgIconProps } from '@mui/material' + +const UnarchiveIcon: FC = ({ sx, ...props }) => ( + + + + + + +) + +export default UnarchiveIcon diff --git a/packages/design-system/components/icons/index.ts b/packages/design-system/components/icons/index.ts index c21851a1..d1c8732e 100644 --- a/packages/design-system/components/icons/index.ts +++ b/packages/design-system/components/icons/index.ts @@ -18,4 +18,5 @@ export { default as PinIcon } from './PinIcon' export { default as SendMessageIcon } from './SendMessageIcon' export { default as ShareIcon } from './ShareIcon' export { default as TrashCanIcon } from './TrashCanIcon' +export { default as UnarchiveIcon } from './UnarchiveIcon' export { default as UnreadIcon } from './UnreadIcon' diff --git a/packages/design-system/package.json b/packages/design-system/package.json index df4314ca..101e821a 100644 --- a/packages/design-system/package.json +++ b/packages/design-system/package.json @@ -1,7 +1,7 @@ { "name": "@baseapp-frontend/design-system", "description": "Design System components and configurations.", - "version": "0.0.23", + "version": "0.0.24", "main": "./index.ts", "types": "dist/index.d.ts", "sideEffects": false, diff --git a/packages/wagtail/CHANGELOG.md b/packages/wagtail/CHANGELOG.md index c3e0c325..37fe52ed 100644 --- a/packages/wagtail/CHANGELOG.md +++ b/packages/wagtail/CHANGELOG.md @@ -1,5 +1,12 @@ # @baseapp-frontend/wagtail +## 1.0.8 + +### Patch Changes + +- Updated dependencies + - @baseapp-frontend/design-system@0.0.24 + ## 1.0.7 ### Patch Changes diff --git a/packages/wagtail/package.json b/packages/wagtail/package.json index cdec443a..dfe517c8 100644 --- a/packages/wagtail/package.json +++ b/packages/wagtail/package.json @@ -1,7 +1,7 @@ { "name": "@baseapp-frontend/wagtail", "description": "BaseApp Wagtail", - "version": "1.0.7", + "version": "1.0.8", "main": "./index.ts", "types": "dist/index.d.ts", "sideEffects": false,