Skip to content

Commit

Permalink
Refactor CreateFundraisingEntryInput and enhance fundraising button v…
Browse files Browse the repository at this point in the history
…isibility in TeamScreen
  • Loading branch information
jthoward64 committed Jan 29, 2025
1 parent 2dc657c commit 2a4964a
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 16 deletions.
2 changes: 1 addition & 1 deletion packages/mobile/src/graphql/graphql-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export type introspection_types = {
'CreateEventInput': { kind: 'INPUT_OBJECT'; name: 'CreateEventInput'; isOneOf: false; inputFields: [{ name: 'description'; type: { kind: 'SCALAR'; name: 'NonEmptyString'; ofType: null; }; defaultValue: null }, { name: 'location'; type: { kind: 'SCALAR'; name: 'NonEmptyString'; ofType: null; }; defaultValue: null }, { name: 'occurrences'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'INPUT_OBJECT'; name: 'CreateEventOccurrenceInput'; ofType: null; }; }; }; }; defaultValue: null }, { name: 'summary'; type: { kind: 'SCALAR'; name: 'NonEmptyString'; ofType: null; }; defaultValue: null }, { name: 'title'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'NonEmptyString'; ofType: null; }; }; defaultValue: null }]; };
'CreateEventOccurrenceInput': { kind: 'INPUT_OBJECT'; name: 'CreateEventOccurrenceInput'; isOneOf: false; inputFields: [{ name: 'fullDay'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'Boolean'; ofType: null; }; }; defaultValue: null }, { name: 'interval'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'INPUT_OBJECT'; name: 'IntervalISOInput'; ofType: null; }; }; defaultValue: null }]; };
'CreateFeedInput': { kind: 'INPUT_OBJECT'; name: 'CreateFeedInput'; isOneOf: false; inputFields: [{ name: 'imageUuid'; type: { kind: 'SCALAR'; name: 'GlobalId'; ofType: null; }; defaultValue: null }, { name: 'textContent'; type: { kind: 'SCALAR'; name: 'NonEmptyString'; ofType: null; }; defaultValue: null }, { name: 'title'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'NonEmptyString'; ofType: null; }; }; defaultValue: null }]; };
'CreateFundraisingEntryInput': { kind: 'INPUT_OBJECT'; name: 'CreateFundraisingEntryInput'; isOneOf: false; inputFields: [{ name: 'amount'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'Float'; ofType: null; }; }; defaultValue: null }, { name: 'amountOverride'; type: { kind: 'SCALAR'; name: 'Float'; ofType: null; }; defaultValue: null }, { name: 'batchType'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'ENUM'; name: 'BatchType'; ofType: null; }; }; defaultValue: null }, { name: 'batchTypeOverride'; type: { kind: 'ENUM'; name: 'BatchType'; ofType: null; }; defaultValue: null }, { name: 'donatedBy'; type: { kind: 'SCALAR'; name: 'NonEmptyString'; ofType: null; }; defaultValue: null }, { name: 'donatedByOverride'; type: { kind: 'SCALAR'; name: 'NonEmptyString'; ofType: null; }; defaultValue: null }, { name: 'donatedOn'; type: { kind: 'SCALAR'; name: 'LocalDate'; ofType: null; }; defaultValue: null }, { name: 'donatedOnOverride'; type: { kind: 'SCALAR'; name: 'LocalDate'; ofType: null; }; defaultValue: null }, { name: 'donatedTo'; type: { kind: 'SCALAR'; name: 'NonEmptyString'; ofType: null; }; defaultValue: null }, { name: 'donatedToOverride'; type: { kind: 'SCALAR'; name: 'NonEmptyString'; ofType: null; }; defaultValue: null }, { name: 'notes'; type: { kind: 'SCALAR'; name: 'NonEmptyString'; ofType: null; }; defaultValue: null }, { name: 'solicitationCodeId'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'GlobalId'; ofType: null; }; }; defaultValue: null }, { name: 'solicitationCodeOverrideId'; type: { kind: 'SCALAR'; name: 'GlobalId'; ofType: null; }; defaultValue: null }]; };
'CreateFundraisingEntryInput': { kind: 'INPUT_OBJECT'; name: 'CreateFundraisingEntryInput'; isOneOf: false; inputFields: [{ name: 'amount'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'Float'; ofType: null; }; }; defaultValue: null }, { name: 'batchType'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'ENUM'; name: 'BatchType'; ofType: null; }; }; defaultValue: null }, { name: 'donatedBy'; type: { kind: 'SCALAR'; name: 'NonEmptyString'; ofType: null; }; defaultValue: null }, { name: 'donatedOn'; type: { kind: 'SCALAR'; name: 'LocalDate'; ofType: null; }; defaultValue: null }, { name: 'donatedTo'; type: { kind: 'SCALAR'; name: 'NonEmptyString'; ofType: null; }; defaultValue: null }, { name: 'notes'; type: { kind: 'SCALAR'; name: 'NonEmptyString'; ofType: null; }; defaultValue: null }, { name: 'solicitationCodeId'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'GlobalId'; ofType: null; }; }; defaultValue: null }]; };
'CreateImageInput': { kind: 'INPUT_OBJECT'; name: 'CreateImageInput'; isOneOf: false; inputFields: [{ name: 'alt'; type: { kind: 'SCALAR'; name: 'NonEmptyString'; ofType: null; }; defaultValue: null }, { name: 'url'; type: { kind: 'SCALAR'; name: 'URL'; ofType: null; }; defaultValue: null }]; };
'CreateMarathonHourInput': { kind: 'INPUT_OBJECT'; name: 'CreateMarathonHourInput'; isOneOf: false; inputFields: [{ name: 'details'; type: { kind: 'SCALAR'; name: 'NonEmptyString'; ofType: null; }; defaultValue: null }, { name: 'durationInfo'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'NonEmptyString'; ofType: null; }; }; defaultValue: null }, { name: 'shownStartingAt'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'LuxonDateTime'; ofType: null; }; }; defaultValue: null }, { name: 'title'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'NonEmptyString'; ofType: null; }; }; defaultValue: null }]; };
'CreateMarathonInput': { kind: 'INPUT_OBJECT'; name: 'CreateMarathonInput'; isOneOf: false; inputFields: [{ name: 'endDate'; type: { kind: 'SCALAR'; name: 'LuxonDateTime'; ofType: null; }; defaultValue: null }, { name: 'startDate'; type: { kind: 'SCALAR'; name: 'LuxonDateTime'; ofType: null; }; defaultValue: null }, { name: 'year'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'MarathonYear'; ofType: null; }; }; defaultValue: null }]; };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,11 @@ const FundraisingScreen = ({
<Flex direction="column">
<Text
fontFamily="headingBold"
fontSize="5xl"
fontSize="3xl"
color="secondary.400"
textAlign="center"
paddingTop={2}
noOfLines={1}
>
${(fundraising?.fundraisingTotalAmount ?? 0).toFixed(2)}
</Text>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useQuery } from "urql";

import { Logger } from "@/common/logger/Logger";
import { showMessage } from "@/common/util/alertUtils";
import { graphql } from "@/graphql/index";
import { graphql, readFragment } from "@/graphql/index";

import type { SpiritStackParamList } from "../../../../types/navigationTypes";
import FundraisingScreen, {
Expand Down Expand Up @@ -164,6 +164,10 @@ const SpiritScreen = () => {
<SpiritStack.Screen name="MyTeam">
{() => (
<TeamScreen
showFundraisingButton={
(readFragment(MyFundraisingFragment, query.data?.me)
?.fundraisingTotalAmount ?? 0) > 0
}
myTeamFragment={query.data?.me?.primaryTeam?.team ?? null}
userUuid={query.data?.me?.id ?? ""}
loading={!spiritMode || query.fetching}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { FontAwesome5 } from "@expo/vector-icons";
import { useNavigation } from "@react-navigation/core";
import { openBrowserAsync } from "expo-web-browser";
import { Flex, HStack, Text, View } from "native-base";
import { Button, Center, Flex, HStack, Text, View } from "native-base";
import { useWindowDimensions } from "react-native";
import { TouchableOpacity } from "react-native-gesture-handler";

import Breadcrumbs from "@/common/components/Breadcrumbs";
import { useThemeFonts } from "@/common/customHooks";
import { universalCatch } from "@/common/logging";
import type { SpiritStackScreenProps } from "@/common-types/navigationTypes";

import CommitteeHoldingSign from "../../../../../../../assets/svgs/CommitteeHoldingSign";
import DanceBlueRibbon from "../../../../../../../assets/svgs/DBRibbon";
Expand All @@ -18,18 +20,20 @@ const TeamInformation = ({
captains,
scoreboardData,
teamTotal,
showFundraisingButton,
}: {
name: string;
captains: readonly string[];
members: readonly string[];
scoreboardData: readonly StandingType[];
teamTotal: number;
showFundraisingButton: boolean;
}) => {
const { body, mono } = useThemeFonts();
const { width: screenWidth } = useWindowDimensions();

// const { navigate } =
// useNavigation<SpiritStackScreenProps<"MyTeam">["navigation"]>();
const { navigate } =
useNavigation<SpiritStackScreenProps<"MyTeam">["navigation"]>();

const captainString = captains.join(", ");

Expand Down Expand Up @@ -72,14 +76,16 @@ const TeamInformation = ({
</Text>
)}
</View>
{/* <Center>
<Button
onPress={() => navigate("Fundraising", {})}
colorScheme="primary"
>
View Fundraising
</Button>
</Center> */}
{showFundraisingButton && (
<Center>
<Button
onPress={() => navigate("Fundraising", {})}
colorScheme="primary"
>
View Fundraising
</Button>
</Center>
)}
<HStack alignItems="center">
<CommitteeHoldingSign
svgProps={{ width: screenWidth / 2, height: 200 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ export const MyFundraisingFragment = graphql(/* GraphQL */ `
const TeamScreen = ({
myTeamFragment,
userUuid,
loading: _loading,
refresh: _refresh,
showFundraisingButton,
}: {
myTeamFragment: FragmentOf<typeof MyTeamFragment> | null;
userUuid: string;
loading: boolean;
refresh: () => void;
showFundraisingButton: boolean;
}) => {
const team = readFragment(MyTeamFragment, myTeamFragment);

Expand Down Expand Up @@ -131,6 +131,7 @@ const TeamScreen = ({

return (
<TeamInformation
showFundraisingButton={showFundraisingButton}
captains={members
.filter(
(member) =>
Expand Down

0 comments on commit 2a4964a

Please sign in to comment.