mirror of
https://github.com/abhay-raizada/PeerScribe.git
synced 2026-04-26 16:24:03 +00:00
Remove unused libraries
This commit is contained in:
@@ -1,105 +0,0 @@
|
|||||||
import {
|
|
||||||
DatePicker,
|
|
||||||
DatePickerView,
|
|
||||||
InputItem,
|
|
||||||
List,
|
|
||||||
Text,
|
|
||||||
TextareaItem,
|
|
||||||
View,
|
|
||||||
} from '@ant-design/react-native';
|
|
||||||
import {V1AnswerSettings, AnswerTypes} from '@formstr/sdk/dist/interfaces';
|
|
||||||
import {useState} from 'react';
|
|
||||||
import RNPickerSelect from 'react-native-picker-select';
|
|
||||||
|
|
||||||
interface InputFillerProps {
|
|
||||||
answerType: AnswerTypes;
|
|
||||||
answerSettings: V1AnswerSettings;
|
|
||||||
onChange: (answer: string) => void;
|
|
||||||
defaultValue?: string | number | boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const InputFiller: React.FC<InputFillerProps> = ({
|
|
||||||
answerType,
|
|
||||||
answerSettings,
|
|
||||||
onChange,
|
|
||||||
defaultValue,
|
|
||||||
}) => {
|
|
||||||
const [inputValue, setInputValue] = useState('');
|
|
||||||
const handleInputChange = (e: any) => {
|
|
||||||
console.log('E is', e);
|
|
||||||
setInputValue(e);
|
|
||||||
onChange(e);
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleValueChange = (value: string) => {
|
|
||||||
if (!value) return;
|
|
||||||
setInputValue(value);
|
|
||||||
onChange(value);
|
|
||||||
};
|
|
||||||
|
|
||||||
const getInput = (
|
|
||||||
answerType: AnswerTypes,
|
|
||||||
answerSettings: V1AnswerSettings,
|
|
||||||
) => {
|
|
||||||
const dropdownItems = (answerSettings.choices || []).map(choice => {
|
|
||||||
return {
|
|
||||||
label: choice.label,
|
|
||||||
value: choice.choiceId,
|
|
||||||
key: choice.choiceId,
|
|
||||||
};
|
|
||||||
});
|
|
||||||
const INPUT_TYPE_COMPONENT_MAP: {[key in AnswerTypes]?: JSX.Element} = {
|
|
||||||
[AnswerTypes.label]: <></>,
|
|
||||||
[AnswerTypes.shortText]: (
|
|
||||||
<InputItem
|
|
||||||
onChange={handleValueChange}
|
|
||||||
defaultValue={defaultValue as string}
|
|
||||||
placeholder="enter a value..."
|
|
||||||
placeholderTextColor="#aaaaaa"></InputItem>
|
|
||||||
),
|
|
||||||
[AnswerTypes.paragraph]: (
|
|
||||||
<TextareaItem
|
|
||||||
rows={10}
|
|
||||||
placeholder="enter a value.."
|
|
||||||
placeholderTextColor="#aaaaaa"
|
|
||||||
onChange={handleInputChange}
|
|
||||||
autoHeight
|
|
||||||
style={{paddingVertical: 5}}
|
|
||||||
/>
|
|
||||||
),
|
|
||||||
[AnswerTypes.number]: <View></View>,
|
|
||||||
[AnswerTypes.radioButton]: <View></View>,
|
|
||||||
[AnswerTypes.checkboxes]: <View></View>,
|
|
||||||
[AnswerTypes.dropdown]: (
|
|
||||||
<RNPickerSelect
|
|
||||||
onValueChange={handleValueChange}
|
|
||||||
items={dropdownItems}
|
|
||||||
placeholder={{}}
|
|
||||||
key="picker"
|
|
||||||
value={inputValue}>
|
|
||||||
<Text>
|
|
||||||
{inputValue
|
|
||||||
? answerSettings.choices?.filter(choice => {
|
|
||||||
return choice.choiceId === inputValue;
|
|
||||||
})[0].label
|
|
||||||
: 'Select an option'}
|
|
||||||
</Text>
|
|
||||||
</RNPickerSelect>
|
|
||||||
),
|
|
||||||
[AnswerTypes.date]: (
|
|
||||||
<List>
|
|
||||||
<DatePicker key="Datepicker" />
|
|
||||||
</List>
|
|
||||||
),
|
|
||||||
[AnswerTypes.time]: (
|
|
||||||
<List>
|
|
||||||
<DatePicker key="time" />
|
|
||||||
</List>
|
|
||||||
),
|
|
||||||
};
|
|
||||||
|
|
||||||
return INPUT_TYPE_COMPONENT_MAP[answerType];
|
|
||||||
};
|
|
||||||
|
|
||||||
return <>{getInput(answerType, answerSettings)}</>;
|
|
||||||
};
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import {Text, TextInput, View} from 'react-native';
|
import {Text, TextInput, View} from 'react-native';
|
||||||
import {Section} from './Section';
|
import {styles, TextTheme} from '../common/styles';
|
||||||
import {styles, TextTheme} from './styles';
|
|
||||||
import {useState} from 'react';
|
import {useState} from 'react';
|
||||||
|
import {Section} from '../common/Section';
|
||||||
|
|
||||||
interface AddressForm {
|
interface AddressForm {
|
||||||
address_line_1?: string;
|
address_line_1?: string;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import {Text, TextInput, View} from 'react-native';
|
import {Text, TextInput, View} from 'react-native';
|
||||||
import {Section} from './Section';
|
import {Section} from '../common/Section';
|
||||||
import {styles, TextTheme} from './styles';
|
import {styles, TextTheme} from '../common/styles';
|
||||||
import {useState} from 'react';
|
import {useState} from 'react';
|
||||||
|
|
||||||
interface MedicineForm {
|
interface MedicineForm {
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
import {Text, TextInput, View} from 'react-native';
|
import {Text, TextInput, View, Button} from 'react-native';
|
||||||
import {Section} from './Section';
|
import {Section} from '../common/Section';
|
||||||
import {styles, TextTheme} from './styles';
|
import {styles, TextTheme} from '../common/styles';
|
||||||
import {useState} from 'react';
|
import {useState} from 'react';
|
||||||
import DatePicker from 'react-native-date-picker';
|
import DatePicker from 'react-native-date-picker';
|
||||||
import {Button} from '@ant-design/react-native';
|
|
||||||
|
|
||||||
interface PatientForm {
|
interface PatientForm {
|
||||||
name?: string;
|
name?: string;
|
||||||
@@ -46,21 +45,19 @@ export const PatientForm: React.FC<PatientFormProps> = ({
|
|||||||
<View>
|
<View>
|
||||||
<Text style={TextTheme}>{form.date_of_birth}</Text>
|
<Text style={TextTheme}>{form.date_of_birth}</Text>
|
||||||
<Button
|
<Button
|
||||||
size="small"
|
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
setOpenDate(true);
|
setOpenDate(true);
|
||||||
}}>
|
}}
|
||||||
Edit
|
title="Edit"
|
||||||
</Button>
|
/>
|
||||||
</View>
|
</View>
|
||||||
) : (
|
) : (
|
||||||
<Button
|
<Button
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
setOpenDate(true);
|
setOpenDate(true);
|
||||||
}}
|
}}
|
||||||
size="small">
|
title="Pick a date"
|
||||||
Pick a date
|
/>
|
||||||
</Button>
|
|
||||||
)}
|
)}
|
||||||
<DatePicker
|
<DatePicker
|
||||||
modal
|
modal
|
||||||
|
|||||||
@@ -1,8 +1,14 @@
|
|||||||
import {Alert, Appearance, Dimensions, Image, Text, View} from 'react-native';
|
import {
|
||||||
|
Alert,
|
||||||
|
Appearance,
|
||||||
|
Dimensions,
|
||||||
|
Image,
|
||||||
|
Text,
|
||||||
|
View,
|
||||||
|
Button,
|
||||||
|
} from 'react-native';
|
||||||
import {Colors} from 'react-native/Libraries/NewAppScreen';
|
import {Colors} from 'react-native/Libraries/NewAppScreen';
|
||||||
import {useEffect, useState} from 'react';
|
import {useEffect, useState} from 'react';
|
||||||
import {Button} from '@ant-design/react-native';
|
|
||||||
// import { SendPrescription } from './sendPrescription';
|
|
||||||
import {Dropdown} from 'react-native-element-dropdown';
|
import {Dropdown} from 'react-native-element-dropdown';
|
||||||
import {
|
import {
|
||||||
SimplePool,
|
SimplePool,
|
||||||
@@ -14,7 +20,7 @@ import {
|
|||||||
} from 'nostr-tools';
|
} from 'nostr-tools';
|
||||||
import EncryptedStorage from 'react-native-encrypted-storage';
|
import EncryptedStorage from 'react-native-encrypted-storage';
|
||||||
import {ImportNsec} from './ImportNsec';
|
import {ImportNsec} from './ImportNsec';
|
||||||
import {Section} from './Section';
|
import {Section} from '../common/Section';
|
||||||
import {PatientForm} from './PatientForm';
|
import {PatientForm} from './PatientForm';
|
||||||
import {AddressForm} from './AddressForm';
|
import {AddressForm} from './AddressForm';
|
||||||
import {MedicineForm} from './MedicineForm';
|
import {MedicineForm} from './MedicineForm';
|
||||||
@@ -203,12 +209,11 @@ export const PrescriptionCreator = () => {
|
|||||||
<Section title="PeerScribe">
|
<Section title="PeerScribe">
|
||||||
From the practice of {loggedInNpub}
|
From the practice of {loggedInNpub}
|
||||||
<Button
|
<Button
|
||||||
size="small"
|
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
setShowImportNsec(true);
|
setShowImportNsec(true);
|
||||||
}}>
|
}}
|
||||||
Edit!
|
title="edit"
|
||||||
</Button>
|
/>
|
||||||
</Section>
|
</Section>
|
||||||
|
|
||||||
<Section title="Choose a Pharmacy">
|
<Section title="Choose a Pharmacy">
|
||||||
@@ -232,17 +237,16 @@ export const PrescriptionCreator = () => {
|
|||||||
<PatientForm nestedFormCallback={nestedFormCallback} />
|
<PatientForm nestedFormCallback={nestedFormCallback} />
|
||||||
<AddressForm nestedFormCallback={nestedFormCallback} />
|
<AddressForm nestedFormCallback={nestedFormCallback} />
|
||||||
<MedicineForm nestedFormCallback={nestedFormCallback} />
|
<MedicineForm nestedFormCallback={nestedFormCallback} />
|
||||||
<Button type="primary" onPress={handleButtonPress}>
|
<Button onPress={handleButtonPress} title="Create Rx" />
|
||||||
<Text
|
{/* <Text
|
||||||
style={[
|
style={[
|
||||||
{
|
{
|
||||||
color: Colors.light,
|
color: Colors.light,
|
||||||
},
|
},
|
||||||
]}>
|
]}>
|
||||||
{' '}
|
{' '}
|
||||||
Create RX{' '}
|
|
||||||
</Text>
|
</Text>
|
||||||
</Button>
|
</Button> */}
|
||||||
</View>
|
</View>
|
||||||
</Section>
|
</Section>
|
||||||
<ImportNsec
|
<ImportNsec
|
||||||
|
|||||||
@@ -10,8 +10,6 @@
|
|||||||
"test": "jest"
|
"test": "jest"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ant-design/react-native": "^5.1.0",
|
|
||||||
"@formstr/sdk": "^0.0.4-alpha",
|
|
||||||
"@react-native-community/datetimepicker": "^8.0.1",
|
"@react-native-community/datetimepicker": "^8.0.1",
|
||||||
"@react-native-community/segmented-control": "^2.2.2",
|
"@react-native-community/segmented-control": "^2.2.2",
|
||||||
"@react-native-community/slider": "^4.5.0",
|
"@react-native-community/slider": "^4.5.0",
|
||||||
|
|||||||
Reference in New Issue
Block a user