merge-wip-prepare-inbox
This commit is contained in:
commit
3831b148a9
|
@ -18,10 +18,10 @@ const colors = [
|
||||||
'#ca6702',
|
'#ca6702',
|
||||||
'#ae2012',
|
'#ae2012',
|
||||||
'#9b2226',
|
'#9b2226',
|
||||||
'#668CFF',
|
'#668cff',
|
||||||
'#C34CFE',
|
'#c34cfe',
|
||||||
'#E699FF',
|
'#e699ff',
|
||||||
'#6633FF'
|
'#6633ff'
|
||||||
]
|
]
|
||||||
|
|
||||||
const getById = (letter: string) =>
|
const getById = (letter: string) =>
|
||||||
|
|
|
@ -2,17 +2,43 @@ import './DialogCard.module.scss'
|
||||||
import styles from './DialogCard.module.scss'
|
import styles from './DialogCard.module.scss'
|
||||||
import DialogAvatar from './DialogAvatar'
|
import DialogAvatar from './DialogAvatar'
|
||||||
import type { Author } from '../../graphql/types.gen'
|
import type { Author } from '../../graphql/types.gen'
|
||||||
|
// import { useAuthStore } from '../../stores/auth'
|
||||||
|
import { createEffect, createSignal } from 'solid-js'
|
||||||
|
import { apiClient } from '../../utils/apiClient'
|
||||||
|
|
||||||
type Props = {
|
const { session } = useAuthStore()
|
||||||
|
|
||||||
|
type DialogProps = {
|
||||||
online?: boolean
|
online?: boolean
|
||||||
message?: string
|
message?: string
|
||||||
counter?: number
|
counter?: number
|
||||||
author?: Author
|
author?: Author
|
||||||
}
|
}
|
||||||
|
|
||||||
const DialogCard = (props: Props) => {
|
const createChat = async ({ title, members }: { title?: string; members?: string[] }): Promise<void> => {
|
||||||
|
await apiClient.createChat({ title, members })
|
||||||
|
}
|
||||||
|
|
||||||
|
const DialogCard = (props: DialogProps) => {
|
||||||
|
const [currentUser, setCurrentUser] = createSignal(undefined)
|
||||||
|
createEffect(() => {
|
||||||
|
setCurrentUser(session()?.user?.slug)
|
||||||
|
})
|
||||||
|
|
||||||
|
const handleOpenChat = async () => {
|
||||||
|
try {
|
||||||
|
const test = await apiClient.createChat({
|
||||||
|
title: 'test chat',
|
||||||
|
members: [props.author.slug, currentUser()]
|
||||||
|
})
|
||||||
|
console.log('!!! test:', test)
|
||||||
|
} catch (err) {
|
||||||
|
console.log('!!! errr:', err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div class={styles.DialogCard}>
|
<div class={styles.DialogCard} onClick={handleOpenChat}>
|
||||||
<div class={styles.avatar}>
|
<div class={styles.avatar}>
|
||||||
<DialogAvatar name={props.author.name} url={props.author.userpic} online={props.online} />
|
<DialogAvatar name={props.author.name} url={props.author.userpic} online={props.online} />
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -6,17 +6,20 @@ import { Loading } from '../Loading'
|
||||||
import DialogCard from '../Inbox/DialogCard'
|
import DialogCard from '../Inbox/DialogCard'
|
||||||
import Search from '../Inbox/Search'
|
import Search from '../Inbox/Search'
|
||||||
import { useAuthorsStore } from '../../stores/zine/authors'
|
import { useAuthorsStore } from '../../stores/zine/authors'
|
||||||
|
// const { session } = useAuthStore()
|
||||||
|
|
||||||
import '../../styles/Inbox.scss'
|
import '../../styles/Inbox.scss'
|
||||||
// Для моков
|
// Для моков
|
||||||
import { createClient } from '@urql/core'
|
import { createClient } from '@urql/core'
|
||||||
import { findAndLoadGraphQLConfig } from '@graphql-codegen/cli'
|
import { findAndLoadGraphQLConfig } from '@graphql-codegen/cli'
|
||||||
|
// import { useAuthStore } from '../../stores/auth'
|
||||||
|
|
||||||
const OWNER_ID = '501'
|
const OWNER_ID = '501'
|
||||||
const client = createClient({
|
const client = createClient({
|
||||||
url: 'https://graphqlzero.almansi.me/api'
|
url: 'https://graphqlzero.almansi.me/api'
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// console.log('!!! session:', session)
|
||||||
// interface InboxProps {
|
// interface InboxProps {
|
||||||
// chats?: Chat[]
|
// chats?: Chat[]
|
||||||
// messages?: Message[]
|
// messages?: Message[]
|
||||||
|
@ -63,6 +66,7 @@ export const InboxView = () => {
|
||||||
const [authors, setAuthors] = createSignal<Author[]>([])
|
const [authors, setAuthors] = createSignal<Author[]>([])
|
||||||
const [postMessageText, setPostMessageText] = createSignal('')
|
const [postMessageText, setPostMessageText] = createSignal('')
|
||||||
const [loading, setLoading] = createSignal<boolean>(false)
|
const [loading, setLoading] = createSignal<boolean>(false)
|
||||||
|
|
||||||
const { sortedAuthors } = useAuthorsStore()
|
const { sortedAuthors } = useAuthorsStore()
|
||||||
|
|
||||||
createEffect(() => {
|
createEffect(() => {
|
||||||
|
@ -133,7 +137,7 @@ export const InboxView = () => {
|
||||||
</div>
|
</div>
|
||||||
<div class="holder">
|
<div class="holder">
|
||||||
<div class="dialogs">
|
<div class="dialogs">
|
||||||
<For each={authors()}>{(author: Author) => <DialogCard author={author} online={true} />}</For>
|
<For each={authors()}>{(author) => <DialogCard author={author} online={true} />}</For>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
12
src/graphql/mutation/create-chat.ts
Normal file
12
src/graphql/mutation/create-chat.ts
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
import { gql } from '@urql/core'
|
||||||
|
|
||||||
|
export default gql`
|
||||||
|
mutation CreateChat($title: String, $members: [String]!) {
|
||||||
|
createChat(title: $title, members: $members) {
|
||||||
|
error
|
||||||
|
chat {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
|
@ -24,42 +24,18 @@ export type AuthResult = {
|
||||||
export type Author = {
|
export type Author = {
|
||||||
bio?: Maybe<Scalars['String']>
|
bio?: Maybe<Scalars['String']>
|
||||||
caption?: Maybe<Scalars['String']>
|
caption?: Maybe<Scalars['String']>
|
||||||
id: Scalars['Int']
|
|
||||||
lastSeen?: Maybe<Scalars['DateTime']>
|
|
||||||
links?: Maybe<Array<Maybe<Scalars['String']>>>
|
links?: Maybe<Array<Maybe<Scalars['String']>>>
|
||||||
name: Scalars['String']
|
name: Scalars['String']
|
||||||
roles?: Maybe<Array<Maybe<Role>>>
|
|
||||||
slug: Scalars['String']
|
slug: Scalars['String']
|
||||||
stat?: Maybe<AuthorStat>
|
|
||||||
userpic?: Maybe<Scalars['String']>
|
userpic?: Maybe<Scalars['String']>
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AuthorStat = {
|
|
||||||
commented?: Maybe<Scalars['Int']>
|
|
||||||
followers?: Maybe<Scalars['Int']>
|
|
||||||
followings?: Maybe<Scalars['Int']>
|
|
||||||
rating?: Maybe<Scalars['Int']>
|
|
||||||
}
|
|
||||||
|
|
||||||
export type AuthorsBy = {
|
|
||||||
createdAt?: InputMaybe<Scalars['DateTime']>
|
|
||||||
days?: InputMaybe<Scalars['Int']>
|
|
||||||
lastSeen?: InputMaybe<Scalars['DateTime']>
|
|
||||||
name?: InputMaybe<Scalars['String']>
|
|
||||||
order?: InputMaybe<Scalars['String']>
|
|
||||||
slug?: InputMaybe<Scalars['String']>
|
|
||||||
stat?: InputMaybe<Scalars['String']>
|
|
||||||
topic?: InputMaybe<Scalars['String']>
|
|
||||||
}
|
|
||||||
|
|
||||||
export type Chat = {
|
export type Chat = {
|
||||||
admins?: Maybe<Array<Maybe<User>>>
|
|
||||||
createdAt: Scalars['Int']
|
createdAt: Scalars['Int']
|
||||||
createdBy: User
|
createdBy: User
|
||||||
description?: Maybe<Scalars['String']>
|
description?: Maybe<Scalars['String']>
|
||||||
id: Scalars['String']
|
id: Scalars['Int']
|
||||||
messages: Array<Maybe<Message>>
|
messages: Array<Maybe<Message>>
|
||||||
private?: Maybe<Scalars['Boolean']>
|
|
||||||
title?: Maybe<Scalars['String']>
|
title?: Maybe<Scalars['String']>
|
||||||
unread?: Maybe<Scalars['Int']>
|
unread?: Maybe<Scalars['Int']>
|
||||||
updatedAt: Scalars['Int']
|
updatedAt: Scalars['Int']
|
||||||
|
@ -76,8 +52,8 @@ export type ChatMember = {
|
||||||
invitedAt?: Maybe<Scalars['DateTime']>
|
invitedAt?: Maybe<Scalars['DateTime']>
|
||||||
invitedBy?: Maybe<Scalars['String']>
|
invitedBy?: Maybe<Scalars['String']>
|
||||||
name: Scalars['String']
|
name: Scalars['String']
|
||||||
|
pic?: Maybe<Scalars['String']>
|
||||||
slug: Scalars['String']
|
slug: Scalars['String']
|
||||||
userpic?: Maybe<Scalars['String']>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export type Collab = {
|
export type Collab = {
|
||||||
|
@ -93,7 +69,6 @@ export type Collection = {
|
||||||
createdAt: Scalars['DateTime']
|
createdAt: Scalars['DateTime']
|
||||||
createdBy: User
|
createdBy: User
|
||||||
desc?: Maybe<Scalars['String']>
|
desc?: Maybe<Scalars['String']>
|
||||||
id: Scalars['Int']
|
|
||||||
publishedAt?: Maybe<Scalars['DateTime']>
|
publishedAt?: Maybe<Scalars['DateTime']>
|
||||||
slug: Scalars['String']
|
slug: Scalars['String']
|
||||||
title: Scalars['String']
|
title: Scalars['String']
|
||||||
|
@ -103,7 +78,6 @@ export type Community = {
|
||||||
createdAt: Scalars['DateTime']
|
createdAt: Scalars['DateTime']
|
||||||
createdBy: User
|
createdBy: User
|
||||||
desc?: Maybe<Scalars['String']>
|
desc?: Maybe<Scalars['String']>
|
||||||
id: Scalars['Int']
|
|
||||||
name: Scalars['String']
|
name: Scalars['String']
|
||||||
pic: Scalars['String']
|
pic: Scalars['String']
|
||||||
slug: Scalars['String']
|
slug: Scalars['String']
|
||||||
|
@ -122,7 +96,7 @@ export type Message = {
|
||||||
chatId: Scalars['String']
|
chatId: Scalars['String']
|
||||||
createdAt: Scalars['Int']
|
createdAt: Scalars['Int']
|
||||||
id: Scalars['Int']
|
id: Scalars['Int']
|
||||||
replyTo?: Maybe<Scalars['String']>
|
replyTo?: Maybe<Scalars['Int']>
|
||||||
updatedAt?: Maybe<Scalars['Int']>
|
updatedAt?: Maybe<Scalars['Int']>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,7 +122,8 @@ export type Mutation = {
|
||||||
createReaction: Result
|
createReaction: Result
|
||||||
createShout: Result
|
createShout: Result
|
||||||
createTopic: Result
|
createTopic: Result
|
||||||
deleteChat: Result
|
deleteCollection: Result
|
||||||
|
deleteCommunity: Result
|
||||||
deleteMessage: Result
|
deleteMessage: Result
|
||||||
deleteReaction: Result
|
deleteReaction: Result
|
||||||
deleteShout: Result
|
deleteShout: Result
|
||||||
|
@ -184,7 +159,7 @@ export type MutationCreateChatArgs = {
|
||||||
export type MutationCreateMessageArgs = {
|
export type MutationCreateMessageArgs = {
|
||||||
body: Scalars['String']
|
body: Scalars['String']
|
||||||
chatId: Scalars['String']
|
chatId: Scalars['String']
|
||||||
replyTo?: InputMaybe<Scalars['String']>
|
replyTo?: InputMaybe<Scalars['Int']>
|
||||||
}
|
}
|
||||||
|
|
||||||
export type MutationCreateReactionArgs = {
|
export type MutationCreateReactionArgs = {
|
||||||
|
@ -199,8 +174,12 @@ export type MutationCreateTopicArgs = {
|
||||||
input: TopicInput
|
input: TopicInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type MutationDeleteChatArgs = {
|
export type MutationDeleteCollectionArgs = {
|
||||||
chatId: Scalars['String']
|
slug: Scalars['String']
|
||||||
|
}
|
||||||
|
|
||||||
|
export type MutationDeleteCommunityArgs = {
|
||||||
|
slug: Scalars['String']
|
||||||
}
|
}
|
||||||
|
|
||||||
export type MutationDeleteMessageArgs = {
|
export type MutationDeleteMessageArgs = {
|
||||||
|
@ -316,34 +295,58 @@ export type ProfileInput = {
|
||||||
}
|
}
|
||||||
|
|
||||||
export type Query = {
|
export type Query = {
|
||||||
authorsAll: Array<Maybe<Author>>
|
authorsAll: Array<Maybe<User>>
|
||||||
getAuthor: User
|
collectionsAll: Array<Maybe<Collection>>
|
||||||
getCollabs: Array<Maybe<Collab>>
|
getCollabs: Array<Maybe<Collab>>
|
||||||
getTopic: Topic
|
getCommunities: Array<Maybe<Community>>
|
||||||
|
getCommunity: Community
|
||||||
|
getShoutBySlug: Shout
|
||||||
|
getUserCollections: Array<Maybe<Collection>>
|
||||||
|
getUserRoles: Array<Maybe<Role>>
|
||||||
|
getUsersBySlugs: Array<Maybe<User>>
|
||||||
isEmailUsed: Scalars['Boolean']
|
isEmailUsed: Scalars['Boolean']
|
||||||
loadAuthorsBy: Array<Maybe<Author>>
|
loadChat: Array<Maybe<Message>>
|
||||||
loadChats: Result
|
|
||||||
loadMessagesBy: Result
|
|
||||||
loadReactionsBy: Array<Maybe<Reaction>>
|
|
||||||
loadShoutsBy: Array<Maybe<Shout>>
|
|
||||||
markdownBody: Scalars['String']
|
markdownBody: Scalars['String']
|
||||||
searchUsers: Result
|
myChats: Array<Maybe<Chat>>
|
||||||
|
reactionsByAuthor: Array<Maybe<Reaction>>
|
||||||
|
reactionsForShouts: Array<Maybe<Reaction>>
|
||||||
|
recentAll: Array<Maybe<Shout>>
|
||||||
|
recentCandidates: Array<Maybe<Shout>>
|
||||||
|
recentCommented: Array<Maybe<Shout>>
|
||||||
|
recentPublished: Array<Maybe<Shout>>
|
||||||
|
recentReacted: Array<Maybe<Shout>>
|
||||||
|
searchQuery?: Maybe<Array<Maybe<Shout>>>
|
||||||
|
shoutsByAuthors: Array<Maybe<Shout>>
|
||||||
|
shoutsByCollection: Array<Maybe<Shout>>
|
||||||
|
shoutsByCommunities: Array<Maybe<Shout>>
|
||||||
|
shoutsByTopics: Array<Maybe<Shout>>
|
||||||
|
shoutsForFeed: Array<Maybe<Shout>>
|
||||||
signIn: AuthResult
|
signIn: AuthResult
|
||||||
signOut: AuthResult
|
signOut: AuthResult
|
||||||
topicsAll: Array<Maybe<Topic>>
|
topicsAll: Array<Maybe<Topic>>
|
||||||
topicsByAuthor: Array<Maybe<Topic>>
|
topicsByAuthor: Array<Maybe<Topic>>
|
||||||
topicsByCommunity: Array<Maybe<Topic>>
|
topicsByCommunity: Array<Maybe<Topic>>
|
||||||
topicsRandom: Array<Maybe<Topic>>
|
topicsRandom: Array<Maybe<Topic>>
|
||||||
userFollowedAuthors: Array<Maybe<Author>>
|
userFollowedAuthors: Array<Maybe<User>>
|
||||||
|
userFollowedCommunities: Array<Maybe<Community>>
|
||||||
userFollowedTopics: Array<Maybe<Topic>>
|
userFollowedTopics: Array<Maybe<Topic>>
|
||||||
userFollowers: Array<Maybe<Author>>
|
userFollowers: Array<Maybe<User>>
|
||||||
|
userReactedShouts: Array<Maybe<Shout>>
|
||||||
}
|
}
|
||||||
|
|
||||||
export type QueryGetAuthorArgs = {
|
export type QueryGetCommunityArgs = {
|
||||||
|
slug?: InputMaybe<Scalars['String']>
|
||||||
|
}
|
||||||
|
|
||||||
|
export type QueryGetShoutBySlugArgs = {
|
||||||
slug: Scalars['String']
|
slug: Scalars['String']
|
||||||
}
|
}
|
||||||
|
|
||||||
export type QueryGetTopicArgs = {
|
export type QueryGetUserCollectionsArgs = {
|
||||||
|
author: Scalars['String']
|
||||||
|
}
|
||||||
|
|
||||||
|
export type QueryGetUserRolesArgs = {
|
||||||
slug: Scalars['String']
|
slug: Scalars['String']
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -351,30 +354,7 @@ export type QueryIsEmailUsedArgs = {
|
||||||
email: Scalars['String']
|
email: Scalars['String']
|
||||||
}
|
}
|
||||||
|
|
||||||
export type QueryLoadAuthorsByArgs = {
|
export type QueryLoadChatArgs = {
|
||||||
amount?: InputMaybe<Scalars['Int']>
|
|
||||||
by?: InputMaybe<AuthorsBy>
|
|
||||||
offset?: InputMaybe<Scalars['Int']>
|
|
||||||
}
|
|
||||||
|
|
||||||
export type QueryLoadChatsArgs = {
|
|
||||||
amount?: InputMaybe<Scalars['Int']>
|
|
||||||
offset?: InputMaybe<Scalars['Int']>
|
|
||||||
}
|
|
||||||
|
|
||||||
export type QueryLoadMessagesByArgs = {
|
|
||||||
amount?: InputMaybe<Scalars['Int']>
|
|
||||||
by: MessagesBy
|
|
||||||
offset?: InputMaybe<Scalars['Int']>
|
|
||||||
}
|
|
||||||
|
|
||||||
export type QueryLoadReactionsByArgs = {
|
|
||||||
amount?: InputMaybe<Scalars['Int']>
|
|
||||||
by: ReactionBy
|
|
||||||
limit?: InputMaybe<Scalars['Int']>
|
|
||||||
}
|
|
||||||
|
|
||||||
export type QueryLoadShoutsByArgs = {
|
|
||||||
amount?: InputMaybe<Scalars['Int']>
|
amount?: InputMaybe<Scalars['Int']>
|
||||||
by?: InputMaybe<ShoutsBy>
|
by?: InputMaybe<ShoutsBy>
|
||||||
offset?: InputMaybe<Scalars['Int']>
|
offset?: InputMaybe<Scalars['Int']>
|
||||||
|
@ -384,10 +364,76 @@ export type QueryMarkdownBodyArgs = {
|
||||||
body: Scalars['String']
|
body: Scalars['String']
|
||||||
}
|
}
|
||||||
|
|
||||||
export type QuerySearchUsersArgs = {
|
export type QueryReactionsByAuthorArgs = {
|
||||||
amount?: InputMaybe<Scalars['Int']>
|
limit: Scalars['Int']
|
||||||
offset?: InputMaybe<Scalars['Int']>
|
offset: Scalars['Int']
|
||||||
query: Scalars['String']
|
slug: Scalars['String']
|
||||||
|
}
|
||||||
|
|
||||||
|
export type QueryReactionsForShoutsArgs = {
|
||||||
|
limit: Scalars['Int']
|
||||||
|
offset: Scalars['Int']
|
||||||
|
shouts: Array<InputMaybe<Scalars['String']>>
|
||||||
|
}
|
||||||
|
|
||||||
|
export type QueryRecentAllArgs = {
|
||||||
|
limit: Scalars['Int']
|
||||||
|
offset: Scalars['Int']
|
||||||
|
}
|
||||||
|
|
||||||
|
export type QueryRecentCandidatesArgs = {
|
||||||
|
limit: Scalars['Int']
|
||||||
|
offset: Scalars['Int']
|
||||||
|
}
|
||||||
|
|
||||||
|
export type QueryRecentCommentedArgs = {
|
||||||
|
limit: Scalars['Int']
|
||||||
|
offset: Scalars['Int']
|
||||||
|
}
|
||||||
|
|
||||||
|
export type QueryRecentPublishedArgs = {
|
||||||
|
limit: Scalars['Int']
|
||||||
|
offset: Scalars['Int']
|
||||||
|
}
|
||||||
|
|
||||||
|
export type QueryRecentReactedArgs = {
|
||||||
|
limit: Scalars['Int']
|
||||||
|
offset: Scalars['Int']
|
||||||
|
}
|
||||||
|
|
||||||
|
export type QuerySearchQueryArgs = {
|
||||||
|
limit: Scalars['Int']
|
||||||
|
offset: Scalars['Int']
|
||||||
|
q?: InputMaybe<Scalars['String']>
|
||||||
|
}
|
||||||
|
|
||||||
|
export type QueryShoutsByAuthorsArgs = {
|
||||||
|
limit: Scalars['Int']
|
||||||
|
offset: Scalars['Int']
|
||||||
|
slugs: Array<InputMaybe<Scalars['String']>>
|
||||||
|
}
|
||||||
|
|
||||||
|
export type QueryShoutsByCollectionArgs = {
|
||||||
|
collection: Scalars['String']
|
||||||
|
limit: Scalars['Int']
|
||||||
|
offset: Scalars['Int']
|
||||||
|
}
|
||||||
|
|
||||||
|
export type QueryShoutsByCommunitiesArgs = {
|
||||||
|
limit: Scalars['Int']
|
||||||
|
offset: Scalars['Int']
|
||||||
|
slugs: Array<InputMaybe<Scalars['String']>>
|
||||||
|
}
|
||||||
|
|
||||||
|
export type QueryShoutsByTopicsArgs = {
|
||||||
|
limit: Scalars['Int']
|
||||||
|
offset: Scalars['Int']
|
||||||
|
slugs: Array<InputMaybe<Scalars['String']>>
|
||||||
|
}
|
||||||
|
|
||||||
|
export type QueryShoutsForFeedArgs = {
|
||||||
|
limit: Scalars['Int']
|
||||||
|
offset: Scalars['Int']
|
||||||
}
|
}
|
||||||
|
|
||||||
export type QuerySignInArgs = {
|
export type QuerySignInArgs = {
|
||||||
|
@ -495,8 +541,8 @@ export type Resource = {
|
||||||
}
|
}
|
||||||
|
|
||||||
export type Result = {
|
export type Result = {
|
||||||
author?: Maybe<Author>
|
author?: Maybe<User>
|
||||||
authors?: Maybe<Array<Maybe<Author>>>
|
authors?: Maybe<Array<Maybe<User>>>
|
||||||
chat?: Maybe<Chat>
|
chat?: Maybe<Chat>
|
||||||
chats?: Maybe<Array<Maybe<Chat>>>
|
chats?: Maybe<Array<Maybe<Chat>>>
|
||||||
communities?: Maybe<Array<Maybe<Community>>>
|
communities?: Maybe<Array<Maybe<Community>>>
|
||||||
|
@ -509,10 +555,8 @@ export type Result = {
|
||||||
reactions?: Maybe<Array<Maybe<Reaction>>>
|
reactions?: Maybe<Array<Maybe<Reaction>>>
|
||||||
shout?: Maybe<Shout>
|
shout?: Maybe<Shout>
|
||||||
shouts?: Maybe<Array<Maybe<Shout>>>
|
shouts?: Maybe<Array<Maybe<Shout>>>
|
||||||
slugs?: Maybe<Array<Maybe<Scalars['String']>>>
|
|
||||||
topic?: Maybe<Topic>
|
topic?: Maybe<Topic>
|
||||||
topics?: Maybe<Array<Maybe<Topic>>>
|
topics?: Maybe<Array<Maybe<Topic>>>
|
||||||
uids?: Maybe<Array<Maybe<Scalars['String']>>>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export type Role = {
|
export type Role = {
|
||||||
|
@ -531,6 +575,7 @@ export type Shout = {
|
||||||
createdAt: Scalars['DateTime']
|
createdAt: Scalars['DateTime']
|
||||||
deletedAt?: Maybe<Scalars['DateTime']>
|
deletedAt?: Maybe<Scalars['DateTime']>
|
||||||
deletedBy?: Maybe<User>
|
deletedBy?: Maybe<User>
|
||||||
|
draft?: Maybe<Scalars['Boolean']>
|
||||||
id: Scalars['Int']
|
id: Scalars['Int']
|
||||||
lang?: Maybe<Scalars['String']>
|
lang?: Maybe<Scalars['String']>
|
||||||
layout?: Maybe<Scalars['String']>
|
layout?: Maybe<Scalars['String']>
|
||||||
|
@ -545,8 +590,8 @@ export type Shout = {
|
||||||
topics?: Maybe<Array<Maybe<Topic>>>
|
topics?: Maybe<Array<Maybe<Topic>>>
|
||||||
updatedAt?: Maybe<Scalars['DateTime']>
|
updatedAt?: Maybe<Scalars['DateTime']>
|
||||||
updatedBy?: Maybe<User>
|
updatedBy?: Maybe<User>
|
||||||
versionOf?: Maybe<Scalars['String']>
|
versionOf?: Maybe<Shout>
|
||||||
visibility?: Maybe<Scalars['String']>
|
visibleFor?: Maybe<Array<Maybe<User>>>
|
||||||
}
|
}
|
||||||
|
|
||||||
export type ShoutInput = {
|
export type ShoutInput = {
|
||||||
|
|
|
@ -4,6 +4,10 @@ main {
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
// TODO: добавлять когда открыт чат
|
||||||
|
body {
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
.messages {
|
.messages {
|
||||||
top: 74px;
|
top: 74px;
|
||||||
|
@ -17,7 +21,7 @@ main {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
z-index: 1;
|
z-index: 9;
|
||||||
|
|
||||||
> .row {
|
> .row {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
|
|
|
@ -34,6 +34,7 @@ import authorBySlug from '../graphql/query/author-by-slug'
|
||||||
import shoutsLoadBy from '../graphql/query/articles-load-by'
|
import shoutsLoadBy from '../graphql/query/articles-load-by'
|
||||||
import reactionsLoadBy from '../graphql/query/reactions-load-by'
|
import reactionsLoadBy from '../graphql/query/reactions-load-by'
|
||||||
import authorsLoadBy from '../graphql/query/authors-load-by'
|
import authorsLoadBy from '../graphql/query/authors-load-by'
|
||||||
|
import createChatQuery from '../graphql/mutation/create-chat'
|
||||||
|
|
||||||
const FEED_SIZE = 50
|
const FEED_SIZE = 50
|
||||||
|
|
||||||
|
@ -396,6 +397,12 @@ export const apiClient = {
|
||||||
incrementView: async ({ articleSlug }) => {
|
incrementView: async ({ articleSlug }) => {
|
||||||
await privateGraphQLClient.mutation(incrementView, { shout: articleSlug })
|
await privateGraphQLClient.mutation(incrementView, { shout: articleSlug })
|
||||||
},
|
},
|
||||||
|
createChat: async ({ title, members }) => {
|
||||||
|
return await privateGraphQLClient
|
||||||
|
.mutation(createChatQuery, { title: title, members: members })
|
||||||
|
.toPromise()
|
||||||
|
},
|
||||||
|
|
||||||
getChats: async (payload = {}) => {
|
getChats: async (payload = {}) => {
|
||||||
const resp = await privateGraphQLClient.query(myChats, payload).toPromise()
|
const resp = await privateGraphQLClient.query(myChats, payload).toPromise()
|
||||||
return resp.data.myChats
|
return resp.data.myChats
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
export const isDev = import.meta.env.VERCEL_ENV !== 'production'
|
export const isDev = import.meta.env.MODE === 'development'
|
||||||
export const apiBaseUrl =
|
|
||||||
import.meta.env.PUBLIC_API_URL ||
|
export const apiBaseUrl = 'https://testapi.discours.io'
|
||||||
import.meta.env.API_URL ||
|
// export const apiBaseUrl = 'https://newapi.discours.io'
|
||||||
import.meta.env.VITE_API_URL ||
|
// testapi.discours.io
|
||||||
'http://localhost:8080'
|
// export const apiBaseUrl = 'http://localhost:8080'
|
||||||
|
|
Loading…
Reference in New Issue
Block a user