Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring-Layout #4

Open
wants to merge 47 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
036dce9
initial commit
Naveen-g09 Dec 26, 2023
f24f743
removing unwanted files
Naveen-g09 Dec 27, 2023
05ad85f
setupping up tab router
Naveen-g09 Dec 27, 2023
f70643a
Merge branch 'refactoring-ui' of https://github.com/Technoculture/VVS…
Naveen-g09 Dec 27, 2023
a5baabb
clearing naming conventions
Naveen-g09 Dec 27, 2023
becf363
configuring tailwind
Naveen-g09 Dec 27, 2023
c436415
twilio configuration
Naveen-g09 Dec 28, 2023
41be856
addition of react native call function
Naveen-g09 Dec 30, 2023
dfb67a3
call and logs feature
Naveen-g09 Jan 2, 2024
b4d4296
trying refcatoring call log
Naveen-g09 Jan 2, 2024
8f3f01c
commit before merge
Naveen-g09 Jan 2, 2024
4783c45
single page app
Naveen-g09 Jan 3, 2024
109d4c1
api-feature
Naveen-g09 Jan 3, 2024
e52fcda
pull-to-refresh
Naveen-g09 Jan 3, 2024
75c32d8
small lint fix
Naveen-g09 Jan 3, 2024
1b8c188
turso and drizzle configuration
Naveen-g09 Jan 4, 2024
0fd89d7
configured turso and drizzle
Naveen-g09 Jan 5, 2024
d7feedf
incomplete setup
Naveen-g09 Jan 5, 2024
dc7faef
multi-database setup
Naveen-g09 Jan 5, 2024
6d40012
chore: factoring index.tsx
Naveen-g09 Jan 5, 2024
4a58a87
chore: minor fixes
Naveen-g09 Jan 5, 2024
274657b
clouflare configuration
Naveen-g09 Jan 6, 2024
1939dda
chore: little fixing
Naveen-g09 Jan 6, 2024
d6ad865
resolving bundle package issue
Naveen-g09 Jan 9, 2024
332fa47
fix:render item error
Naveen-g09 Jan 9, 2024
7f3b164
fix:api fetch
Naveen-g09 Jan 9, 2024
4b32ec4
fix:api fetching in log
Naveen-g09 Jan 10, 2024
87ae6aa
fix:flat list render complete
Naveen-g09 Jan 10, 2024
5ad6562
feature: call list fetch and post complete
Naveen-g09 Jan 10, 2024
229c84c
fix: minor fixes
Naveen-g09 Jan 10, 2024
192bf1a
feature: add settings page
Naveen-g09 Jan 11, 2024
8473a3b
trial: posting call-logs
Naveen-g09 Jan 11, 2024
652aa21
Trial: Post to db
Naveen-g09 Jan 11, 2024
ef039dd
mid-fix: call logs post is logging
Naveen-g09 Jan 12, 2024
7c968c7
trial: call logs fetch test
Naveen-g09 Jan 12, 2024
1e53f41
feat: filtering call-logs
Naveen-g09 Jan 12, 2024
5eb2c4a
fix: trial to call log filter
Naveen-g09 Jan 13, 2024
8f83792
feat: fetching conacts and saving
Naveen-g09 Jan 13, 2024
ce44694
feat: filtering call logs
Naveen-g09 Jan 13, 2024
525d1fb
try: posting to callLogs
Naveen-g09 Jan 13, 2024
c58ad3c
chore: cors setup in cloudflare
Naveen-g09 Jan 15, 2024
c6daee2
fix:minor
Naveen-g09 Jan 15, 2024
abbc153
chore: trying new worker
Naveen-g09 Jan 15, 2024
c048e2b
chore: fixing post req
Naveen-g09 Jan 16, 2024
bcd2fe9
chore: fianl tests
Naveen-g09 Jan 17, 2024
8818c4e
fix: this gives the toast of callLogs posted
Naveen-g09 Jan 17, 2024
88b3ca3
fix: little padding
Naveen-g09 Jan 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .env.sample

This file was deleted.

28 changes: 14 additions & 14 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout commit
uses: actions/checkout@v3
- name: Checkout commit
uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18

- name: Install Dependencies
run: yarn install
- name: Install Dependencies
run: yarn install

- name: Lint
run: yarn lint
- name: Lint
run: yarn lint

- name: Formatting Check
run: npm run format-check
- name: Formatting Check
run: npm run format-check

- name: Type check
run: npm run type-check
- name: Type check
run: npm run type-check
3 changes: 1 addition & 2 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,4 @@ jobs:
with:
# `github.event.pull_request.head.ref` is only available on `pull_request` triggers.
# Use your own, or keep the automatically infered branch name from `--auto`, when using different triggers.
command: eas update --auto --branch ${{ github.event.pull_request.head.ref }}

command: eas update --auto --branch ${{ github.event.pull_request.head.ref }}
2 changes: 1 addition & 1 deletion .github/workflows/update.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: update
on:
push:
push:
branches:
- release

Expand Down
5 changes: 1 addition & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,5 @@
"editor.formatOnSaveMode": "modifications",
"editor.formatOnSave": true,
"editor.formatOnPaste": true,
"cSpell.words": [
"chatbubble",
"Ionicons"
]
"cSpell.words": ["chatbubble", "Ionicons"]
}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Ella
# vvsales

# TODOs

Expand All @@ -25,5 +25,5 @@ yarn run ios --clear
# Troubleshooting

```txt
watchman watch-del 'project location/Ella' ; watchman watch-project 'project location/Ella'
watchman watch-del 'project location/vvsales' ; watchman watch-project 'project location/vvsales'
```
30 changes: 11 additions & 19 deletions app.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"expo": {
"name": "ella",
"slug": "DrElla",
"name": "vvsales",
"slug": "vvsales",
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/images/icon.png",
Expand All @@ -15,35 +15,27 @@
"assetBundlePatterns": ["**/*"],
"ios": {
"supportsTablet": true,
"bundleIdentifier": "com.technoculture.ella"
"bundleIdentifier": "com.technoculture.vvsales"
},
"android": {
"adaptiveIcon": {
"foregroundImage": "./assets/images/adaptive-icon.png",
"backgroundColor": "#ffffff"
},
"package": "com.technoculture.ella"
"package": "com.technoculture.vvsales",
"permissions": [
"android.permission.CAMERA",
"android.permission.RECORD_AUDIO",
"android.permission.CALL_PHONE"
]
},
"web": {
"bundler": "metro",
"output": "static",
"favicon": "./assets/images/favicon.png"
},
"plugins": [
"expo-router",
[
"expo-camera",
{
"cameraPermission": "Allow $(PRODUCT_NAME) to access your camera.",
"microphonePermission": "Allow $(PRODUCT_NAME) to access your mic."
}
],
[
"expo-document-picker",
{
"iCloudContainerEnvironment": "Production"
}
]
"expo-router"
],
"experiments": {
"typedRoutes": true
Expand All @@ -53,7 +45,7 @@
"origin": false
},
"eas": {
"projectId" :"dfde4001-b00b-4a77-a028-7d966b8f9e3d"
"projectId": "a463d91b-3ec0-4653-837a-93a87a5b687d"
}
},
"owner": "technoculture"
Expand Down
59 changes: 59 additions & 0 deletions app/(tabs)/_layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import FontAwesome from "@expo/vector-icons/FontAwesome";
import { Link, Tabs } from "expo-router";
import React from "react";
import { Pressable, useColorScheme } from "react-native";

import Colors from "../../constants/Colors";

/**
* You can explore the built-in icon families and icons on the web at https://icons.expo.fyi/
*/
function TabBarIcon(props: {
name: React.ComponentProps<typeof FontAwesome>["name"];
color: string;
}) {
return <FontAwesome size={28} className="mb-[-3]" {...props} />;
}

export default function TabLayout() {
const colorScheme = useColorScheme();

return (
<Tabs
screenOptions={{
tabBarActiveTintColor: Colors[colorScheme ?? "light"].tint,
}}
>
<Tabs.Screen
name="index"
options={{
title: "Tasks",
tabBarIcon: ({ color }) => <TabBarIcon name="code" color={color} />,
headerRight: () => (
<Link href="/inbox" asChild>
<Pressable>
{({ pressed }) => (
<FontAwesome
name="info-circle"
size={25}
color={Colors[colorScheme ?? "light"].text}
className={`mr-15 ${
pressed ? "opacity-50" : "opacity-100"
}`}
/>
)}
</Pressable>
</Link>
),
}}
/>
<Tabs.Screen
name="logs"
options={{
title: "Logs",
tabBarIcon: ({ color }) => <TabBarIcon name="code" color={color} />,
}}
/>
</Tabs>
);
}
118 changes: 118 additions & 0 deletions app/(tabs)/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
import { Image } from "expo-image";
import React, { useState, useEffect, useCallback } from "react";
import { FlatList, TouchableOpacity, RefreshControl } from "react-native";
import RNImmediatePhoneCall from "react-native-immediate-phone-call";
import call from "react-native-phone-call";

import { Text, View } from "../../components/Themed";
import { getTasks, updateTask, getContactNumbers } from "../../lib/db_helpers";
import { Task } from "../../lib/types";

export default function TabOneScreen() {
const [tasks, setTasks] = useState<Task[]>([]);
const [refreshing, setRefreshing] = useState(false);

const fetchTasks = async () => {
try {
const tasks = await getTasks();
setTasks(tasks);
} catch (error) {
console.error("Error fetching tasks:", error);
}
};

const handleRefresh = useCallback(async () => {
setRefreshing(true);
await fetchTasks();
await getContactNumbers();
setRefreshing(false);
}, []);
useEffect(() => {
fetchTasks();
getContactNumbers();
const intervalId = setInterval(() => {
fetchTasks();
}, 30 * 1000);
return () => clearInterval(intervalId);
}, []);

const handleCallPress = async (contactNumber: string, taskId: number) => {
try {
await updateTask(taskId);
await fetchTasks();
RNImmediatePhoneCall.immediatePhoneCall(contactNumber);
} catch (error) {
console.error("Error handling call press:", error);
}
};

// Uncomment the following code to use react-native-phone-call instead of react-native-immediate-phone-call
// const handleCallPress = (contactNumber: string, taskId: string) => {
// const args = {
// number: contactNumber,
// prompt: false,
// };
// updateTrials(taskId);
// call(args).catch(console.error);
// };

return (
<View className="flex-1 items-center justify-center">
{tasks ? (
tasks.length === 0 ? (
<Text>No tasks available.</Text>
) : (
<FlatList
className="w-full p-4"
data={tasks.rows}
keyExtractor={(item) => item[0].toString()}
renderItem={({ item }: { item: Task[] }) => {
const task = item;
try {
return (
<View className="flex-row items-center w-full p-4 border-b border-black">
<View className="flex-1">
<Text className="text-xl font-bold mb-2">{`Name: ${task[1]}`}</Text>
<Text>{`Trials: ${task[5]}`}</Text>
<View className="flex-row">
<Text>{`City: ${task[3]}`}</Text>
<Text className="mx-2">|</Text>
<Text>{`State: ${task[4]}`}</Text>
</View>
<Text className="mt-2 font-bold">{`Contact Number: ${task[2]}`}</Text>
{/* <Text>{`ID: ${task[0]}`}</Text> */}
</View>
<TouchableOpacity
className="p-2 ml-auto"
onPress={() => handleCallPress(task[2], task[0])}
>
{/* <Text className="text-blue-500">Call</Text> */}
<Image
className="w-10 h-10"
source={require("../../assets/images/call-icon.png")}
contentFit="cover"
transition={1000}
/>
</TouchableOpacity>
</View>
);
} catch (error) {
console.error("Error rendering item:", error);
return null;
}
}}
refreshControl={
<RefreshControl
refreshing={refreshing}
onRefresh={handleRefresh}
/>
}
/>
)
) : (
<Text>Loading...</Text>
)}
</View>
);
}
Loading
Loading