Skip to content

Commit

Permalink
feat: Following Screens (#2507)
Browse files Browse the repository at this point in the history
* Updated TableView

* Updated the UI of the TableView to more closely match the UIKit 2.0 mocks in Figma
* Included a new `Row` component for conveniently configuring a table with props instead of Component imports (not required, just an additive change)
* Stories for both "Custom" and "Basic" table

* TableView linter errors

* Upgrade Profile TableViews

* Update the default styling of the Avatar Icon

* Connected campus name and like count to real user data

* Liked Content empty state

* Check In

* check in

* check in

* rename queries

* resolve lint errors

* resolve tests

* updated snaps

* Remove the lint:fix script

* start adding snapshots

* add snaps

* dep updates

* font sizes converted to rem helper

* Update @apollo/client version across all packages

* Update slides.tests.js.snap

* updated template yarn lock

Co-authored-by: Vincent Wilson <vince@classyh.at>
Co-authored-by: Michael Neeley <micneeley14@gmail.com>
  • Loading branch information
3 people committed Jun 28, 2022
1 parent f2a6a32 commit ffccb48
Show file tree
Hide file tree
Showing 78 changed files with 5,217 additions and 282 deletions.
2 changes: 1 addition & 1 deletion ApollosStorybook/package.json
Expand Up @@ -15,7 +15,7 @@
"build-storybook": "build-storybook"
},
"dependencies": {
"@apollo/client": "3.3.20",
"@apollo/client": "3.6.5",
"@apollo/react-hooks": "^3.1.3",
"@apollosproject/config": "link:../packages/apollos-config",
"@apollosproject/react-native-airplay-btn": "0.2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/apollos-ui-analytics/package.json
Expand Up @@ -52,7 +52,7 @@
"react-native-device-info": "^4.0.1"
},
"devDependencies": {
"@apollo/client": "3.3.20",
"@apollo/client": "3.6.5",
"jest": "^25.1.0",
"jest-fetch-mock": "^2.1.2",
"prop-types": "15.7.2",
Expand Down
Expand Up @@ -25,7 +25,6 @@ Array [
"/graphql",
Object {
"body": "{\\"operationName\\":\\"identify\\",\\"variables\\":{\\"input\\":{\\"anonymousId\\":\\"id-123\\",\\"deviceInfo\\":{\\"platform\\":\\"iOS\\",\\"deviceId\\":\\"id-123\\",\\"deviceModel\\":\\"ios\\",\\"osVersion\\":\\"sys-version-123\\",\\"appVersion\\":\\"version-123\\"}}},\\"query\\":\\"mutation identify($input: AnalyticsIdentifyInput!) {\\\\n identifySelf(input: $input) {\\\\n success\\\\n __typename\\\\n }\\\\n}\\"}",
"credentials": undefined,
"headers": Object {
"accept": "*/*",
"content-type": "application/json",
Expand All @@ -48,7 +47,6 @@ Array [
"/graphql",
Object {
"body": "{\\"operationName\\":\\"track\\",\\"variables\\":{\\"input\\":{\\"anonymousId\\":\\"id-123\\",\\"deviceInfo\\":{\\"platform\\":\\"iOS\\",\\"deviceId\\":\\"id-123\\",\\"deviceModel\\":\\"ios\\",\\"osVersion\\":\\"sys-version-123\\",\\"appVersion\\":\\"version-123\\"},\\"eventName\\":\\"TrackSomething\\",\\"properties\\":[{\\"field\\":\\"ContentId\\",\\"value\\":\\"Content:123\\"}]}},\\"query\\":\\"mutation track($input: AnalyticsTrackInput!) {\\\\n trackEvent(input: $input) {\\\\n success\\\\n __typename\\\\n }\\\\n}\\"}",
"credentials": undefined,
"headers": Object {
"accept": "*/*",
"content-type": "application/json",
Expand Down
2 changes: 1 addition & 1 deletion packages/apollos-ui-authentication/package.json
Expand Up @@ -64,7 +64,7 @@
"yup": "^0.27.0"
},
"devDependencies": {
"@apollo/client": "3.3.20",
"@apollo/client": "3.6.5",
"@apollosproject/ui-test-utils": "^3.9.0",
"@react-native-community/async-storage": "^1.5.1",
"@react-navigation/native": "^5.9.3",
Expand Down
6 changes: 5 additions & 1 deletion packages/apollos-ui-connected/package.json
Expand Up @@ -56,6 +56,7 @@
"@react-navigation/compat": "*",
"@react-navigation/native": "*",
"@react-navigation/stack": "*",
"moment": "^2.29.1",
"react": "*",
"react-native": "*",
"react-native-gesture-handler": "*",
Expand All @@ -66,11 +67,13 @@
"dependencies": {
"@gorhom/bottom-sheet": "3.4.1",
"@react-navigation/bottom-tabs": "^5.11.8",
"@react-navigation/material-top-tabs": "^6.2.1",
"apollo-upload-client": "^17.0.0",
"graphql": "^16.3.0",
"graphql-tag": "2.9.2",
"lodash": "^4.17.11",
"moment": "^2.29.1"
"react-native-pager-view": "^5.4.22",
"react-native-tab-view": "^3.1.1"
},
"devDependencies": {
"@apollosproject/ui-test-utils": "^3.9.0",
Expand All @@ -79,6 +82,7 @@
"@react-navigation/native": "^5.9.3",
"@react-navigation/stack": "^5.14.3",
"jest": "^25.1.0",
"moment": "^2.29.1",
"prop-types": "15.7.2",
"react": "16.13.1",
"react-native": "0.63.2",
Expand Down
Expand Up @@ -45,12 +45,12 @@ exports[`The ActionTableFeatureConnected component should render 1`] = `
style={
Object {
"backgroundColor": "#FFFFFF",
"borderBottomWidth": 0.5,
"borderColor": "rgba(0, 0, 0, 0.09999999999999998)",
"borderLeftWidth": 0,
"borderRadius": 16,
"borderRightWidth": 0,
"borderTopWidth": 0.5,
"marginBottom": 16,
"marginHorizontal": 16,
"overflow": "hidden",
}
}
>
Expand All @@ -59,6 +59,7 @@ exports[`The ActionTableFeatureConnected component should render 1`] = `
Object {
"backgroundColor": "rgba(0, 0, 0, 0.09999999999999998)",
"height": 0.5,
"marginLeft": 16,
}
}
/>
Expand Down Expand Up @@ -86,19 +87,17 @@ exports[`The ActionTableFeatureConnected component should render 1`] = `
"flexDirection": "row",
"justifyContent": "flex-start",
"minHeight": 40,
"padding": 8,
"paddingLeft": 16,
"paddingHorizontal": 16,
"paddingVertical": 12,
}
}
>
<Text
style={
Object {
"color": "#27272E",
"flexGrow": 1,
"flexShrink": 1,
"fontFamily": "System",
"fontSize": 14,
"fontSize": 17,
"fontStyle": null,
"fontWeight": null,
"lineHeight": 21,
Expand All @@ -111,15 +110,15 @@ exports[`The ActionTableFeatureConnected component should render 1`] = `
</Text>
<RNSVGSvgView
align="xMidYMid"
bbHeight={20}
bbWidth={20}
bbHeight={28}
bbWidth={28}
color="#27272E"
height={20}
height={28}
id="Raw"
meetOrSlice={0}
minX={0}
minY={0}
size={20}
size={28}
style={
Array [
Object {
Expand All @@ -130,15 +129,15 @@ exports[`The ActionTableFeatureConnected component should render 1`] = `
null,
Object {
"flex": 0,
"height": 20,
"width": 20,
"height": 28,
"width": 28,
},
]
}
tintColor="#27272E"
vbHeight={256}
vbWidth={256}
width={20}
width={28}
>
<RNSVGGroup
fill={
Expand Down
Expand Up @@ -3,13 +3,51 @@ import PropTypes from 'prop-types';
import { Query } from '@apollo/client/react/components';
import { get } from 'lodash';

import { BackgroundView, FeedView } from '@apollosproject/ui-kit';
import { View } from 'react-native';
import {
UIText,
BackgroundView,
FeedView,
Icon,
styled,
withTheme,
} from '@apollosproject/ui-kit';

import fetchMoreResolver from '../utils/fetchMoreResolver';
import ContentCardConnected from '../ContentCardConnected';

import GET_LIKED_CONTENT from './getLikedContent';

const ListEmptyContainer = styled(() => ({
display: 'flex',
flex: 1,
height: 500,
flexDirection: 'column',
justifyContent: 'center',
alignItems: 'center',
}))(View);

const ListEmptyText = withTheme(({ theme }) => ({
bold: true,
style: {
color: theme.colors.text.tertiary,
paddingTop: theme.sizing.baseUnit * 0.5,
},
}))(UIText);

const ListEmptyIcon = withTheme(({ theme }) => ({
size: 42,
name: 'heart',
fill: theme.colors.text.tertiary,
}))(Icon);

const ListEmptyComponent = () => (
<ListEmptyContainer>
<ListEmptyIcon />
<ListEmptyText>"Like" an item to see it here</ListEmptyText>
</ListEmptyContainer>
);

/** A FeedView wrapped in a query to pull content data. */
class LikedContentFeedConnected extends PureComponent {
static propTypes = {
Expand Down Expand Up @@ -69,6 +107,7 @@ class LikedContentFeedConnected extends PureComponent {
{({ loading, error, data, refetch, fetchMore, variables }) => (
<Component
ListItemComponent={ContentCardComponent}
ListEmptyComponent={<ListEmptyComponent />}
content={this.getContent(data)}
isLoading={loading}
error={error}
Expand Down
Expand Up @@ -19,6 +19,7 @@ exports[`LikedContentFeedConnected component renders LikedContentFeedConnected 1
}
>
<RCTScrollView
ListEmptyComponent={<ListEmptyComponent />}
data={
Array [
Object {
Expand Down
Expand Up @@ -35,7 +35,6 @@ describe('NodeFeaturesConnected', () => {
<NodeFeaturesConnected nodeId={'WeekendContentItem:123'} />
</Providers>
);
await new Promise((res) => setTimeout(res, 5));
expect(tree).toMatchSnapshot();
});
});
@@ -0,0 +1,52 @@
import React from 'react';
import PropTypes from 'prop-types';

import useFollowPerson from '../hooks/useFollowPerson';
import useAcceptFollowRequest from '../hooks/useAcceptFollowRequest';

import { Button, H6, useTheme } from '@apollosproject/ui-kit';
import { ListItemStyles } from '../PersonFollowingConnected.styles';

const ConfirmButton = ({ personId, onCompleted }) => {
const theme = useTheme();
const { isFollowingCurrentUser } = useFollowPerson(personId);
const [
acceptFollowRequest,
{ loading: mutationLoading },
] = useAcceptFollowRequest(personId);
const disabled = mutationLoading;

return (
<Button
style={ListItemStyles.button(theme)}
pill={false}
type="primary"
onPress={async () => {
await acceptFollowRequest({
// use this to immediately offer a follow-up action and avoid complex loading states on buttons
optimisticResponse: {
acceptFollowRequest: {
...isFollowingCurrentUser,
state: 'ACCEPTED',
},
},
});
onCompleted();
}}
disabled={disabled}
>
<H6>{'Confirm'}</H6>
</Button>
);
};

ConfirmButton.propTypes = {
personId: PropTypes.string.isRequired,
onCompleted: PropTypes.func,
};

ConfirmButton.defaultProps = {
onCompleted: () => null,
};

export default ConfirmButton;
@@ -0,0 +1,42 @@
/**
* FollowListImage.js
*
* Avatar of a person that sits to the left of the FollowListItem
*/

import React from 'react';
import PropTypes from 'prop-types';

import { ListItemStyles } from '../PersonFollowingConnected.styles';

import {
Avatar,
ImageSourceType,
withIsLoading,
useTheme,
} from '@apollosproject/ui-kit';

const FollowListImage = ({ profile }) => {
const theme = useTheme();
const themeSize = theme.sizing.baseUnit * 4;

return (
<Avatar
size="small"
profile={profile}
themeSize={themeSize}
containerStyle={ListItemStyles.avatar}
/>
);
};

FollowListImage.propTypes = {
isLoading: PropTypes.bool,
profile: PropTypes.shape({
firstName: PropTypes.string,
lastName: PropTypes.string,
photo: ImageSourceType,
}),
};

export default withIsLoading(FollowListImage);

0 comments on commit ffccb48

Please sign in to comment.