forked from withspectrum/spectrum
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a0564b4
commit a0bf364
Showing
17 changed files
with
288 additions
and
249 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,3 +25,4 @@ test-extend.js | |
stats.json | ||
iris/.env | ||
.expo | ||
mobile/.expo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
{ | ||
"expoServerPort": 19000, | ||
"packagerPort": 19001, | ||
"packagerPid": 889, | ||
"expoServerNgrokUrl": "https://ph-tqm.brianlovin.mobile.exp.direct", | ||
"packagerNgrokUrl": "https://packager.ph-tqm.brianlovin.mobile.exp.direct", | ||
"ngrokPid": 913 | ||
"expoServerPort": null, | ||
"packagerPort": null, | ||
"packagerPid": null, | ||
"expoServerNgrokUrl": null, | ||
"packagerNgrokUrl": null, | ||
"ngrokPid": null | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
// @flow | ||
import { graphql } from 'react-apollo'; | ||
import gql from 'graphql-tag'; | ||
import channelInfoFragment from 'shared/graphql/fragments/channel/channelInfo'; | ||
import channelMetaDataFragment from 'shared/graphql/fragments/channel/channelMetaData'; | ||
|
||
const getChannelByIdQuery = gql` | ||
query getChannel($id: ID) { | ||
channel(id: $id) { | ||
...channelInfo | ||
...channelMetaData | ||
} | ||
} | ||
${channelInfoFragment} | ||
${channelMetaDataFragment} | ||
`; | ||
|
||
const getChannelByIdOptions = { | ||
options: ({ id }) => ({ | ||
variables: { | ||
id, | ||
}, | ||
}), | ||
}; | ||
|
||
export const getChannelById = graphql( | ||
getChannelByIdQuery, | ||
getChannelByIdOptions | ||
); | ||
|
||
/* | ||
Alternative implementation that takes a channel slug and community slug | ||
to perform a lookup | ||
Used to check for duplicate channel names during channel creation, and can | ||
be used as a way to get a channel based on url params. | ||
*/ | ||
const getChannelBySlugAndCommunitySlugQuery = gql` | ||
query getChannel($channelSlug: String, $communitySlug: String) { | ||
channel(channelSlug: $channelSlug, communitySlug: $communitySlug) { | ||
...channelInfo | ||
...channelMetaData | ||
} | ||
} | ||
${channelInfoFragment} | ||
${channelMetaDataFragment} | ||
`; | ||
|
||
const getChannelBySlugAndCommunitySlugOptions = { | ||
options: ({ channelSlug, communitySlug }) => ({ | ||
variables: { | ||
channelSlug: channelSlug.toLowerCase(), | ||
communitySlug: communitySlug.toLowerCase(), | ||
}, | ||
}), | ||
}; | ||
|
||
export const getChannelBySlugAndCommunitySlug = graphql( | ||
getChannelBySlugAndCommunitySlugQuery, | ||
getChannelBySlugAndCommunitySlugOptions | ||
); | ||
|
||
const getChannelByMatchOptions = { | ||
options: ({ match: { params: { channelSlug, communitySlug } } }) => ({ | ||
variables: { | ||
channelSlug: channelSlug.toLowerCase(), | ||
communitySlug: communitySlug.toLowerCase(), | ||
}, | ||
}), | ||
}; | ||
|
||
export const getChannelByMatch = graphql( | ||
getChannelBySlugAndCommunitySlugQuery, | ||
getChannelByMatchOptions | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// @flow | ||
import { graphql } from 'react-apollo'; | ||
import gql from 'graphql-tag'; | ||
import userInfoFragment from 'shared/graphql/fragments/user/userInfo'; | ||
import communityInfoFragment from 'shared/graphql/fragments/community/communityInfo'; | ||
import channelInfoFragment from 'shared/graphql/fragments/channel/channelInfo'; | ||
|
||
export const getChannelBlockedUsersQuery = gql` | ||
query getChannelBlockedUsers($id: ID) { | ||
channel(id: $id) { | ||
...channelInfo | ||
blockedUsers { | ||
...userInfo | ||
} | ||
} | ||
} | ||
${userInfoFragment} | ||
${communityInfoFragment} | ||
${channelInfoFragment} | ||
`; | ||
|
||
const getChannelBlockedUsersOptions = { | ||
options: ({ id }) => ({ | ||
variables: { | ||
id, | ||
}, | ||
fetchPolicy: 'cache-and-network', | ||
}), | ||
}; | ||
|
||
export default graphql( | ||
getChannelBlockedUsersQuery, | ||
getChannelBlockedUsersOptions | ||
); |
91 changes: 91 additions & 0 deletions
91
shared/graphql/queries/channel/getChannelMemberConnection.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
// @flow | ||
import { graphql } from 'react-apollo'; | ||
import gql from 'graphql-tag'; | ||
import channelInfoFragment from 'shared/graphql/fragments/channel/channelInfo'; | ||
import channelMetaDataFragment from 'shared/graphql/fragments/channel/channelMetaData'; | ||
import channelMemberConnectionFragment from 'shared/graphql/fragments/channel/channelMemberConnection'; | ||
|
||
const getChannelMemberConnectionQuery = gql` | ||
query getChannelMemberConnection($id: ID, $after: String) { | ||
channel(id: $id) { | ||
...channelInfo | ||
...channelMetaData | ||
...channelMemberConnection | ||
} | ||
} | ||
${channelInfoFragment} | ||
${channelMetaDataFragment} | ||
${channelMemberConnectionFragment} | ||
`; | ||
|
||
const LoadMoreMembers = gql` | ||
query loadMoreChannelMembers($id: ID, $after: String) { | ||
channel(id: $id) { | ||
...channelInfo | ||
...channelMetaData | ||
...channelMemberConnection | ||
} | ||
} | ||
${channelInfoFragment} | ||
${channelMetaDataFragment} | ||
${channelMemberConnectionFragment} | ||
`; | ||
|
||
const getChannelMemberConnectionOptions = { | ||
props: ({ data: { fetchMore, error, loading, channel, networkStatus } }) => ({ | ||
data: { | ||
error, | ||
loading, | ||
channel, | ||
networkStatus: networkStatus, | ||
hasNextPage: channel | ||
? channel.memberConnection.pageInfo.hasNextPage | ||
: false, | ||
fetchMore: () => | ||
fetchMore({ | ||
query: LoadMoreMembers, | ||
variables: { | ||
id: channel.id, | ||
after: | ||
channel.memberConnection.edges[ | ||
channel.memberConnection.edges.length - 1 | ||
].cursor, | ||
}, | ||
updateQuery: (prev, { fetchMoreResult }) => { | ||
if (!fetchMoreResult.channel) { | ||
return prev; | ||
} | ||
|
||
return { | ||
...prev, | ||
channel: { | ||
...prev.channel, | ||
memberConnection: { | ||
...prev.channel.memberConnection, | ||
pageInfo: { | ||
...prev.channel.memberConnection.pageInfo, | ||
...fetchMoreResult.channel.memberConnection.pageInfo, | ||
}, | ||
edges: [ | ||
...prev.channel.memberConnection.edges, | ||
...fetchMoreResult.channel.memberConnection.edges, | ||
], | ||
}, | ||
}, | ||
}; | ||
}, | ||
}), | ||
}, | ||
}), | ||
options: ({ id }) => ({ | ||
variables: { | ||
id, | ||
}, | ||
fetchPolicy: 'cache-and-network', | ||
}), | ||
}; | ||
|
||
export default graphql( | ||
getChannelMemberConnectionQuery, | ||
getChannelMemberConnectionOptions | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// @flow | ||
import { graphql } from 'react-apollo'; | ||
import gql from 'graphql-tag'; | ||
import userInfoFragment from 'shared/graphql/fragments/user/userInfo'; | ||
import channelInfoFragment from 'shared/graphql/fragments/channel/channelInfo'; | ||
|
||
const getChannelPendingUsersQuery = gql` | ||
query getChannelPendingUsers($id: ID) { | ||
channel(id: $id) { | ||
...channelInfo | ||
pendingUsers { | ||
...userInfo | ||
} | ||
} | ||
} | ||
${userInfoFragment} | ||
${channelInfoFragment} | ||
`; | ||
|
||
const getChannelPendingUsersOptions = { | ||
options: ({ id }) => ({ | ||
variables: { | ||
id, | ||
}, | ||
fetchPolicy: 'cache-and-network', | ||
}), | ||
}; | ||
|
||
export default graphql( | ||
getChannelPendingUsersQuery, | ||
getChannelPendingUsersOptions | ||
); |
Oops, something went wrong.