Skip to content

Commit

Permalink
Merge master and fix conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
brianlovin committed Jan 25, 2018
2 parents a873c04 + 9bef49d commit dda7ecf
Show file tree
Hide file tree
Showing 73 changed files with 8,717 additions and 17,945 deletions.
10,458 changes: 0 additions & 10,458 deletions admin/package-lock.json

This file was deleted.

32 changes: 26 additions & 6 deletions admin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
"version": "0.1.0",
"private": true,
"devDependencies": {
"add": "^2.0.6",
"flow-bin": "^0.57.3",
"react-scripts": "1.0.13",
"recompose": "^0.23.4",
"styled-components": "^2.1.2"
"react-scripts": "1.1.0",
"recompose": "^0.26.0",
"styled-components": "^3.0.1",
"yarn": "^1.3.2"
},
"dependencies": {
"@vx/curve": "^0.0.127",
Expand All @@ -16,12 +18,30 @@
"@vx/scale": "^0.0.127",
"@vx/shape": "^0.0.131",
"@vx/tooltip": "^0.0.134",
"apollo-cache-inmemory": "^1.1.5",
"apollo-client": "2.x",
"apollo-engine": "^0.8.3",
"apollo-link": "^1.0.7",
"apollo-link-http": "^1.3.2",
"apollo-link-ws": "^1.0.4",
"apollo-upload-client": "6.x",
"apollo-upload-server": "^2.0.4",
"apollo-utilities": "^1.0.4",
"d3-array": "^1.2.0",
"react": "^15.5.4",
"react-dom": "^15.5.4",
"graphql": "^0.12.3",
"graphql-tag": "^2.6.1",
"moment": "^2.20.1",
"react": "16.x",
"react-apollo": "2.x",
"react-dom": "16.x",
"react-redux": "^5.0.5",
"react-router": "^4.1.1",
"recharts": "^1.0.0-alpha.6"
"react-router-dom": "^4.2.2",
"react-trend": "^1.2.4",
"recharts": "^1.0.0-alpha.6",
"redux": "^3.6.0",
"redux-thunk": "^2.2.0",
"subscriptions-transport-ws": "^0.9.5"
},
"scripts": {
"start": "react-scripts start",
Expand Down
64 changes: 64 additions & 0 deletions admin/src/api/apollo-options.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
var apollo = require('apollo-utilities'),
toIdValue = apollo.toIdValue;

function dataIdFromObject(result) {
if (result.__typename) {
// Custom Community cache key based on slug
if (result.__typename === 'Community' && !!result.slug) {
return result.__typename + ':' + result.slug;
}
// Custom Channel cache key based on slug and community slug
if (
result.__typename === 'Channel' &&
!!result.slug &&
!!result.community &&
!!result.community.slug
) {
return (
result.__typename + ':' + result.community.slug + ':' + result.slug
);
}
// This was copied from the default dataIdFromObject
if (result.id !== undefined) {
return result.__typename + ':' + result.id;
}
if (result._id !== undefined) {
return result.__typename + ':' + result._id;
}
}
return null;
}

var getSharedApolloClientOptions = function getSharedApolloClientOptions() {
return {
queryDeduplication: true,
dataIdFromObject: dataIdFromObject,
customResolvers: {
Query: {
thread: function thread(_, _ref) {
var id = _ref.id;
return toIdValue(dataIdFromObject({ __typename: 'Thread', id: id }));
},
community: function community(_, _ref2) {
var slug = _ref2.slug;
return toIdValue(
dataIdFromObject({ __typename: 'Community', slug: slug })
);
},
channel: function channel(_, _ref3) {
var channelSlug = _ref3.channelSlug,
communitySlug = _ref3.communitySlug;
return toIdValue(
dataIdFromObject({
__typename: 'Channel',
slug: channelSlug,
community: { slug: communitySlug },
})
);
},
},
},
};
};

module.exports = getSharedApolloClientOptions;
32 changes: 13 additions & 19 deletions admin/src/api/community.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { graphql, gql } from 'react-apollo';
import gql from 'graphql-tag';
import { graphql } from 'react-apollo';
import { communityInfoFragment } from './fragments/community/communityInfo';
import { communityMemberConnectionFragment } from './fragments/community/communityMembers';
import { userInfoFragment } from './fragments/user/userInfo';

const COMMUNITY_INFORMATION_QUERY = gql`
query {
Expand Down Expand Up @@ -36,33 +39,24 @@ export const getCommunityBySlug = graphql(
GET_COMMUNITY_BY_SLUG_OPTIONS
);

/*
Gets top communities for the onboarding flow.
*/
export const topCommunitiesQuery = graphql(
gql`
{
topCommunities {
...communityInfo
}
}
${communityInfoFragment}
`,
{
name: 'top',
}
);

export const recentCommunitiesQuery = graphql(
gql`
{
query recentCommunities($filter: MemberConnectionFilter) {
recentCommunities {
...communityInfo
...communityMembers
}
}
${communityInfoFragment}
${communityMemberConnectionFragment}
`,
{
name: 'recent',
options: () => ({
variables: {
filter: { isOwner: true, isMember: true },
},
fetchPolicy: 'cache-and-network',
}),
}
);
2 changes: 1 addition & 1 deletion admin/src/api/fragments/channel/channelInfo.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { gql } from 'react-apollo';
import gql from 'graphql-tag';
import { communityInfoFragment } from '../community/communityInfo';

export const channelInfoFragment = gql`
Expand Down
2 changes: 1 addition & 1 deletion admin/src/api/fragments/channel/channelMetaData.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { gql } from 'react-apollo';
import gql from 'graphql-tag';

export const channelMetaDataFragment = gql`
fragment channelMetaData on Channel {
Expand Down
2 changes: 1 addition & 1 deletion admin/src/api/fragments/channel/channelSubscribers.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { gql } from 'react-apollo';
import gql from 'graphql-tag';
import { userInfoFragment } from '../user/userInfo';

export const channelMembersFragment = gql`
Expand Down
2 changes: 1 addition & 1 deletion admin/src/api/fragments/channel/channelThreads.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { gql } from 'react-apollo';
import gql from 'graphql-tag';
import { threadInfoFragment } from '../thread/threadInfo';

export const channelThreadsFragment = gql`
Expand Down
6 changes: 1 addition & 5 deletions admin/src/api/fragments/community/communityInfo.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,22 @@
import { gql } from 'react-apollo';
import gql from 'graphql-tag';

export const communityInfoFragment = gql`
fragment communityInfo on Community {
# admin
id
createdAt
# meta
name
slug
description
website
profilePhoto
coverPhoto
# roles
communityPermissions {
isMember
isBlocked
isOwner
isModerator
receiveNotifications
}
# counts
metaData {
members
channels
Expand Down
8 changes: 5 additions & 3 deletions admin/src/api/fragments/community/communityMembers.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import { gql } from 'react-apollo';
import gql from 'graphql-tag';
import { userInfoFragment } from '../user/userInfo';

export const communityMembersFragment = gql`
export const communityMemberConnectionFragment = gql`
fragment communityMembers on Community {
memberConnection {
memberConnection(filter: $filter) {
pageInfo {
hasNextPage
hasPreviousPage
}
edges {
node {
...userInfo
isPro
email
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion admin/src/api/fragments/community/communityMetaData.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { gql } from 'react-apollo';
import gql from 'graphql-tag';

export const communityMetaDataFragment = gql`
fragment communityMetaData on Community {
Expand Down
2 changes: 1 addition & 1 deletion admin/src/api/fragments/community/communityThreads.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { gql } from 'react-apollo';
import gql from 'graphql-tag';
import { threadInfoFragment } from '../thread/threadInfo';

export const communityThreadsFragment = gql`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { gql } from 'react-apollo';
import gql from 'graphql-tag';

export const directMessageThreadInfoFragment = gql`
fragment directMessageThreadInfo on DirectMessageThread {
Expand Down
3 changes: 1 addition & 2 deletions admin/src/api/fragments/message/messageInfo.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// @flow
// $FlowFixMe
import { gql } from 'react-apollo';
import gql from 'graphql-tag';
import { userInfoFragment } from '../user/userInfo';

export const messageInfoFragment = gql`
Expand Down
3 changes: 1 addition & 2 deletions admin/src/api/fragments/notification/notificationInfo.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// @flow
// $FlowFixMe
import { gql } from 'react-apollo';
import gql from 'graphql-tag';

export const notificationInfoFragment = gql`
fragment notificationInfo on Notification {
Expand Down
3 changes: 1 addition & 2 deletions admin/src/api/fragments/reaction/reactionInfo.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// @flow
// $FlowFixMe
import { gql } from 'react-apollo';
import gql from 'graphql-tag';

export const reactionInfoFragment = gql`
fragment reactionInfo on Reaction {
Expand Down
4 changes: 2 additions & 2 deletions admin/src/api/fragments/thread/threadInfo.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { gql } from 'react-apollo';
import gql from 'graphql-tag';
import { userInfoFragment } from '../user/userInfo';

export const threadInfoFragment = gql`
Expand Down Expand Up @@ -26,7 +26,7 @@ export const threadInfoFragment = gql`
isPublished
isLocked
isCreator
type
type
participants {
...userInfo
}
Expand Down
3 changes: 1 addition & 2 deletions admin/src/api/fragments/thread/threadMessages.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// @flow
// $FlowFixMe
import { gql } from 'react-apollo';
import gql from 'graphql-tag';
import { messageInfoFragment } from '../message/messageInfo';

export const threadMessagesFragment = gql`
Expand Down
2 changes: 1 addition & 1 deletion admin/src/api/fragments/user/userCommunities.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { gql } from 'react-apollo';
import gql from 'graphql-tag';
import { communityInfoFragment } from '../community/communityInfo';

export const userCommunitiesFragment = gql`
Expand Down
3 changes: 1 addition & 2 deletions admin/src/api/fragments/user/userDirectMessageThreads.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// @flow
// $FlowFixme
import { gql } from 'react-apollo';
import gql from 'graphql-tag';
import { directMessageThreadInfoFragment } from '../directMessageThread/directMessageThreadInfo';

export const userDirectMessageThreadsFragment = gql`
Expand Down
6 changes: 2 additions & 4 deletions admin/src/api/fragments/user/userEverything.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { gql } from 'react-apollo';
import gql from 'graphql-tag';
import { threadInfoFragment } from '../thread/threadInfo';
// import { channelInfoFragment } from '../channel/channelInfo';
// import { communityInfoFragment } from '../community/communityInfo';

export const userEverythingFragment = gql`
fragment userEverything on User {
everything(first: 10, after: $after){
everything(first: 10, after: $after) {
pageInfo {
hasNextPage
hasPreviousPage
Expand Down
2 changes: 1 addition & 1 deletion admin/src/api/fragments/user/userFrequencies.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { gql } from 'react-apollo';
import gql from 'graphql-tag';
import { channelInfoFragment } from '../channel/channelInfo';

export const userChannelsFragment = gql`
Expand Down
2 changes: 1 addition & 1 deletion admin/src/api/fragments/user/userInfo.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { gql } from 'react-apollo';
import gql from 'graphql-tag';

export const userInfoFragment = gql`
fragment userInfo on User {
Expand Down
2 changes: 1 addition & 1 deletion admin/src/api/fragments/user/userThreads.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { gql } from 'react-apollo';
import gql from 'graphql-tag';
import { threadInfoFragment } from '../thread/threadInfo';

export const userThreadsFragment = gql`
Expand Down
Loading

0 comments on commit dda7ecf

Please sign in to comment.