From ec280acc2b75703c1c1c3bb72faa8fc743a562c3 Mon Sep 17 00:00:00 2001 From: mrtmeeseeks <taulant.disha@ablera.com> Date: Wed, 30 Oct 2024 23:15:47 +0200 Subject: [PATCH] fixed issue with members not showing, refactored contribution model defintions, created contribution factory and switched fetching of contributions to subgraph --- .../discord-gathering.model.ts | 43 ++++ .../contribution-types/join-discord.model.ts | 38 ++++ src/api/contribution-types/open-task.model.ts | 42 ++++ .../contribution-types/quiz.model.model.ts | 22 ++ src/api/contribution-types/retweet.model.ts | 36 +++ src/api/contribution.model.ts | 209 +++++------------- src/api/contributions.api.ts | 9 +- src/hooks/useQueryContributions.tsx | 108 +++++---- src/pages/AutDashboardMain.tsx | 4 - src/pages/DiscordBot/CreateGathering.tsx | 7 +- .../GithubTasks/CreateGithubCommitTask.tsx | 4 - .../GithubTasks/CreateGithubOpenPRTask.tsx | 4 - src/pages/Members/Members.tsx | 4 +- .../Plugins/Task/Open/CreateOpenTask.tsx | 4 +- .../Modules/Plugins/Task/Shared/AllTasks.tsx | 6 +- src/pages/TwitterTasks/CreateXCommentTask.tsx | 4 - src/pages/TwitterTasks/CreateXFollowTask.tsx | 4 - src/pages/TwitterTasks/CreateXLikeTask.tsx | 4 - src/pages/TwitterTasks/CreateXRetweetTask.tsx | 8 +- src/pages/TwitterTasks/SubmitRetweetTask.tsx | 5 - 20 files changed, 317 insertions(+), 248 deletions(-) create mode 100644 src/api/contribution-types/discord-gathering.model.ts create mode 100644 src/api/contribution-types/join-discord.model.ts create mode 100644 src/api/contribution-types/open-task.model.ts create mode 100644 src/api/contribution-types/quiz.model.model.ts create mode 100644 src/api/contribution-types/retweet.model.ts diff --git a/src/api/contribution-types/discord-gathering.model.ts b/src/api/contribution-types/discord-gathering.model.ts new file mode 100644 index 0000000..3bfb78b --- /dev/null +++ b/src/api/contribution-types/discord-gathering.model.ts @@ -0,0 +1,43 @@ +import { + BaseNFTModel, + TaskContributionNFT, + TaskContributionProperties +} from "@aut-labs/sdk"; + +export class DiscordGatheringContributionProperties extends TaskContributionProperties { + channelId: string; + duration: number; + + constructor(data: DiscordGatheringContributionProperties) { + super(data); + this.channelId = data.channelId; + this.duration = data.duration; + } +} + +export class DiscordGatheringContribution< + T = DiscordGatheringContributionProperties +> extends TaskContributionNFT<T> { + static getContributionNFT( + contribution: DiscordGatheringContribution + ): BaseNFTModel<any> { + const taskContribution = new DiscordGatheringContribution(contribution); + return { + name: taskContribution.name, + description: taskContribution.description, + properties: { + duration: taskContribution.properties.duration, + channelId: taskContribution.properties.channelId + } + } as BaseNFTModel<any>; + } + + constructor( + data: DiscordGatheringContribution<T> = {} as DiscordGatheringContribution<T> + ) { + super(data); + this.properties = new DiscordGatheringContributionProperties( + data.properties as DiscordGatheringContributionProperties + ) as T; + } +} diff --git a/src/api/contribution-types/join-discord.model.ts b/src/api/contribution-types/join-discord.model.ts new file mode 100644 index 0000000..828e0f1 --- /dev/null +++ b/src/api/contribution-types/join-discord.model.ts @@ -0,0 +1,38 @@ +import { + BaseNFTModel, + TaskContributionNFT, + TaskContributionProperties +} from "@aut-labs/sdk"; + +export class JoinDiscordTaskContributionProperties extends TaskContributionProperties { + inviteUrl: string; + constructor(data: JoinDiscordTaskContributionProperties) { + super(data); + this.inviteUrl = data.inviteUrl; + } +} + +export class JoinDiscordContribution< + T = JoinDiscordTaskContributionProperties +> extends TaskContributionNFT<T> { + static getContributionNFT( + contribution: JoinDiscordContribution + ): BaseNFTModel<any> { + const taskContribution = new JoinDiscordContribution(contribution); + return { + name: taskContribution.name, + description: taskContribution.description, + properties: { + inviteUrl: taskContribution.properties.inviteUrl, + } + } as BaseNFTModel<any>; + } + constructor( + data: JoinDiscordContribution<T> = {} as JoinDiscordContribution<T> + ) { + super(data); + this.properties = new JoinDiscordTaskContributionProperties( + data.properties as JoinDiscordTaskContributionProperties + ) as T; + } +} diff --git a/src/api/contribution-types/open-task.model.ts b/src/api/contribution-types/open-task.model.ts new file mode 100644 index 0000000..a52b944 --- /dev/null +++ b/src/api/contribution-types/open-task.model.ts @@ -0,0 +1,42 @@ +import { + BaseNFTModel, + TaskContributionNFT, + TaskContributionProperties + } from "@aut-labs/sdk"; + +export class OpenTaskContributionProperties extends TaskContributionProperties { + attachmentRequired: boolean; + textRequired: boolean; + attachmentType: string; + constructor(data: OpenTaskContributionProperties) { + super(data); + this.attachmentRequired = data.attachmentRequired; + this.textRequired = data.textRequired; + this.attachmentType = data.attachmentType; + } + } + + export class OpenTaskContribution< + T = OpenTaskContributionProperties + > extends TaskContributionNFT<T> { + static getContributionNFT( + contribution: OpenTaskContribution + ): BaseNFTModel<any> { + const taskContribution = new OpenTaskContribution(contribution); + return { + name: taskContribution.name, + description: taskContribution.description, + properties: { + attachmentRequired: taskContribution.properties.attachmentRequired, + textRequired: taskContribution.properties.textRequired, + attachmentType: taskContribution.properties.attachmentType + } + } as BaseNFTModel<any>; + } + constructor(data: OpenTaskContribution<T> = {} as OpenTaskContribution<T>) { + super(data); + this.properties = new OpenTaskContributionProperties( + data.properties as OpenTaskContributionProperties + ) as T; + } + } \ No newline at end of file diff --git a/src/api/contribution-types/quiz.model.model.ts b/src/api/contribution-types/quiz.model.model.ts new file mode 100644 index 0000000..d3f6837 --- /dev/null +++ b/src/api/contribution-types/quiz.model.model.ts @@ -0,0 +1,22 @@ +import { + BaseNFTModel, + TaskContributionNFT, + TaskContributionProperties +} from "@aut-labs/sdk"; + +export class QuizTaskContributionProperties extends TaskContributionProperties { + constructor(data: QuizTaskContributionProperties) { + super(data); + } +} + +export class QuizTaskContribution< + T = QuizTaskContributionProperties +> extends TaskContributionNFT<T> { + constructor(data: QuizTaskContribution<T> = {} as QuizTaskContribution<T>) { + super(data); + this.properties = new QuizTaskContributionProperties( + data.properties as QuizTaskContributionProperties + ) as T; + } +} diff --git a/src/api/contribution-types/retweet.model.ts b/src/api/contribution-types/retweet.model.ts new file mode 100644 index 0000000..3680822 --- /dev/null +++ b/src/api/contribution-types/retweet.model.ts @@ -0,0 +1,36 @@ +import { + BaseNFTModel, + TaskContributionNFT, + TaskContributionProperties +} from "@aut-labs/sdk"; + +export class RetweetContributionProperties extends TaskContributionProperties { + tweetUrl: string; + constructor(data: RetweetContributionProperties) { + super(data); + this.tweetUrl = data.tweetUrl; + } +} + +export class RetweetContribution< + T = RetweetContributionProperties +> extends TaskContributionNFT<T> { + static getContributionNFT( + contribution: RetweetContribution + ): BaseNFTModel<any> { + const taskContribution = new RetweetContribution(contribution); + return { + name: taskContribution.name, + description: taskContribution.description, + properties: { + tweetUrl: taskContribution.properties.tweetUrl + } + } as BaseNFTModel<any>; + } + constructor(data: RetweetContribution<T> = {} as RetweetContribution<T>) { + super(data); + this.properties = new RetweetContributionProperties( + data.properties as RetweetContributionProperties + ) as T; + } +} diff --git a/src/api/contribution.model.ts b/src/api/contribution.model.ts index db7516b..08da9e0 100644 --- a/src/api/contribution.model.ts +++ b/src/api/contribution.model.ts @@ -1,158 +1,51 @@ -import { - BaseNFTModel, - TaskContributionNFT, - TaskContributionProperties -} from "@aut-labs/sdk"; -import { duration } from "@mui/material"; - -export class RetweetContributionProperties extends TaskContributionProperties { - tweetUrl: string; - constructor(data: RetweetContributionProperties) { - super(data); - this.tweetUrl = data.tweetUrl; - } -} - -export class RetweetContribution< - T = RetweetContributionProperties -> extends TaskContributionNFT<T> { - static getContributionNFT( - contribution: RetweetContribution - ): BaseNFTModel<any> { - const taskContribution = new RetweetContribution(contribution); - return { - name: taskContribution.name, - description: taskContribution.description, - properties: { - tweetUrl: taskContribution.properties.tweetUrl - } - } as BaseNFTModel<any>; - } - constructor(data: RetweetContribution<T> = {} as RetweetContribution<T>) { - super(data); - this.properties = new RetweetContributionProperties( - data.properties as RetweetContributionProperties - ) as T; - } -} - -export class OpenTaskContributionProperties extends TaskContributionProperties { - attachmentRequired: boolean; - textRequired: boolean; - attachmentType: string; - constructor(data: OpenTaskContributionProperties) { - super(data); - this.attachmentRequired = data.attachmentRequired; - this.textRequired = data.textRequired; - this.attachmentType = data.attachmentType; - } -} - -export class OpenTaskContribution< - T = OpenTaskContributionProperties -> extends TaskContributionNFT<T> { - static getContributionNFT( - contribution: OpenTaskContribution - ): BaseNFTModel<any> { - const taskContribution = new OpenTaskContribution(contribution); - return { - name: taskContribution.name, - description: taskContribution.description, - properties: { - attachmentRequired: taskContribution.properties.attachmentRequired, - textRequired: taskContribution.properties.textRequired, - attachmentType: taskContribution.properties.attachmentType - } - } as BaseNFTModel<any>; - } - constructor(data: OpenTaskContribution<T> = {} as OpenTaskContribution<T>) { - super(data); - this.properties = new OpenTaskContributionProperties( - data.properties as OpenTaskContributionProperties - ) as T; - } -} - -export class JoinDiscordTaskContributionProperties extends TaskContributionProperties { - constructor(data: JoinDiscordTaskContributionProperties) { - super(data); - } -} - -export class JoinDiscordTaskContribution< - T = JoinDiscordTaskContributionProperties -> extends TaskContributionNFT<T> { - constructor(data: OpenTaskContribution<T> = {} as OpenTaskContribution<T>) { - super(data); - this.properties = new JoinDiscordTaskContributionProperties( - data.properties as JoinDiscordTaskContributionProperties - ) as T; - } -} - -export class QuizTaskContributionProperties extends TaskContributionProperties { - constructor(data: QuizTaskContributionProperties) { - super(data); - } -} - -export class QuizTaskContribution< - T = QuizTaskContributionProperties -> extends TaskContributionNFT<T> { - constructor(data: OpenTaskContribution<T> = {} as OpenTaskContribution<T>) { - super(data); - this.properties = new QuizTaskContributionProperties( - data.properties as QuizTaskContributionProperties - ) as T; - } -} - -export class DiscordGatheringContributionProperties extends TaskContributionProperties { - channelId: string; - duration: number; - - constructor(data: DiscordGatheringContributionProperties) { - super(data); - this.taskId = data.taskId; - this.role = data.role; - this.startDate = data.startDate; - this.channelId = data.channelId; - this.points = data.points; - this.quantity = data.quantity; - this.uri = data.uri; - } -} - -export class DiscordGatheringContribution< - T = DiscordGatheringContributionProperties -> extends TaskContributionNFT<T> { - static getContributionNFT( - contribution: DiscordGatheringContribution - ): BaseNFTModel<any> { - const taskContribution = new DiscordGatheringContribution(contribution); - return { - name: taskContribution.name, - description: taskContribution.description, - image: "", - properties: { - taskId: taskContribution.properties.taskId, - role: taskContribution.properties.role, - startDate: taskContribution.properties.startDate, - duration: taskContribution.properties.duration, - channelId: taskContribution.properties.channelId, - points: taskContribution.properties.points, - quantity: taskContribution.properties.quantity, - uri: taskContribution.properties.uri - } - } as BaseNFTModel<any>; - } - - constructor( - data: DiscordGatheringContribution<T> = {} as DiscordGatheringContribution<T> - ) { - super(data); - this.properties = new DiscordGatheringContributionProperties( - data.properties as DiscordGatheringContributionProperties - ) as T; - } -} +import { BaseNFTModel } from "@aut-labs/sdk"; +import { TaskType } from "./models/task-type"; +import { OpenTaskContribution } from "./contribution-types/open-task.model"; +import { DiscordGatheringContribution } from "./contribution-types/discord-gathering.model"; +import { RetweetContribution } from "./contribution-types/retweet.model"; +import { JoinDiscordContribution } from "./contribution-types/join-discord.model"; +import { QuizTaskContribution } from "./contribution-types/quiz.model.model"; + +export const ContributionFactory = ( + metadata: BaseNFTModel<any>, + contribution: any, + taskTypes: TaskType[] +) => { + const taskType = taskTypes.find( + (taskType) => taskType.taskId === contribution.taskId + ); + + if (!taskType) { + throw new Error("Task type not found"); + } + const taskName = taskType.metadata.properties.type; + const data = { + ...metadata, + properties: { + ...metadata.properties, + ...contribution + }, + } + switch (taskName) { + case "OpenTask": + return new OpenTaskContribution(data); + case "DiscordGatherings": + return new DiscordGatheringContribution(data); + case "TwitterRetweet": + return new RetweetContribution(data); + case "JoinDiscord": + return new JoinDiscordContribution(data); + case "Quiz": + return new QuizTaskContribution(data); + case "TwitterLike": + case "GitHubCommit": + case "GitHubOpenPR": + case "DiscordPolls": + case "TwitterFollow": + case "TwitterComment": + throw new Error("Task type not implemented"); + + default: + throw new Error("Task type not found"); + } +}; diff --git a/src/api/contributions.api.ts b/src/api/contributions.api.ts index bf03b88..88652d5 100644 --- a/src/api/contributions.api.ts +++ b/src/api/contributions.api.ts @@ -6,12 +6,10 @@ import AutSDK, { TaskContributionNFT } from "@aut-labs/sdk"; import { BaseQueryApi, createApi } from "@reduxjs/toolkit/query/react"; -import { - DiscordGatheringContribution, - OpenTaskContribution, - RetweetContribution -} from "./contribution.model"; import { TaskFactoryContractEventType } from "@aut-labs/abi-types"; +import { DiscordGatheringContribution } from "./contribution-types/discord-gathering.model"; +import { OpenTaskContribution } from "./contribution-types/open-task.model"; +import { RetweetContribution } from "./contribution-types/retweet.model"; const hubServiceCache: Record<string, Hub> = {}; @@ -52,7 +50,6 @@ const createContribution = async ( { uri }, overrides )).wait(); - debugger; const event = findLogEvent(tx, TaskFactoryContractEventType.RegisterDescription); if (!event) { diff --git a/src/hooks/useQueryContributions.tsx b/src/hooks/useQueryContributions.tsx index e00b6b5..8ec1c44 100644 --- a/src/hooks/useQueryContributions.tsx +++ b/src/hooks/useQueryContributions.tsx @@ -2,67 +2,99 @@ import AutSDK, { BaseNFTModel, fetchMetadata, Hub, - TaskContribution, - TaskContributionNFT + TaskContributionNFT, + TaskFactoryContract } from "@aut-labs/sdk"; -import { QueryFunctionOptions, QueryResult } from "@apollo/client"; +import { + gql, + QueryFunctionOptions, + QueryResult, + useQuery +} from "@apollo/client"; import { useEffect, useState } from "react"; import { environment } from "@api/environment"; import { useSelector } from "react-redux"; -import { HubData } from "@store/Hub/hub.reducer"; -import { HubOSHub } from "@api/hub.model"; +import { HubData, TaskTypes } from "@store/Hub/hub.reducer"; +import { TaskType } from "@api/models/task-type"; +import { ContributionFactory } from "@api/contribution.model"; -const fetchOnChainContributions = async ( - hubData: HubOSHub -): Promise<TaskContributionNFT[]> => { - const sdk = await AutSDK.getInstance(); - const hubService: Hub = sdk.initService<Hub>(Hub, hubData.properties.address); - const taskFactory = await hubService.getTaskFactory(); - const ids = (await taskFactory.functions.contributionIds()) as string[]; +const GET_HUB_CONTRIBUTIONS = gql` + query GetContributions($skip: Int, $first: Int, $where: Contribution_filter) { + contributions(skip: $skip, first: $first, where: $where) { + id + taskId + role + startDate + endDate + points + quantity + descriptionId + } + } +`; - const contributions = await Promise.all( - ids.map(async (id) => { - const _contribution = await taskFactory.functions.getContributionById(id); - const contribution = TaskContribution.mapFromTuple(_contribution as any); - const { uri } = await taskFactory.functions.getDescriptionById( - contribution.descriptionId - ); - const metadata = await fetchMetadata<BaseNFTModel<any>>( - uri, - environment.ipfsGatewayUrl - ); - return { - ...metadata, - properties: { - ...metadata.properties, - ...contribution - } - }; - }) - ); - return contributions; +const contributionsMetadata = ( + contributions: any[], + taskFactory: TaskFactoryContract, + taskTypes: TaskType[] +) => { + return contributions.map(async (contribution) => { + const { uri } = await taskFactory.functions.getDescriptionById( + contribution?.descriptionId + ); + let metadata = await fetchMetadata<BaseNFTModel<any>>( + uri, + environment.ipfsGatewayUrl + ); + metadata = metadata || ({ properties: {} } as BaseNFTModel<any>); + return ContributionFactory(metadata, contribution, taskTypes); + }); }; const useQueryContributions = (props: QueryFunctionOptions<any, any> = {}) => { + const hubData = useSelector(HubData); + const taskTypes = useSelector(TaskTypes); + const { data, loading, ...rest } = useQuery(GET_HUB_CONTRIBUTIONS, { + skip: !hubData?.properties?.address || !taskTypes.length, + fetchPolicy: "cache-and-network", + variables: { + ...props.variables, + where: { + hubAddress: hubData.properties.address, + ...(props.variables?.where || {}) + } + }, + ...props + }); + const [contributions, setContributions] = useState<TaskContributionNFT[]>([]); const [loadingMetadata, setLoadingMetadata] = useState(false); - const hubData = useSelector(HubData); + useEffect(() => { - if (hubData) { + if (hubData?.properties?.address && data?.contributions?.length && taskTypes.length) { const fetch = async () => { + const sdk = await AutSDK.getInstance(); + const hubService: Hub = sdk.initService<Hub>( + Hub, + hubData.properties.address + ); + const taskFactory = await hubService.getTaskFactory(); setLoadingMetadata(true); - const contributions = await fetchOnChainContributions(hubData); + const contributions = await Promise.all( + contributionsMetadata(data?.contributions, taskFactory, taskTypes) + ); setLoadingMetadata(false); setContributions(contributions); }; fetch(); } - }, [hubData]); + }, [hubData?.properties?.address, data, taskTypes]); return { data: contributions || [], - loading: loadingMetadata + ...rest, + loading: loading || loadingMetadata } as QueryResult<TaskContributionNFT[]>; }; diff --git a/src/pages/AutDashboardMain.tsx b/src/pages/AutDashboardMain.tsx index 75cb330..7038ec0 100644 --- a/src/pages/AutDashboardMain.tsx +++ b/src/pages/AutDashboardMain.tsx @@ -175,10 +175,6 @@ const AutDashboardMain = () => { <Route path="edit-hub" element={<HubEdit />} /> <Route path="archetype" element={<Archetype />} /> <Route path="modules/dAut" element={<DAut />} /> - <Route - path="members" - element={<Members members={[]} isLoading={false} />} - /> <Route path="discord-bot" element={<DiscordBot />}></Route> <Route path="members" diff --git a/src/pages/DiscordBot/CreateGathering.tsx b/src/pages/DiscordBot/CreateGathering.tsx index ede5d77..c3b16f6 100644 --- a/src/pages/DiscordBot/CreateGathering.tsx +++ b/src/pages/DiscordBot/CreateGathering.tsx @@ -26,10 +26,6 @@ import { useCreateDiscordGatheringContributionMutation, useCreateOpenTaskContributionMutation } from "@api/contributions.api"; -import { - DiscordGatheringContribution, - OpenTaskContribution -} from "@api/contribution.model"; import SuccessDialog from "@components/Dialog/SuccessPopup"; import SubmitDialog from "@components/Dialog/SubmitDialog"; import { @@ -41,6 +37,7 @@ import { import { FormContainer } from "../Modules/Plugins/Task/Shared/FormContainer"; import { useQuery } from "@tanstack/react-query"; import axios from "axios"; +import { DiscordGatheringContribution } from "@api/contribution-types/discord-gathering.model"; const errorTypes = { maxWords: `Words cannot be more than 6`, @@ -154,7 +151,7 @@ const CreateDiscordGathering = () => { channelId: values.channelId, points: values.weight, quantity: 1, - uri: "" + descriptionId: "" } }); createTask(contribution); diff --git a/src/pages/GithubTasks/CreateGithubCommitTask.tsx b/src/pages/GithubTasks/CreateGithubCommitTask.tsx index 53154b4..8976c8b 100644 --- a/src/pages/GithubTasks/CreateGithubCommitTask.tsx +++ b/src/pages/GithubTasks/CreateGithubCommitTask.tsx @@ -26,10 +26,6 @@ import { useCreateDiscordGatheringContributionMutation, useCreateOpenTaskContributionMutation } from "@api/contributions.api"; -import { - DiscordGatheringContribution, - OpenTaskContribution -} from "@api/contribution.model"; import SuccessDialog from "@components/Dialog/SuccessPopup"; import SubmitDialog from "@components/Dialog/SubmitDialog"; import { diff --git a/src/pages/GithubTasks/CreateGithubOpenPRTask.tsx b/src/pages/GithubTasks/CreateGithubOpenPRTask.tsx index 2037835..a90a06c 100644 --- a/src/pages/GithubTasks/CreateGithubOpenPRTask.tsx +++ b/src/pages/GithubTasks/CreateGithubOpenPRTask.tsx @@ -26,10 +26,6 @@ import { useCreateDiscordGatheringContributionMutation, useCreateOpenTaskContributionMutation } from "@api/contributions.api"; -import { - DiscordGatheringContribution, - OpenTaskContribution -} from "@api/contribution.model"; import SuccessDialog from "@components/Dialog/SuccessPopup"; import SubmitDialog from "@components/Dialog/SubmitDialog"; import { diff --git a/src/pages/Members/Members.tsx b/src/pages/Members/Members.tsx index f525857..22e115a 100644 --- a/src/pages/Members/Members.tsx +++ b/src/pages/Members/Members.tsx @@ -240,6 +240,8 @@ const Members = ({ members, isLoading }: { members: HubOSAutID<AutIDProperties>[ const hubData = useSelector(HubData); + console.log(members); + const tabs = useMemo(() => { const roles = hubData.roles; const initializedTabs = roles.reduce((tab, role) => { @@ -303,7 +305,7 @@ const Members = ({ members, isLoading }: { members: HubOSAutID<AutIDProperties>[ }} > <Typography color="rgb(107, 114, 128)" variant="subtitle2"> - There are no contributors in this hub yet... + There are no members in this hub yet... </Typography> </Box> )} diff --git a/src/pages/Modules/Plugins/Task/Open/CreateOpenTask.tsx b/src/pages/Modules/Plugins/Task/Open/CreateOpenTask.tsx index 8371c3d..3ef3022 100644 --- a/src/pages/Modules/Plugins/Task/Open/CreateOpenTask.tsx +++ b/src/pages/Modules/Plugins/Task/Open/CreateOpenTask.tsx @@ -28,9 +28,9 @@ import { TextFieldWrapper } from "../Shared/StyledFields"; import { useCreateOpenTaskContributionMutation } from "@api/contributions.api"; -import { OpenTaskContribution } from "@api/contribution.model"; import SuccessDialog from "@components/Dialog/SuccessPopup"; import SubmitDialog from "@components/Dialog/SubmitDialog"; +import { OpenTaskContribution } from "@api/contribution-types/open-task.model"; const errorTypes = { maxWords: `Words cannot be more than 6`, @@ -122,7 +122,7 @@ const CreateOpenTask = () => { endDate: dateToUnix(values.endDate), points: values.weight, quantity: values.quantity, - uri: "" + descriptionId: "" } }); createTask(contribution); diff --git a/src/pages/Modules/Plugins/Task/Shared/AllTasks.tsx b/src/pages/Modules/Plugins/Task/Shared/AllTasks.tsx index 222359e..bf81a87 100644 --- a/src/pages/Modules/Plugins/Task/Shared/AllTasks.tsx +++ b/src/pages/Modules/Plugins/Task/Shared/AllTasks.tsx @@ -9,7 +9,7 @@ import { TaskContributionNFT } from "@aut-labs/sdk"; import OverflowTooltip from "@components/OverflowTooltip"; import { ContributionsTable } from "./ContributionsTable"; import { TaskStatus } from "@store/model"; -import { RetweetContributionProperties } from "@api/contribution.model"; +import { RetweetContributionProperties } from "@api/contribution-types/retweet.model"; // const ContributionCard = ({ // contribution @@ -139,7 +139,7 @@ export const AllTasks = ({ data: taskTypes }) => { } = useQueryContributions({ variables: { skip: 0, - take: 1000 + take: 1000, } }); @@ -237,7 +237,7 @@ export const AllTasks = ({ data: taskTypes }) => { /> ))} </Box> - + {!isLoading && !data?.length && ( <Box sx={{ diff --git a/src/pages/TwitterTasks/CreateXCommentTask.tsx b/src/pages/TwitterTasks/CreateXCommentTask.tsx index b48b984..caaf0fe 100644 --- a/src/pages/TwitterTasks/CreateXCommentTask.tsx +++ b/src/pages/TwitterTasks/CreateXCommentTask.tsx @@ -26,10 +26,6 @@ import { useCreateDiscordGatheringContributionMutation, useCreateOpenTaskContributionMutation } from "@api/contributions.api"; -import { - DiscordGatheringContribution, - OpenTaskContribution -} from "@api/contribution.model"; import SuccessDialog from "@components/Dialog/SuccessPopup"; import SubmitDialog from "@components/Dialog/SubmitDialog"; import { diff --git a/src/pages/TwitterTasks/CreateXFollowTask.tsx b/src/pages/TwitterTasks/CreateXFollowTask.tsx index a2c2bf6..13240dd 100644 --- a/src/pages/TwitterTasks/CreateXFollowTask.tsx +++ b/src/pages/TwitterTasks/CreateXFollowTask.tsx @@ -26,10 +26,6 @@ import { useCreateDiscordGatheringContributionMutation, useCreateOpenTaskContributionMutation } from "@api/contributions.api"; -import { - DiscordGatheringContribution, - OpenTaskContribution -} from "@api/contribution.model"; import SuccessDialog from "@components/Dialog/SuccessPopup"; import SubmitDialog from "@components/Dialog/SubmitDialog"; import { diff --git a/src/pages/TwitterTasks/CreateXLikeTask.tsx b/src/pages/TwitterTasks/CreateXLikeTask.tsx index 7bba999..0bab8bb 100644 --- a/src/pages/TwitterTasks/CreateXLikeTask.tsx +++ b/src/pages/TwitterTasks/CreateXLikeTask.tsx @@ -26,10 +26,6 @@ import { useCreateDiscordGatheringContributionMutation, useCreateOpenTaskContributionMutation } from "@api/contributions.api"; -import { - DiscordGatheringContribution, - OpenTaskContribution -} from "@api/contribution.model"; import SuccessDialog from "@components/Dialog/SuccessPopup"; import SubmitDialog from "@components/Dialog/SubmitDialog"; import { diff --git a/src/pages/TwitterTasks/CreateXRetweetTask.tsx b/src/pages/TwitterTasks/CreateXRetweetTask.tsx index 551dd38..45ef19a 100644 --- a/src/pages/TwitterTasks/CreateXRetweetTask.tsx +++ b/src/pages/TwitterTasks/CreateXRetweetTask.tsx @@ -27,11 +27,6 @@ import { useCreateOpenTaskContributionMutation, useCreateTwitterRetweetContributionMutation } from "@api/contributions.api"; -import { - DiscordGatheringContribution, - OpenTaskContribution, - RetweetContribution -} from "@api/contribution.model"; import SuccessDialog from "@components/Dialog/SuccessPopup"; import SubmitDialog from "@components/Dialog/SubmitDialog"; import { @@ -44,6 +39,7 @@ import { FormContainer } from "../Modules/Plugins/Task/Shared/FormContainer"; import { useMutation, useQuery } from "@tanstack/react-query"; import axios from "axios"; import { useOAuthSocials } from "@components/Oauth2/oauth2"; +import { RetweetContribution } from "@api/contribution-types/retweet.model"; const errorTypes = { maxWords: `Words cannot be more than 6`, @@ -105,7 +101,7 @@ const CreateXRetweetTask = () => { points: values.weight, tweetUrl: values.tweetUrl, quantity: values.quantity, - uri: "" + descriptionId: "" } }); createTask(contribution); diff --git a/src/pages/TwitterTasks/SubmitRetweetTask.tsx b/src/pages/TwitterTasks/SubmitRetweetTask.tsx index bd64f95..f12a5aa 100644 --- a/src/pages/TwitterTasks/SubmitRetweetTask.tsx +++ b/src/pages/TwitterTasks/SubmitRetweetTask.tsx @@ -27,11 +27,6 @@ import { useCreateOpenTaskContributionMutation, useCreateTwitterRetweetContributionMutation } from "@api/contributions.api"; -import { - DiscordGatheringContribution, - OpenTaskContribution, - RetweetContribution -} from "@api/contribution.model"; import SuccessDialog from "@components/Dialog/SuccessPopup"; import SubmitDialog from "@components/Dialog/SubmitDialog"; import {