Skip to content

Commit

Permalink
single page app
Browse files Browse the repository at this point in the history
  • Loading branch information
Naveen-g09 committed Jan 3, 2024
1 parent 3f67096 commit e5dfcc0
Show file tree
Hide file tree
Showing 13 changed files with 837 additions and 99 deletions.
15 changes: 15 additions & 0 deletions api.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// api.js

import { useQuery } from "react-query";

import turso from "./database";

const fetchCallLogs = async () => {
const query = "SELECT * FROM call_logs";
const result = await turso.query(query);
return result;
};

export const useCallLogs = () => {
return useQuery("callLogs", fetchCallLogs);
};
7 changes: 0 additions & 7 deletions app/(tabs)/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,6 @@ export default function TabLayout() {
),
}}
/>
<Tabs.Screen
name="logs"
options={{
title: "Logs",
tabBarIcon: ({ color }) => <TabBarIcon name="code" color={color} />,
}}
/>
</Tabs>
);
}
2 changes: 2 additions & 0 deletions app/(tabs)/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import { FlatList, TouchableOpacity, Linking, Platform } from "react-native";
import RNImmediatePhoneCall from "react-native-immediate-phone-call";
import call from "react-native-phone-call";

import { useCallLogs } from "../../api";
import { Text, View } from "../../components/Themed";
// import { syncCallLogsToCloud } from "../../sync";

interface Task {
id: string;
Expand Down
87 changes: 0 additions & 87 deletions app/(tabs)/logs.tsx

This file was deleted.

1 change: 1 addition & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module.exports = function (api) {
plugins: [
"expo-router/babel",
"nativewind/babel",
["inline-import", { extensions: [".sql"] }],
[
"module:react-native-dotenv",
{
Expand Down
9 changes: 9 additions & 0 deletions database.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// database.js

import * as SQLite from "expo-sqlite";
import Turso from "turso";

const db = SQLite.openDatabase("call_logs.db");
const turso = new Turso(db);

export default turso;
6 changes: 6 additions & 0 deletions drizzle.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import type { Config } from "drizzle-kit";
export default {
schema: "./db/schema.ts",
out: "./drizzle",
driver: "expo", // <--- very important
} satisfies Config;
1 change: 1 addition & 0 deletions drizzle/meta/_journal.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"version":"5","dialect":"sqlite","entries":[]}
9 changes: 9 additions & 0 deletions drizzleOptions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// drizzleOptions.js

import CallLogContract from "./contracts/CallLogContract.json"; // You'll need to create this file

const options = {
contracts: [CallLogContract],
};

export default options;
2 changes: 2 additions & 0 deletions metro.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ const config = getDefaultConfig(__dirname, {
// [Web-only]: Enables CSS support in Metro.
isCSSEnabled: true,
});

config.resolver.sourceExts.push("sql");
module.exports = {
...config,
watchFolders: [path.resolve(__dirname, "..")],
Expand Down
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,21 @@
"@babel/runtime": "^7.23.5",
"@expo/metro-config": "^0.10.7",
"@expo/vector-icons": "^13.0.0",
"@libsql/client": "^0.4.0-pre.5",
"@react-native-async-storage/async-storage": "1.18.2",
"@react-navigation/native": "^6.1.9",
"@react-navigation/native-stack": "^6.9.17",
"@shopify/flash-list": "1.4.3",
"@shopify/react-native-skia": "0.1.196",
"@twilio/voice-react-native-sdk": "^1.0.0-rc8",
"babel-plugin-inline-import": "^3.0.0",
"babel-plugin-macros": "^3.1.0",
"class-variance-authority": "^0.7.0",
"clsx": "^2.0.0",
"cn": "^0.1.1",
"cva": "^0.0.0",
"dotenv": "^16.3.1",
"drizzle-orm": "^0.29.3",
"eas-cli": "^5.9.3",
"expo": "^49.0.21",
"expo-av": "~13.4.1",
Expand All @@ -41,6 +44,7 @@
"expo-media-library": "15.4.1",
"expo-router": "^2.0.0",
"expo-splash-screen": "~0.20.5",
"expo-sqlite": "~11.3.3",
"expo-status-bar": "~1.6.0",
"expo-system-ui": "~2.4.0",
"expo-web-browser": "~12.3.2",
Expand All @@ -60,6 +64,7 @@
"react-native-safe-area-context": "4.6.3",
"react-native-safearea-height": "^1.0.6",
"react-native-screens": "~3.22.0",
"react-native-sqlite-storage": "^6.0.1",
"react-native-tailwindcss": "^1.1.11",
"react-native-url-polyfill": "^2.0.0",
"react-native-view-shot": "3.7.0",
Expand All @@ -75,6 +80,7 @@
"@babel/core": "^7.20.0",
"@types/react": "~18.2.14",
"@types/react-native": "^0.72.8",
"drizzle-kit": "^0.20.9",
"eslint": "^8.56.0",
"eslint-config-universe": "^12.0.0",
"jest": "^29.2.1",
Expand Down
7 changes: 7 additions & 0 deletions sync.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// sync.js

const syncCallTasksFromCloud = async () => {
// Implement logic to sync call tasks from the cloud to the mobile app
};

export { syncCallTasksFromCloud };
Loading

0 comments on commit e5dfcc0

Please sign in to comment.