Support new feature tables

This commit is contained in:
Kat Huang 2024-01-14 17:38:08 -07:00
parent afb2ef21f5
commit abfc6c4c47
4 changed files with 15 additions and 23 deletions

View File

@ -6,6 +6,7 @@ import ShotsContainer from "./component/shot";
const App: React.FC = () => {
return (
<ClientProvider>
<ShotsContainer />
<Text>test</Text>
</ClientProvider>
);

View File

@ -7,8 +7,6 @@ import {
from,
} from "@apollo/client";
import { API_URI } from "@env";
import { SHOT_FEATURES_FRAGMENT } from "./fragment/shot";
import { createFragmentRegistry } from "@apollo/client/cache";
type Props = {
children: ReactNode;
@ -18,9 +16,7 @@ const ClientProvider: React.FC<Props> = ({ children }) => {
const httpLink = new HttpLink({
uri: API_URI,
});
const cache = new InMemoryCache({
fragments: createFragmentRegistry(SHOT_FEATURES_FRAGMENT),
});
const cache = new InMemoryCache({});
const client = new ApolloClient({
link: from([httpLink]),

View File

@ -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)
}
`;

View File

@ -4,12 +4,12 @@ export const GET_SHOTS = gql`
query GetShots(
$filterInput: FilterInput
$includeCueObjectDistance: Boolean! = false
$includeTargetPocketDistance: Boolean! = false
$includeCueObjectAngle: Boolean! = false
$includeCueBallSpeed: Boolean! = false
$includeIntendedPocket: Boolean! = false
$includeShotDirection: Boolean! = false
$includeDidMake: Boolean! = false
$includeTargetPocketDistance: Boolean! = false
$includeMake: Boolean! = false
$includeIntendedPocketType: Boolean! = false
) {
getShots(filterInput: $filterInput) {
id
@ -18,8 +18,16 @@ export const GET_SHOTS = gql`
endFrame
createdAt
updatedAt
features {
...ShotFeatures
cueObjectFeatures {
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)
}
}
}