add qrcode generation to sdk, refactor apptypes import

This commit is contained in:
turnoffthiscomputer
2024-07-26 08:59:09 +02:00
parent 7a45263b04
commit 03cbec29ba
11 changed files with 39 additions and 10 deletions

View File

@@ -1,4 +1,4 @@
import { AppType } from "../utils/appType";
import { AppType } from "../../../common/src/utils/appType";
import { Text, YStack } from 'tamagui';
import { Coins } from '@tamagui/lucide-icons';
import GITCOIN from '../images/gitcoin.png';

View File

@@ -1,4 +1,4 @@
import { AppType } from "../utils/appType";
import { AppType } from "../../../common/src/utils/appType";
import { Flame } from '@tamagui/lucide-icons';
import { Text, XStack, YStack } from 'tamagui';
import { generateProof } from "../utils/prover";

View File

@@ -1,4 +1,4 @@
import { AppType } from "../utils/appType";
import { AppType } from "../../../common/src/utils/appType";
import { Text, YStack } from 'tamagui';
import { Ticket } from '@tamagui/lucide-icons';
import ZUPASS from '../images/zupass.png';

View File

@@ -3,7 +3,7 @@ import { ScrollView, YStack } from 'tamagui';
import AppCard from '../components/AppCard';
import { Steps } from '../utils/utils';
import useNavigationStore from '../stores/navigationStore';
import { AppType } from '../utils/appType';
import { AppType } from '../../../common/src/utils/appType';
import sbtApp from '../apps/sbt';
import zupassApp from '../apps/zupass';
import gitcoinApp from '../apps/gitcoin';

View File

@@ -3,7 +3,7 @@ import { ScrollView, Text, YStack } from 'tamagui';
import AppCard from '../components/AppCard';
import { Steps } from '../utils/utils';
import useNavigationStore from '../stores/navigationStore';
import { AppType, createAppType } from '../utils/appType';
import { AppType, createAppType } from '../../../common/src/utils/appType';
import sbtApp from '../apps/sbt';
import zupassApp from '../apps/zupass';
import gitcoinApp from '../apps/gitcoin';

View File

@@ -11,7 +11,7 @@ import { formatAttribute, Steps } from '../utils/utils';
import { downloadZkey } from '../utils/zkeyDownload';
import useUserStore from '../stores/userStore';
import useNavigationStore from '../stores/navigationStore';
import { AppType } from '../utils/appType';
import { AppType } from '../../../common/src/utils/appType';
import useSbtStore from '../stores/sbtStore';
import CustomButton from '../components/CustomButton';

View File

@@ -7,7 +7,7 @@ import ProofGrid from '../components/ProofGrid';
import { Platform } from 'react-native';
import { blueColor, borderColor, componentBgColor, textColor1, textColor2 } from '../utils/colors';
import useNavigationStore from '../stores/navigationStore';
import { AppType } from '../utils/appType';
import { AppType } from '../../../common/src/utils/appType';
import { appStoreMapping } from './ProveScreen';
const SendProofScreen: React.FC = () => {

View File

@@ -2,7 +2,7 @@ import { create } from 'zustand'
import { IsZkeyDownloading, ShowWarningModalProps } from '../utils/zkeyDownload';
import { Steps } from '../utils/utils';
import { useToastController } from '@tamagui/toast';
import { AppType } from '../utils/appType';
import { AppType } from '../../../common/src/utils/appType';
interface NavigationState {
step: number

View File

@@ -1,80 +0,0 @@
import { CircuitName } from "./zkeyDownload";
type DisclosureOption = "required" | "optional";
type Disclosure = {
[key: string]: DisclosureOption;
};
export type AppType = {
id: string;
// AppScreen UI
title: string,
description: string,
background?: string,
colorOfTheText: string,
selectable: boolean,
icon: any,
tags: React.JSX.Element[]
// ProveScreen UI
name: string;
disclosureOptions: Disclosure | {};
beforeSendText1: string;
beforeSendText2: string;
sendButtonText: string;
sendingButtonText: string;
successTitle: string;
successText: string;
//successComponent: () => React.JSX.Element;
finalButtonAction: () => void;
finalButtonText: string;
scope: string;
circuit: CircuitName; // circuit and witness calculator name
fields: React.FC[];
handleProve: () => void;
handleSendProof: () => void;
}
export function createAppType(data: Partial<AppType>): AppType {
return {
id: data.id || "",
title: data.title || "",
description: data.description || "",
background: data.background || "",
colorOfTheText: data.colorOfTheText || "",
selectable: data.selectable !== undefined ? data.selectable : false,
icon: data.icon || null,
tags: data.tags || [],
name: data.name || "",
disclosureOptions: data.disclosureOptions || {},
beforeSendText1: data.beforeSendText1 || "",
beforeSendText2: data.beforeSendText2 || "",
sendButtonText: data.sendButtonText || "",
sendingButtonText: data.sendingButtonText || "",
successTitle: data.successTitle || "",
successText: data.successText || "",
//successComponent: data.successComponent as any,
finalButtonAction: data.finalButtonAction || (() => { }),
finalButtonText: data.finalButtonText || "",
scope: data.scope || "",
circuit: data.circuit || ("" as CircuitName), // Assuming a default value is acceptable
fields: data.fields || [],
handleProve: data.handleProve || (() => { }),
handleSendProof: data.handleSendProof || (() => { }),
};
}