Skip to content

Commit

Permalink
Merge pull request #276 from DAOmasons/v1.5
Browse files Browse the repository at this point in the history
V1.5
  • Loading branch information
jordanlesich authored Aug 6, 2024
2 parents 63be471 + a1bf98d commit f952bf9
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 22 deletions.
5 changes: 3 additions & 2 deletions src/.graphclient/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10361,6 +10361,7 @@ export type getShipPoolIdQuery = { GrantShip: Array<Pick<GrantShip, 'poolId'>> }

export type getUpdatesQueryVariables = Exact<{
entityAddress: Scalars['String'];
scope?: InputMaybe<Scalars['Int']>;
}>;


Expand Down Expand Up @@ -10987,9 +10988,9 @@ export const getShipPoolIdDocument = gql`
}
` as unknown as DocumentNode<getShipPoolIdQuery, getShipPoolIdQueryVariables>;
export const getUpdatesDocument = gql`
query getUpdates($entityAddress: String!) {
query getUpdates($entityAddress: String!, $scope: Int) {
Update(
where: {entityAddress: {_eq: $entityAddress}}
where: {entityAddress: {_eq: $entityAddress}, scope: {_eq: $scope}}
order_by: {timestamp: desc}
) {
...UpdateBody
Expand Down
5 changes: 3 additions & 2 deletions src/components/grant/MilestonesDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
Box,
Button,
Group,
NumberInput,
Stack,
Text,
TextInput,
Expand Down Expand Up @@ -238,8 +239,6 @@ export const MilestonesDrawer = ({

const alreadyHasMilestones = !!currentMilestoneSet;

console.log('formData', formData);

return (
<PageDrawer opened={opened} onClose={onClose}>
<Group mt="40" mb="lg" w="100%" justify="space-between">
Expand Down Expand Up @@ -294,6 +293,8 @@ export const MilestonesDrawer = ({
label={`Percentage`}
name={`milestone-perc-${index + 1}`}
type="number"
min={1}
step={1}
placeholder="30"
w={'48%'}
value={formData[`milestone-perc-${index + 1}`]}
Expand Down
2 changes: 1 addition & 1 deletion src/constants/addresses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const ADDR_PROD: Record<string, Address> = {
ALLO: '0x1133eA7Af70876e64665ecD07C0A0476d09465a1',
REGISTRY: '0x4AAcca72145e1dF2aeC137E1f3C5E3D75DB8b5f3',
HATS: '0x3bc1A0Ad72417f2d411118085256fC53CBdDd137',
GAME_MANAGER: '0x012Dd40039884B2cBAf3582Ec6A259Bd0B1c8f0D',
GAME_MANAGER: '0x991aec0267985f415d86cacA00eF25a4ccc5488A',
GM_FACTORY: '0xdc9787b869e22256a4f4f49f484586fcff0d351f',
GS_FACTORY: '0x482a44043C67B92a69FAa47C5DA35453D88D140a',
HATS_POSTER: '0x0B2BdeFf847D4AeB51F9f6aA3eC9AB63931E4191',
Expand Down
4 changes: 2 additions & 2 deletions src/constants/copy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ export const beaconNotSubmitted: Content = {
{
attrs: { level: 3 },
type: 'heading',
content: [{ type: 'text', text: 'Beacon Not Submitted' }],
content: [{ type: 'text', text: 'Greeter Message Not Created' }],
},
{
type: 'paragraph',
content: [
{
type: 'text',
text: 'The beacon has not been submitted for this ship.',
text: `Grant Ship hasn't completed their welcome message yet.`,
},
],
},
Expand Down
4 changes: 2 additions & 2 deletions src/graphql/newQueries/getUpdates.graphql
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
query getUpdates($entityAddress: String!) {
query getUpdates($entityAddress: String!, $scope: Int) {
Update(
where: { entityAddress: { _eq: $entityAddress } }
where: { entityAddress: { _eq: $entityAddress }, scope: { _eq: $scope } }
order_by: { timestamp: desc }
) {
...UpdateBody
Expand Down
11 changes: 3 additions & 8 deletions src/pages/Project.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import {
ActionIcon,
Avatar,
AvatarGroup,
Box,
Collapse,
Divider,
Flex,
Group,
Loader,
Modal,
Paper,
Skeleton,
Stack,
Expand All @@ -20,7 +18,6 @@ import {
import { MainSection, PageTitle, ProfileSection } from '../layout/Sections';
import {
IconAward,
IconCheck,
IconChevronDown,
IconChevronUp,
IconInfoCircle,
Expand All @@ -29,19 +26,17 @@ import {
} from '@tabler/icons-react';
import { FeedPanel } from '../components/shipItems/FeedPanel';
import { GAME_MANAGER, GAME_TOKEN } from '../constants/gameSetup';
// import { MilestoneProgress } from '../components/projectItems/MilestoneProgress';
import { Contact } from '../components/Contact';

import { formatEther } from 'viem';
import { Link, useParams } from 'react-router-dom';
import { useQuery, useInfiniteQuery, QueryClient } from '@tanstack/react-query';
import { useQuery, useInfiniteQuery } from '@tanstack/react-query';
import { getProjectPage } from '../queries/getProjectPage';
import { AddressAvatarGroup } from '../components/AddressAvatar';
import { AppAlert } from '../components/UnderContruction';
import { GrantStatus } from '../types/common';
import { GrantStatus, UpdateScope } from '../types/common';
import { SingleItemPageSkeleton } from '../components/skeletons';
import { getEntityFeed } from '../queries/getFeed';
// import { DashGrant } from '../resolvers/grantResolvers';
import { useMemo } from 'react';
import { useUserData } from '../hooks/useUserState';
import { useLaptop, useTablet } from '../hooks/useBreakpoint';
Expand Down Expand Up @@ -97,7 +92,7 @@ export const Project = () => {
refetch: refetchUpdates,
} = useQuery({
queryKey: [`project-updates-${project?.id}`],
queryFn: () => getUpdates(project?.id as string),
queryFn: () => getUpdates(project?.id as string, UpdateScope.Project),
enabled: !!project?.id,
});

Expand Down
4 changes: 1 addition & 3 deletions src/pages/Ship.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,6 @@ export const Ship = () => {
enabled: !!id,
});

console.log('ship', ship);

const { userData } = useUserData();

const {
Expand Down Expand Up @@ -223,7 +221,7 @@ export const Ship = () => {
{ship.shipContractAddress && (
<ApplyButton
shipSrcAddress={ship.shipContractAddress}
disabled={isShipActive}
disabled={!isShipActive}
/>
)}
</Group>
Expand Down
8 changes: 6 additions & 2 deletions src/queries/getUpdates.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import { getBuiltGraphSDK } from '../.graphclient';
import { resolveUpdates } from '../resolvers/updates';
import { UpdateScope } from '../types/common';

export const getUpdates = async (entityAddress: string) => {
export const getUpdates = async (entityAddress: string, scope: UpdateScope) => {
try {
const { getUpdates } = getBuiltGraphSDK();

const result = await getUpdates({ entityAddress: entityAddress });
const result = await getUpdates({
entityAddress: entityAddress,
scope: scope,
});

if (!result.Update) {
throw new Error('No updates found');
Expand Down
7 changes: 7 additions & 0 deletions src/types/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,13 @@ export enum VotingStage {
Unknown,
}

export enum UpdateScope {
Game,
Ship,
Project,
Grant,
}

export const formatBalance = (balance?: bigint) => {
if (!balance || typeof balance !== 'bigint') return 0;
return Number(Number(formatEther(balance)).toFixed(2));
Expand Down

0 comments on commit f952bf9

Please sign in to comment.