Skip to content

Commit d6c361f

Browse files
committed
Formatting
1 parent 080f9b3 commit d6c361f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+427
-382
lines changed

demos/react-native-supabase-group-chat/.prettierignore

Lines changed: 0 additions & 8 deletions
This file was deleted.

demos/react-native-supabase-group-chat/.prettierrc

Lines changed: 0 additions & 10 deletions
This file was deleted.

demos/react-native-supabase-group-chat/app.config.ts

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,69 @@
1-
import { type ExpoConfig } from "expo/config";
1+
import { type ExpoConfig } from 'expo/config';
22

3-
import { config as dotenvConfig } from "dotenv";
4-
import path from "path";
3+
import { config as dotenvConfig } from 'dotenv';
4+
import path from 'path';
55

66
// EAS doesn't load values from `.env` by default when consider the `app.config`
77
dotenvConfig({
8-
path: path.resolve(__dirname, ".env")
8+
path: path.resolve(__dirname, '.env')
99
});
1010

1111
const projectId = process.env.EXPO_PUBLIC_EAS_PROJECT_ID;
1212

1313
const config: ExpoConfig = {
14-
name: "react-native-supabase-group-chat",
15-
slug: "react-native-supabase-group-chat",
16-
version: "1.0.0",
17-
orientation: "portrait",
18-
icon: "./assets/icon.png",
19-
userInterfaceStyle: "automatic",
20-
scheme: "powersync",
14+
name: 'react-native-supabase-group-chat',
15+
slug: 'react-native-supabase-group-chat',
16+
version: '1.0.0',
17+
orientation: 'portrait',
18+
icon: './assets/icon.png',
19+
userInterfaceStyle: 'automatic',
20+
scheme: 'powersync',
2121
newArchEnabled: true,
2222
splash: {
23-
image: "./assets/splash.png",
24-
resizeMode: "contain",
25-
backgroundColor: "#ffffff"
23+
image: './assets/splash.png',
24+
resizeMode: 'contain',
25+
backgroundColor: '#ffffff'
2626
},
2727
updates: {
2828
url: `https://u.expo.dev/${projectId}`
2929
},
3030
ios: {
3131
supportsTablet: true,
32-
bundleIdentifier: "com.powersync.powerchat"
32+
bundleIdentifier: 'com.powersync.powerchat'
3333
},
3434
android: {
3535
adaptiveIcon: {
36-
foregroundImage: "./assets/adaptive-icon.png",
37-
backgroundColor: "#ffffff"
36+
foregroundImage: './assets/adaptive-icon.png',
37+
backgroundColor: '#ffffff'
3838
},
39-
package: "com.powersync.powerchat"
39+
package: 'com.powersync.powerchat'
4040
},
4141
extra: {
4242
eas: {
4343
projectId
4444
},
4545
updates: {
46-
assetPatternsToBeBundled: ["**/*"]
46+
assetPatternsToBeBundled: ['**/*']
4747
}
4848
},
4949
plugins: [
50-
"expo-router",
51-
"expo-font",
50+
'expo-router',
51+
'expo-font',
5252
[
53-
"expo-build-properties",
53+
'expo-build-properties',
5454
{
5555
ios: {
56-
deploymentTarget: "15.1"
56+
deploymentTarget: '15.1'
5757
},
5858
android: {
5959
minSdkVersion: 24,
6060
compileSdkVersion: 35,
6161
targetSdkVersion: 35,
62-
buildToolsVersion: "35.0.0"
62+
buildToolsVersion: '35.0.0'
6363
}
6464
}
6565
],
66-
"expo-dev-client"
66+
'expo-dev-client'
6767
]
6868
};
6969

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
module.exports = function (api) {
22
api.cache(true);
33
return {
4-
presets: ["babel-preset-expo"],
4+
presets: ['babel-preset-expo'],
55
plugins: [
66
[
7-
"@tamagui/babel-plugin",
7+
'@tamagui/babel-plugin',
88
{
9-
components: ["tamagui"],
10-
config: "./src/tamagui.config.ts"
9+
components: ['tamagui'],
10+
config: './src/tamagui.config.ts'
1111
}
1212
],
13-
"@babel/plugin-transform-async-generator-functions",
14-
"react-native-worklets/plugin"
13+
'@babel/plugin-transform-async-generator-functions',
14+
'react-native-worklets/plugin'
1515
]
1616
};
1717
};
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
// https://docs.expo.dev/guides/using-eslint/
2-
const { defineConfig } = require("eslint/config");
3-
const expoConfig = require("eslint-config-expo/flat");
2+
const { defineConfig } = require('eslint/config');
3+
const expoConfig = require('eslint-config-expo/flat');
44

55
module.exports = defineConfig([
66
expoConfig,
77
{
8-
ignores: ["dist/*"]
8+
ignores: ['dist/*']
99
}
1010
]);

demos/react-native-supabase-group-chat/src/app/(app)/(chats)/_layout.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
import { usePowerSync } from "@powersync/react-native";
2-
import { UserCog } from "@tamagui/lucide-icons";
3-
import { Link, Stack, useLocalSearchParams } from "expo-router";
4-
import { useEffect, useState } from "react";
1+
import { usePowerSync } from '@powersync/react-native';
2+
import { UserCog } from '@tamagui/lucide-icons';
3+
import { Link, Stack, useLocalSearchParams } from 'expo-router';
4+
import { useEffect, useState } from 'react';
55

6-
import { Loading } from "@/components/loading/Loading";
6+
import { Loading } from '@/components/loading/Loading';
77

88
export default function ChatsLayout() {
99
const { group: groupId } = useLocalSearchParams<{ group: string }>();
1010
const powerSync = usePowerSync();
1111
const [isInitialSyncCompleted, setIsInitialSyncCompleted] = useState(false);
1212

1313
async function checkForInitialSync() {
14-
const initialSync = await powerSync.execute("SELECT name FROM ps_buckets WHERE last_applied_op > 0 LIMIT 1");
14+
const initialSync = await powerSync.execute('SELECT name FROM ps_buckets WHERE last_applied_op > 0 LIMIT 1');
1515
if (initialSync.rows?._array?.length) {
1616
setIsInitialSyncCompleted(true);
1717
} else {
@@ -31,12 +31,12 @@ export default function ChatsLayout() {
3131

3232
return (
3333
<Stack>
34-
<Stack.Screen name="index" options={{ title: "Chats" }} />
35-
<Stack.Screen name="c" options={{ title: "Contact" }} />
34+
<Stack.Screen name="index" options={{ title: 'Chats' }} />
35+
<Stack.Screen name="c" options={{ title: 'Contact' }} />
3636
<Stack.Screen
3737
name="g"
3838
options={{
39-
title: "Group",
39+
title: 'Group',
4040
headerRight: (props) => (
4141
<Link href={`/(app)/(chats)/g/${groupId}/settings`}>
4242
<UserCog size="$1.5" color={props.tintColor} />

demos/react-native-supabase-group-chat/src/app/(app)/(chats)/c/[profile]/_layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Stack } from "expo-router";
1+
import { Stack } from 'expo-router';
22

33
export default function ChatsContactLayout() {
44
return (

demos/react-native-supabase-group-chat/src/app/(app)/(chats)/c/[profile]/index.tsx

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
import { faker } from "@faker-js/faker";
2-
import { usePowerSync, useQuery } from "@powersync/react-native";
3-
import { FlashList } from "@shopify/flash-list";
4-
import { useLocalSearchParams } from "expo-router";
5-
import { useEffect, useState } from "react";
6-
import { Button, Input, YStack } from "tamagui";
1+
import { faker } from '@faker-js/faker';
2+
import { usePowerSync, useQuery } from '@powersync/react-native';
3+
import { FlashList } from '@shopify/flash-list';
4+
import { useLocalSearchParams } from 'expo-router';
5+
import { useEffect, useState } from 'react';
6+
import { Button, Input, YStack } from 'tamagui';
77

8-
import { Message } from "@/components/messages/Message";
9-
import { uuid } from "@/lib/uuid";
10-
import { useAuth } from "@/providers/AuthProvider";
8+
import { Message } from '@/components/messages/Message';
9+
import { uuid } from '@/lib/uuid';
10+
import { useAuth } from '@/providers/AuthProvider';
1111

1212
export default function ChatsChatIndex() {
1313
const { profile: profileId } = useLocalSearchParams<{ profile: string }>();
1414
const { user } = useAuth();
1515
const powerSync = usePowerSync();
16-
const { data: profiles } = useQuery("SELECT id, name, handle, demo FROM profiles WHERE id = ?", [profileId]);
16+
const { data: profiles } = useQuery('SELECT id, name, handle, demo FROM profiles WHERE id = ?', [profileId]);
1717
const profile = profiles.length ? profiles[0] : undefined;
1818
const [draftId, setDraftId] = useState<string>();
1919
const [listMessages, setListMessages] = useState<any[]>([]);
2020

2121
const { data: messages } = useQuery(
22-
"SELECT sender_id, content, created_at FROM messages WHERE (((sender_id = ?1 AND recipient_id = ?2) OR (sender_id = ?2 AND recipient_id = ?1)) AND NOT (sender_id = ?1 AND sent_at IS NULL)) ORDER BY created_at ASC",
22+
'SELECT sender_id, content, created_at FROM messages WHERE (((sender_id = ?1 AND recipient_id = ?2) OR (sender_id = ?2 AND recipient_id = ?1)) AND NOT (sender_id = ?1 AND sent_at IS NULL)) ORDER BY created_at ASC',
2323
[user?.id, profile?.id]
2424
);
2525

@@ -29,12 +29,12 @@ export default function ChatsChatIndex() {
2929
}
3030
}, [messages]);
3131

32-
const [message, setMessage] = useState("");
32+
const [message, setMessage] = useState('');
3333

3434
useEffect(() => {
3535
async function findOrCreateDraft(senderId: string, recipientId: string, content: string) {
3636
const draftMessages = await powerSync.execute(
37-
"SELECT id, content FROM messages WHERE sender_id = ? AND recipient_id = ? AND sent_at IS NULL",
37+
'SELECT id, content FROM messages WHERE sender_id = ? AND recipient_id = ? AND sent_at IS NULL',
3838
[senderId, recipientId]
3939
);
4040

@@ -44,7 +44,7 @@ export default function ChatsChatIndex() {
4444
} else if (message.length > 0) {
4545
const draftId = uuid();
4646
await powerSync.execute(
47-
"INSERT INTO messages (id, created_at, sender_id, recipient_id, content) VALUES (?, datetime(), ?, ?, ?)",
47+
'INSERT INTO messages (id, created_at, sender_id, recipient_id, content) VALUES (?, datetime(), ?, ?, ?)',
4848
[draftId, senderId, recipientId, content]
4949
);
5050
setDraftId(draftId);
@@ -55,21 +55,21 @@ export default function ChatsChatIndex() {
5555
if (!draftId) {
5656
findOrCreateDraft(user.id, profileId, message);
5757
} else if (message.length > 0) {
58-
powerSync.execute("UPDATE messages SET content = ? WHERE id = ?", [message, draftId]);
58+
powerSync.execute('UPDATE messages SET content = ? WHERE id = ?', [message, draftId]);
5959
}
6060
}
6161
}, [user?.id, profileId, draftId, message]);
6262

6363
async function handleInputSubmit() {
64-
await powerSync.execute("UPDATE messages SET content = ?, sent_at = datetime() WHERE id = ?", [message, draftId]);
64+
await powerSync.execute('UPDATE messages SET content = ?, sent_at = datetime() WHERE id = ?', [message, draftId]);
6565

66-
setMessage("");
66+
setMessage('');
6767
setDraftId(undefined);
6868

6969
console.log(profile.demo);
7070

7171
if (profile.demo === 1) {
72-
console.log("Preparing demo message ...");
72+
console.log('Preparing demo message ...');
7373

7474
const messageId = uuid();
7575
const message = faker.hacker.phrase();
@@ -82,7 +82,7 @@ export default function ChatsChatIndex() {
8282
}, 500);
8383

8484
setTimeout(async () => {
85-
await powerSync.execute("UPDATE messages SET sent_at = datetime(), content = ? WHERE id = ?", [
85+
await powerSync.execute('UPDATE messages SET sent_at = datetime(), content = ? WHERE id = ?', [
8686
message,
8787
messageId
8888
]);
@@ -102,13 +102,13 @@ export default function ChatsChatIndex() {
102102
}, 500);
103103

104104
setTimeout(async () => {
105-
await powerSync.execute("UPDATE messages SET sent_at = datetime(), content = ? WHERE id = ?", [
105+
await powerSync.execute('UPDATE messages SET sent_at = datetime(), content = ? WHERE id = ?', [
106106
message,
107107
messageId
108108
]);
109109
}, 2000);
110110

111-
setMessage("");
111+
setMessage('');
112112
}
113113

114114
return profile ? (

demos/react-native-supabase-group-chat/src/app/(app)/(chats)/c/_layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Slot } from "expo-router";
1+
import { Slot } from 'expo-router';
22

33
export default function ChatsCLayout() {
44
return <Slot />;

demos/react-native-supabase-group-chat/src/app/(app)/(chats)/g/[group]/_layout.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Stack } from "expo-router";
1+
import { Stack } from 'expo-router';
22

33
export default function ChatsGroupLayout() {
44
return (
@@ -9,7 +9,7 @@ export default function ChatsGroupLayout() {
99
headerShown: false
1010
}}
1111
/>
12-
<Stack.Screen name="settings" options={{ title: "Group settings", headerShown: false }} />
12+
<Stack.Screen name="settings" options={{ title: 'Group settings', headerShown: false }} />
1313
</Stack>
1414
);
1515
}

0 commit comments

Comments
 (0)