Merge pull request 'Support new feature tables' (#26) from support-new-feature-schema into master
Reviewed-on: billnerds/rn-playground#26 Reviewed-by: Ivan Malison <ivanmalison@gmail.com>
This commit is contained in:
commit
4c1bd21f3d
1
App.tsx
1
App.tsx
@ -6,6 +6,7 @@ import ShotsContainer from "./component/shot";
|
|||||||
const App: React.FC = () => {
|
const App: React.FC = () => {
|
||||||
return (
|
return (
|
||||||
<ClientProvider>
|
<ClientProvider>
|
||||||
|
<ShotsContainer />
|
||||||
<Text>test</Text>
|
<Text>test</Text>
|
||||||
</ClientProvider>
|
</ClientProvider>
|
||||||
);
|
);
|
||||||
|
@ -7,8 +7,6 @@ import {
|
|||||||
from,
|
from,
|
||||||
} from "@apollo/client";
|
} from "@apollo/client";
|
||||||
import { API_URI } from "@env";
|
import { API_URI } from "@env";
|
||||||
import { SHOT_FEATURES_FRAGMENT } from "./fragment/shot";
|
|
||||||
import { createFragmentRegistry } from "@apollo/client/cache";
|
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
children: ReactNode;
|
children: ReactNode;
|
||||||
@ -18,9 +16,7 @@ const ClientProvider: React.FC<Props> = ({ children }) => {
|
|||||||
const httpLink = new HttpLink({
|
const httpLink = new HttpLink({
|
||||||
uri: API_URI,
|
uri: API_URI,
|
||||||
});
|
});
|
||||||
const cache = new InMemoryCache({
|
const cache = new InMemoryCache({});
|
||||||
fragments: createFragmentRegistry(SHOT_FEATURES_FRAGMENT),
|
|
||||||
});
|
|
||||||
|
|
||||||
const client = new ApolloClient({
|
const client = new ApolloClient({
|
||||||
link: from([httpLink]),
|
link: from([httpLink]),
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
import { gql } from "@apollo/client";
|
|
||||||
|
|
||||||
export const SHOT_FEATURES_FRAGMENT = gql`
|
|
||||||
fragment ShotFeatures on ShotFeaturesGQL {
|
|
||||||
cueObjectDistance @include(if: $includeCueObjectDistance)
|
|
||||||
targetPocketDistance @include(if: $includeTargetPocketDistance)
|
|
||||||
cueObjectAngle @include(if: $includeCueObjectAngle)
|
|
||||||
cueBallSpeed @include(if: $includeCueBallSpeed)
|
|
||||||
intendedPocket @include(if: $includeIntendedPocket)
|
|
||||||
shotDirection @include(if: $includeShotDirection)
|
|
||||||
didMake @include(if: $includeDidMake)
|
|
||||||
}
|
|
||||||
`;
|
|
@ -4,12 +4,12 @@ export const GET_SHOTS = gql`
|
|||||||
query GetShots(
|
query GetShots(
|
||||||
$filterInput: FilterInput
|
$filterInput: FilterInput
|
||||||
$includeCueObjectDistance: Boolean! = false
|
$includeCueObjectDistance: Boolean! = false
|
||||||
$includeTargetPocketDistance: Boolean! = false
|
|
||||||
$includeCueObjectAngle: Boolean! = false
|
$includeCueObjectAngle: Boolean! = false
|
||||||
$includeCueBallSpeed: Boolean! = false
|
$includeCueBallSpeed: Boolean! = false
|
||||||
$includeIntendedPocket: Boolean! = false
|
|
||||||
$includeShotDirection: Boolean! = false
|
$includeShotDirection: Boolean! = false
|
||||||
$includeDidMake: Boolean! = false
|
$includeTargetPocketDistance: Boolean! = false
|
||||||
|
$includeMake: Boolean! = false
|
||||||
|
$includeIntendedPocketType: Boolean! = false
|
||||||
) {
|
) {
|
||||||
getShots(filterInput: $filterInput) {
|
getShots(filterInput: $filterInput) {
|
||||||
id
|
id
|
||||||
@ -18,8 +18,16 @@ export const GET_SHOTS = gql`
|
|||||||
endFrame
|
endFrame
|
||||||
createdAt
|
createdAt
|
||||||
updatedAt
|
updatedAt
|
||||||
features {
|
cueObjectFeatures {
|
||||||
...ShotFeatures
|
cueObjectDistance @include(if: $includeCueObjectDistance)
|
||||||
|
cueObjectAngle @include(if: $includeCueObjectAngle)
|
||||||
|
cueBallSpeed @include(if: $includeCueBallSpeed)
|
||||||
|
shotDirection @include(if: $includeShotDirection)
|
||||||
|
}
|
||||||
|
pocketingIntentionFeatures {
|
||||||
|
targetPocketDistance @include(if: $includeTargetPocketDistance)
|
||||||
|
make @include(if: $includeMake)
|
||||||
|
intendedPocketType @include(if: $includeIntendedPocketType)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user