Fix Errors

This commit is contained in:
abhay-raizada
2024-08-11 16:40:46 +05:30
parent 477a924fe0
commit 2f0c7ddadb
9 changed files with 721175 additions and 167 deletions

View File

@@ -8,7 +8,6 @@
import React, {useEffect, useState} from 'react'; import React, {useEffect, useState} from 'react';
import {SafeAreaView, ScrollView, StatusBar, StyleSheet} from 'react-native'; import {SafeAreaView, ScrollView, StatusBar, StyleSheet} from 'react-native';
import {getFormTemplate} from './formstr/formstr';
import {Colors} from 'react-native/Libraries/NewAppScreen'; import {Colors} from 'react-native/Libraries/NewAppScreen';
import {PrescriptionCreator} from './components/PrescriptionCreator'; import {PrescriptionCreator} from './components/PrescriptionCreator';
import 'react-native-url-polyfill/auto'; import 'react-native-url-polyfill/auto';
@@ -25,9 +24,9 @@ function App(): React.JSX.Element {
console.log('inside useeffect'); console.log('inside useeffect');
const fetchForm = async () => { const fetchForm = async () => {
if (!form) { if (!form) {
let form = await getFormTemplate( // let form = await getFormTemplate(
'eb3df1f89653475f0bcbd22da35f8d2f126db8a68a88a7abedc53535c76c39b4', // 'eb3df1f89653475f0bcbd22da35f8d2f126db8a68a88a7abedc53535c76c39b4',
); // );
} }
}; };
fetchForm(); fetchForm();

File diff suppressed because one or more lines are too long

View File

@@ -70,7 +70,7 @@ export const AddressForm: React.FC<AddressFormProps> = ({
style={styles.input} style={styles.input}
placeholder="Enter postal code..." placeholder="Enter postal code..."
value={form.postal_code} value={form.postal_code}
placeholderTextColor="light" placeholderTextColor="white"
onChangeText={(text: string) => onChangeText={(text: string) =>
handleTextChange('postal_code', text) handleTextChange('postal_code', text)
} }
@@ -82,7 +82,7 @@ export const AddressForm: React.FC<AddressFormProps> = ({
style={styles.input} style={styles.input}
placeholder="Enter Country Code..." placeholder="Enter Country Code..."
value={form.country_code} value={form.country_code}
placeholderTextColor="light" placeholderTextColor="white"
onChangeText={(text: string) => onChangeText={(text: string) =>
handleTextChange('country_code', text) handleTextChange('country_code', text)
} }

View File

@@ -69,7 +69,7 @@ export const MedicineForm: React.FC<MedicineFormProps> = ({
style={styles.input} style={styles.input}
placeholder="Enter quantity..." placeholder="Enter quantity..."
value={form.quantity} value={form.quantity}
placeholderTextColor="light" placeholderTextColor="white"
onChangeText={(text: string) => handleTextChange('quantity', text)} onChangeText={(text: string) => handleTextChange('quantity', text)}
/> />
</View> </View>
@@ -79,7 +79,7 @@ export const MedicineForm: React.FC<MedicineFormProps> = ({
style={styles.input} style={styles.input}
placeholder="Refills" placeholder="Refills"
value={form.refills} value={form.refills}
placeholderTextColor="light" placeholderTextColor="white"
onChangeText={(text: string) => handleTextChange('refills', text)} onChangeText={(text: string) => handleTextChange('refills', text)}
/> />
</View> </View>
@@ -89,7 +89,7 @@ export const MedicineForm: React.FC<MedicineFormProps> = ({
style={styles.input} style={styles.input}
placeholder="Enter directions" placeholder="Enter directions"
value={form.refills} value={form.refills}
placeholderTextColor="light" placeholderTextColor="white"
onChangeText={(text: string) => onChangeText={(text: string) =>
handleTextChange('directions', text) handleTextChange('directions', text)
} }

View File

@@ -1,32 +0,0 @@
import {SimplePool} from 'nostr-tools';
import {V1FormSpec} from '@formstr/sdk/dist/interfaces';
const relayList = ['wss://relay.primal.net/', 'wss://relay.hllo.live/'];
export const getFormTemplate = async (formId: string): Promise<{}> => {
console.log('inside getFormTemplate');
const pool = new SimplePool();
let formIdPubkey = formId;
const filter = {
kinds: [0],
authors: [formIdPubkey], //formId is the npub of the form
};
let kind0 = null
try {
console.log('inside try');
kind0 = await pool.get(relayList, filter)
console.log('Main thread is working, got event', kind0);
} catch (e) {
console.log('inside catch');
console.log('error is', e);
}
pool.close(relayList);
let formTemplate;
if (kind0) {
formTemplate = JSON.parse(kind0.content);
} else {
throw Error('Form template not found');
}
return formTemplate;
};

View File

@@ -1,121 +0,0 @@
{
"name": "X Pharmacy ",
"schemaVersion": "v1",
"settings": {
"titleImageUrl": "https://www.studentdoctor.net/wp-content/uploads/2018/08/20180815_prescription.png",
"description": "Testing formstr for getting prescriptions",
"thankYouPage": true
},
"fields": [
{
"question": "Location",
"answerType": "dropdown",
"answerSettings": {
"choices": [
{
"label": "Narnia",
"choiceId": "ae9DZi"
},
{
"label": "Hogwarts",
"choiceId": "Dx4gyn"
},
{
"label": "Mordor",
"choiceId": "oWygzo"
},
{
"label": "Tattooine",
"choiceId": "dLgxns"
}
],
"required": true
},
"questionId": "V7yEc2"
},
{
"question": "Patient",
"answerType": "label",
"answerSettings": {},
"questionId": "BPfwxq"
},
{
"question": "Name",
"answerType": "shortText",
"answerSettings": {},
"questionId": "HLydbI"
},
{
"question": "Date Of Birth ",
"answerType": "date",
"answerSettings": {},
"questionId": "lzpBhA"
},
{
"question": "Address",
"answerType": "paragraph",
"answerSettings": {},
"questionId": "Mvajrv"
},
{
"question": "Phone",
"answerType": "shortText",
"answerSettings": {},
"questionId": "PjTnfM"
},
{
"question": "Allergies",
"answerType": "shortText",
"answerSettings": {},
"questionId": "UMfscG"
},
{
"question": "Current Meds ",
"answerType": "shortText",
"answerSettings": {},
"questionId": "Cc8lih"
},
{
"question": "Medications",
"answerType": "label",
"answerSettings": {},
"questionId": "0R7uhf"
},
{
"question": "Name",
"answerType": "shortText",
"answerSettings": {},
"questionId": "WXJScB"
},
{
"question": "Dosage Form",
"answerType": "shortText",
"answerSettings": {},
"questionId": "BxEwHQ"
},
{
"question": "Strength",
"answerType": "shortText",
"answerSettings": {},
"questionId": "q2nC6e"
},
{
"question": "Quantiy ",
"answerType": "number",
"answerSettings": {},
"questionId": "fz68UV"
},
{
"question": "Re-fills",
"answerType": "shortText",
"answerSettings": {},
"questionId": "9SdbyN"
},
{
"question": "Directions",
"answerType": "paragraph",
"answerSettings": {},
"questionId": "6FrcPv"
}
]
}

View File

@@ -29,6 +29,7 @@
"react-native-picker-select": "^9.0.1", "react-native-picker-select": "^9.0.1",
"react-native-randombytes": "^3.6.1", "react-native-randombytes": "^3.6.1",
"react-native-url-polyfill": "^2.0.0", "react-native-url-polyfill": "^2.0.0",
"react-native-vector-icons": "^10.1.0",
"react-native-webview": "^13.8.4", "react-native-webview": "^13.8.4",
"react-native-webview-crypto": "^0.0.25", "react-native-webview-crypto": "^0.0.25",
"stream": "^0.0.2", "stream": "^0.0.2",
@@ -44,6 +45,7 @@
"@react-native/metro-config": "0.73.5", "@react-native/metro-config": "0.73.5",
"@react-native/typescript-config": "0.73.1", "@react-native/typescript-config": "0.73.1",
"@types/react": "^18.2.6", "@types/react": "^18.2.6",
"@types/react-native-vector-icons": "^6.4.18",
"@types/react-test-renderer": "^18.0.0", "@types/react-test-renderer": "^18.0.0",
"babel-jest": "^29.6.3", "babel-jest": "^29.6.3",
"eslint": "^8.19.0", "eslint": "^8.19.0",

721109
static/medicine_names.json Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -2137,6 +2137,21 @@
resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.11.tgz#2596fb352ee96a1379c657734d4b913a613ad563" resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.11.tgz#2596fb352ee96a1379c657734d4b913a613ad563"
integrity sha512-ga8y9v9uyeiLdpKddhxYQkxNDrfvuPrlFb0N1qnZZByvcElJaXthF1UhvCh9TLWJBEHeNtdnbysW7Y6Uq8CVng== integrity sha512-ga8y9v9uyeiLdpKddhxYQkxNDrfvuPrlFb0N1qnZZByvcElJaXthF1UhvCh9TLWJBEHeNtdnbysW7Y6Uq8CVng==
"@types/react-native-vector-icons@^6.4.18":
version "6.4.18"
resolved "https://registry.yarnpkg.com/@types/react-native-vector-icons/-/react-native-vector-icons-6.4.18.tgz#18671c617b9d0958747bc959903470dde91a8c79"
integrity sha512-YGlNWb+k5laTBHd7+uZowB9DpIK3SXUneZqAiKQaj1jnJCZM0x71GDim5JCTMi4IFkhc9m8H/Gm28T5BjyivUw==
dependencies:
"@types/react" "*"
"@types/react-native" "^0.70"
"@types/react-native@^0.70":
version "0.70.19"
resolved "https://registry.yarnpkg.com/@types/react-native/-/react-native-0.70.19.tgz#b4e651dcf7f49c69ff3a4c3072584cad93155582"
integrity sha512-c6WbyCgWTBgKKMESj/8b4w+zWcZSsCforson7UdXtXMecG3MxCinYi6ihhrHVPyUrVzORsvEzK8zg32z4pK6Sg==
dependencies:
"@types/react" "*"
"@types/react-test-renderer@^18.0.0": "@types/react-test-renderer@^18.0.0":
version "18.0.7" version "18.0.7"
resolved "https://registry.yarnpkg.com/@types/react-test-renderer/-/react-test-renderer-18.0.7.tgz#2cfe657adb3688cdf543995eceb2e062b5a68728" resolved "https://registry.yarnpkg.com/@types/react-test-renderer/-/react-test-renderer-18.0.7.tgz#2cfe657adb3688cdf543995eceb2e062b5a68728"
@@ -3039,6 +3054,15 @@ cliui@^6.0.0:
strip-ansi "^6.0.0" strip-ansi "^6.0.0"
wrap-ansi "^6.2.0" wrap-ansi "^6.2.0"
cliui@^7.0.2:
version "7.0.4"
resolved "https://registry.yarnpkg.com/cliui/-/cliui-7.0.4.tgz#a0265ee655476fc807aea9df3df8df7783808b4f"
integrity sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==
dependencies:
string-width "^4.2.0"
strip-ansi "^6.0.0"
wrap-ansi "^7.0.0"
cliui@^8.0.1: cliui@^8.0.1:
version "8.0.1" version "8.0.1"
resolved "https://registry.yarnpkg.com/cliui/-/cliui-8.0.1.tgz#0c04b075db02cbfe60dc8e6cf2f5486b1a3608aa" resolved "https://registry.yarnpkg.com/cliui/-/cliui-8.0.1.tgz#0c04b075db02cbfe60dc8e6cf2f5486b1a3608aa"
@@ -6573,7 +6597,7 @@ react-native-codegen@^0.0.7:
jscodeshift "^0.11.0" jscodeshift "^0.11.0"
nullthrows "^1.1.1" nullthrows "^1.1.1"
react-native-collapsible@^1.6.0, react-native-collapsible@^1.6.1: react-native-collapsible@^1.6.0:
version "1.6.1" version "1.6.1"
resolved "https://registry.yarnpkg.com/react-native-collapsible/-/react-native-collapsible-1.6.1.tgz#27e289831a6955aebde98abff2424a7710f36f02" resolved "https://registry.yarnpkg.com/react-native-collapsible/-/react-native-collapsible-1.6.1.tgz#27e289831a6955aebde98abff2424a7710f36f02"
integrity sha512-orF4BeiXd2hZW7fu9YcqIJXzN6TJcFcddY807D3MAOVktLuW9oQ+RIkrTJ5DR3v9ZOFfREkOjEmS79qeUTvkBQ== integrity sha512-orF4BeiXd2hZW7fu9YcqIJXzN6TJcFcddY807D3MAOVktLuW9oQ+RIkrTJ5DR3v9ZOFfREkOjEmS79qeUTvkBQ==
@@ -6659,6 +6683,14 @@ react-native-url-polyfill@^2.0.0:
dependencies: dependencies:
whatwg-url-without-unicode "8.0.0-3" whatwg-url-without-unicode "8.0.0-3"
react-native-vector-icons@^10.1.0:
version "10.1.0"
resolved "https://registry.yarnpkg.com/react-native-vector-icons/-/react-native-vector-icons-10.1.0.tgz#c98a225213700177d23492e32d1dc920b9bae8aa"
integrity sha512-fdQjCHIdoXmRoTZ5gvN1FmT4sGLQ2wmQiNZHKJQUYnE2tkIwjGnxNch+6Nd4lHAACvMWO7LOzBNot2u/zlOmkw==
dependencies:
prop-types "^15.7.2"
yargs "^16.1.1"
react-native-webview-crypto@^0.0.25: react-native-webview-crypto@^0.0.25:
version "0.0.25" version "0.0.25"
resolved "https://registry.yarnpkg.com/react-native-webview-crypto/-/react-native-webview-crypto-0.0.25.tgz#c35506e1f092f7633db684f388f2b449667a05a2" resolved "https://registry.yarnpkg.com/react-native-webview-crypto/-/react-native-webview-crypto-0.0.25.tgz#c35506e1f092f7633db684f388f2b449667a05a2"
@@ -8053,6 +8085,11 @@ yargs-parser@^18.1.2:
camelcase "^5.0.0" camelcase "^5.0.0"
decamelize "^1.2.0" decamelize "^1.2.0"
yargs-parser@^20.2.2:
version "20.2.9"
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.9.tgz#2eb7dc3b0289718fc295f362753845c41a0c94ee"
integrity sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==
yargs-parser@^21.0.1, yargs-parser@^21.1.1: yargs-parser@^21.0.1, yargs-parser@^21.1.1:
version "21.1.1" version "21.1.1"
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35"
@@ -8075,6 +8112,19 @@ yargs@^15.1.0:
y18n "^4.0.0" y18n "^4.0.0"
yargs-parser "^18.1.2" yargs-parser "^18.1.2"
yargs@^16.1.1:
version "16.2.0"
resolved "https://registry.yarnpkg.com/yargs/-/yargs-16.2.0.tgz#1c82bf0f6b6a66eafce7ef30e376f49a12477f66"
integrity sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==
dependencies:
cliui "^7.0.2"
escalade "^3.1.1"
get-caller-file "^2.0.5"
require-directory "^2.1.1"
string-width "^4.2.0"
y18n "^5.0.5"
yargs-parser "^20.2.2"
yargs@^17.3.1, yargs@^17.6.2: yargs@^17.3.1, yargs@^17.6.2:
version "17.7.2" version "17.7.2"
resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.7.2.tgz#991df39aca675a192b816e1e0363f9d75d2aa269" resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.7.2.tgz#991df39aca675a192b816e1e0363f9d75d2aa269"