Skip to content

Commit 364a7a2

Browse files
committed
Chore: Separate components and update architecture
1 parent 827dd39 commit 364a7a2

File tree

22 files changed

+173
-132
lines changed

22 files changed

+173
-132
lines changed

bun.lock

Lines changed: 11 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
CREATE TABLE `items` (
2-
`id` text PRIMARY KEY NOT NULL,
2+
`id` integer PRIMARY KEY NOT NULL,
33
`title` text NOT NULL,
44
`created_at` integer NOT NULL,
55
`updated_at` integer NOT NULL
66
);
77
--> statement-breakpoint
88
CREATE TABLE `password_resets` (
9-
`id` text PRIMARY KEY NOT NULL,
9+
`id` integer PRIMARY KEY NOT NULL,
1010
`email` text NOT NULL,
1111
`code` text NOT NULL,
1212
`expires_at` integer NOT NULL
1313
);
1414
--> statement-breakpoint
1515
CREATE TABLE `sessions` (
16-
`id` text PRIMARY KEY NOT NULL,
16+
`id` integer PRIMARY KEY NOT NULL,
1717
`user_id` text NOT NULL,
1818
`created_at` integer NOT NULL
1919
);
2020
--> statement-breakpoint
2121
CREATE TABLE `users` (
22-
`id` text PRIMARY KEY NOT NULL,
22+
`id` integer PRIMARY KEY NOT NULL,
2323
`email` text NOT NULL,
2424
`password_hash` text NOT NULL,
2525
`created_at` integer NOT NULL

drizzle/meta/0000_snapshot.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{
22
"version": "6",
33
"dialect": "sqlite",
4-
"id": "5a28ff77-c60e-42fa-8309-7d617a231245",
4+
"id": "a80d7cec-989f-4bd1-97a4-b7d30ff894c8",
55
"prevId": "00000000-0000-0000-0000-000000000000",
66
"tables": {
77
"items": {
88
"name": "items",
99
"columns": {
1010
"id": {
1111
"name": "id",
12-
"type": "text",
12+
"type": "integer",
1313
"primaryKey": true,
1414
"notNull": true,
1515
"autoincrement": false
@@ -47,7 +47,7 @@
4747
"columns": {
4848
"id": {
4949
"name": "id",
50-
"type": "text",
50+
"type": "integer",
5151
"primaryKey": true,
5252
"notNull": true,
5353
"autoincrement": false
@@ -85,7 +85,7 @@
8585
"columns": {
8686
"id": {
8787
"name": "id",
88-
"type": "text",
88+
"type": "integer",
8989
"primaryKey": true,
9090
"notNull": true,
9191
"autoincrement": false
@@ -116,7 +116,7 @@
116116
"columns": {
117117
"id": {
118118
"name": "id",
119-
"type": "text",
119+
"type": "integer",
120120
"primaryKey": true,
121121
"notNull": true,
122122
"autoincrement": false

drizzle/meta/_journal.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
{
66
"idx": 0,
77
"version": "6",
8-
"when": 1772230312846,
9-
"tag": "0000_rich_echo",
8+
"when": 1772274776298,
9+
"tag": "0000_wet_zemo",
1010
"breakpoints": true
1111
}
1212
]

drizzle/migrations.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// This file is required for Expo/React Native SQLite migrations - https://orm.drizzle.team/quick-sqlite/expo
22

33
import journal from './meta/_journal.json';
4-
import m0000 from './0000_rich_echo.sql';
4+
import m0000 from './0000_wet_zemo.sql';
55

66
export default {
77
journal,

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"expo-localization": "~17.0.8",
4747
"expo-router": "~6.0.19",
4848
"expo-splash-screen": "~31.0.12",
49-
"expo-sqlite": "~16.0.10",
49+
"expo-sqlite": "^16.0.10",
5050
"expo-status-bar": "~3.0.9",
5151
"expo-system-ui": "~6.0.9",
5252
"i18next": "^25.8.13",

src/app/(app)/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
import { useAuth } from "@/shared/hooks/useAuth";
12
import { Redirect } from "expo-router";
2-
import { useAuth } from "@/shared/providers/auth-provider";
33

44
export default function Index() {
55
const { user, isBootstrapping } = useAuth();

src/app/(auth)/_layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
import { useAuth } from "@/shared/hooks/useAuth";
12
import { Redirect, Stack } from "expo-router";
2-
import { useAuth } from "@/shared/providers/auth-provider";
33

44
export default function AuthLayout() {
55
const { isBootstrapping, user } = useAuth();

src/app/_layout.tsx

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import { ThemeProvider } from "@react-navigation/native";
22
import { Stack } from "expo-router";
33
import { StatusBar } from "expo-status-bar";
4+
import { Suspense } from "react";
5+
import { ActivityIndicator, View } from "react-native";
46
import { useColorScheme } from "nativewind";
57
import { NAV_THEME } from "@/shared/lib/theme";
6-
import { DbGate } from "@/shared/providers/db-gate";
7-
import { AuthProvider } from "@/shared/providers/auth-provider";
8+
import { AuthProvider } from "@/shared/auth/provider";
9+
import { DbProvider } from "@/shared/db/provider";
810
import "@/shared/global.css";
911
import "../../i18n";
1012

@@ -15,14 +17,22 @@ export default function RootLayout() {
1517
return (
1618
<ThemeProvider value={theme}>
1719
<StatusBar style={theme.dark ? "light" : "dark"} />
18-
<DbGate>
19-
<AuthProvider>
20-
<Stack screenOptions={{ headerShown: false }}>
21-
<Stack.Screen name="(auth)" />
22-
<Stack.Screen name="(app)" />
23-
</Stack>
24-
</AuthProvider>
25-
</DbGate>
20+
<Suspense
21+
fallback={
22+
<View className="flex-1 justify-center items-center">
23+
<ActivityIndicator size="large" />
24+
</View>
25+
}
26+
>
27+
<DbProvider>
28+
<AuthProvider>
29+
<Stack screenOptions={{ headerShown: false }}>
30+
<Stack.Screen name="(auth)" />
31+
<Stack.Screen name="(app)" />
32+
</Stack>
33+
</AuthProvider>
34+
</DbProvider>
35+
</Suspense>
2636
</ThemeProvider>
2737
);
2838
}

src/shared/auth/context.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import { createContext } from "react";
2+
import type { AuthContextType } from "@/shared/types/auth";
3+
4+
export const AuthContext = createContext<AuthContextType | null>(null);

0 commit comments

Comments
 (0)