Skip to content

Commit

Permalink
Remove banks (#138)
Browse files Browse the repository at this point in the history
  • Loading branch information
mfcochauxlaberge authored Jan 26, 2024
1 parent 92c86cc commit fa7317c
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 122 deletions.
4 changes: 0 additions & 4 deletions src/components/MapTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,6 @@ const MapTile: FunctionComponent<props> = ({
src = 'https://icons.arkipel.io/infra/port.svg';
alt = 'Port';
break;
case Infrastructure.Bank:
src = 'https://icons.arkipel.io/infra/bank.svg';
alt = 'Bank';
break;
case Infrastructure.Hut:
src = 'https://icons.arkipel.io/infra/hut.svg';
alt = 'Bank';
Expand Down
54 changes: 0 additions & 54 deletions src/generated/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,6 @@ export type Group = {
export enum Infrastructure {
AnimalFarm = 'ANIMAL_FARM',
Apartments = 'APARTMENTS',
Bank = 'BANK',
Empty = 'EMPTY',
Garden = 'GARDEN',
House = 'HOUSE',
Expand Down Expand Up @@ -1045,14 +1044,6 @@ export type DestroyInfrastructureMutationVariables = Exact<{

export type DestroyInfrastructureMutation = { __typename?: 'Mutation', destroyInfrastructure?: { __typename?: 'NotAuthorized' } | { __typename?: 'Tile', id: string, infrastructure: Infrastructure, level: number, constructionSite?: { __typename?: 'ConstructionSite', finishedAt: any } | null, blueprints: Array<{ __typename?: 'Blueprint', infrastructure: Infrastructure, materialCost: number, workload: number }> } | null };

export type GetBankLevelsQueryVariables = Exact<{
userId: Scalars['String']['input'];
islandId: Scalars['String']['input'];
}>;


export type GetBankLevelsQuery = { __typename?: 'Query', inventory: { __typename: 'Inventory', id: string, bankLevels: number } | { __typename: 'NotAuthorized' } | { __typename: 'NotFound' } };

export type GetMarketPricesQueryVariables = Exact<{
input: MarketPricesInput;
}>;
Expand Down Expand Up @@ -2587,51 +2578,6 @@ export function useDestroyInfrastructureMutation(baseOptions?: Apollo.MutationHo
export type DestroyInfrastructureMutationHookResult = ReturnType<typeof useDestroyInfrastructureMutation>;
export type DestroyInfrastructureMutationResult = Apollo.MutationResult<DestroyInfrastructureMutation>;
export type DestroyInfrastructureMutationOptions = Apollo.BaseMutationOptions<DestroyInfrastructureMutation, DestroyInfrastructureMutationVariables>;
export const GetBankLevelsDocument = gql`
query GetBankLevels($userId: String!, $islandId: String!) {
inventory(userId: $userId, islandId: $islandId) {
__typename
... on Inventory {
id
bankLevels
}
}
}
`;

/**
* __useGetBankLevelsQuery__
*
* To run a query within a React component, call `useGetBankLevelsQuery` and pass it any options that fit your needs.
* When your component renders, `useGetBankLevelsQuery` returns an object from Apollo Client that contains loading, error, and data properties
* you can use to render your UI.
*
* @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;
*
* @example
* const { data, loading, error } = useGetBankLevelsQuery({
* variables: {
* userId: // value for 'userId'
* islandId: // value for 'islandId'
* },
* });
*/
export function useGetBankLevelsQuery(baseOptions: Apollo.QueryHookOptions<GetBankLevelsQuery, GetBankLevelsQueryVariables>) {
const options = {...defaultOptions, ...baseOptions}
return Apollo.useQuery<GetBankLevelsQuery, GetBankLevelsQueryVariables>(GetBankLevelsDocument, options);
}
export function useGetBankLevelsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<GetBankLevelsQuery, GetBankLevelsQueryVariables>) {
const options = {...defaultOptions, ...baseOptions}
return Apollo.useLazyQuery<GetBankLevelsQuery, GetBankLevelsQueryVariables>(GetBankLevelsDocument, options);
}
export function useGetBankLevelsSuspenseQuery(baseOptions?: Apollo.SuspenseQueryHookOptions<GetBankLevelsQuery, GetBankLevelsQueryVariables>) {
const options = {...defaultOptions, ...baseOptions}
return Apollo.useSuspenseQuery<GetBankLevelsQuery, GetBankLevelsQueryVariables>(GetBankLevelsDocument, options);
}
export type GetBankLevelsQueryHookResult = ReturnType<typeof useGetBankLevelsQuery>;
export type GetBankLevelsLazyQueryHookResult = ReturnType<typeof useGetBankLevelsLazyQuery>;
export type GetBankLevelsSuspenseQueryHookResult = ReturnType<typeof useGetBankLevelsSuspenseQuery>;
export type GetBankLevelsQueryResult = Apollo.QueryResult<GetBankLevelsQuery, GetBankLevelsQueryVariables>;
export const GetMarketPricesDocument = gql`
query GetMarketPrices($input: MarketPricesInput!) {
marketPrices(input: $input) {
Expand Down
2 changes: 0 additions & 2 deletions src/models/Inventory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ class Inventory {
this.frozenFoodProduction = obj?.frozenFoodProduction || 0;
this.frozenFood = obj?.frozenFood || 0;
this.frozenFoodStorage = obj?.frozenFoodStorage || 0;
this.bankLevels = obj?.bankLevels || 0;
}

id: string;
Expand All @@ -35,7 +34,6 @@ class Inventory {
frozenFoodProduction: number;
frozenFood: number;
frozenFoodStorage: number;
bankLevels: number;

sinceLastUpdate = (): Duration => {
if (!this.lastUpdate) {
Expand Down
2 changes: 0 additions & 2 deletions src/models/Tile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,6 @@ class Tile {
return 'wind turbine';
case Infrastructure.Port:
return 'port';
case Infrastructure.Bank:
return 'bank';
case Infrastructure.Hut:
return 'hut';
case Infrastructure.Warehouse:
Expand Down
15 changes: 0 additions & 15 deletions src/pages/island/Resources.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,21 +138,6 @@ const ResourcesPage = () => {
</div>
</StatStyle>
</Style>
<h2>Infrastructure</h2>
<Style>
<StatStyle>
<div>
<h3>Banking</h3>
<span>{inventory.bankLevels}</span>
</div>
<div>
<p>
More banking infrastructure gives the island more powerful tools
to trade with the rest of the archipelago.
</p>
</div>
</StatStyle>
</Style>
</Fragment>
);
};
Expand Down
45 changes: 0 additions & 45 deletions src/pages/island/Treasury.tsx
Original file line number Diff line number Diff line change
@@ -1,58 +1,13 @@
import React, { Fragment, useContext } from 'react';

import { useQuery, gql } from '@apollo/client';
import {
GetBankLevelsQuery,
GetBankLevelsQueryVariables,
} from 'generated/graphql';

import { SessionContext } from '../../libs/session/session';
import { BankAccountsContext } from '../../libs/session/bank_accounts';

import { Error } from '../../ui/dialog/Msg';
import { FormatMoney } from '../../ui/text/format';

const TreasuryPage = () => {
const session = useContext(SessionContext);

let islandId = session.id;

const { data, loading, error } = useQuery<
GetBankLevelsQuery,
GetBankLevelsQueryVariables
>(
gql`
query GetBankLevels($userId: String!, $islandId: String!) {
inventory(userId: $userId, islandId: $islandId) {
__typename
... on Inventory {
id
bankLevels
}
}
}
`,
{ variables: { userId: session.id, islandId } },
);

if (loading) {
return <p>Loading...</p>;
}

if (error || data?.inventory.__typename !== 'Inventory') {
return <Error>Sorry, an error occurred.</Error>;
}

let bankLevels = 0;
if (data?.inventory.__typename === 'Inventory') {
bankLevels = data.inventory.bankLevels;
}

return (
<Fragment>
<h1>Treasury</h1>
<p>All of your banks total {bankLevels} levels together.</p>
<h2>Bank accounts</h2>
<BankAccounts />
</Fragment>
);
Expand Down

0 comments on commit fa7317c

Please sign in to comment.