@idealyst/cli 1.0.52 → 1.0.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/generators/fullstack.js +0 -11
- package/dist/generators/fullstack.js.map +1 -1
- package/dist/generators/utils.js +3 -2
- package/dist/generators/utils.js.map +1 -1
- package/dist/templates/native/src/App-with-trpc-and-shared.tsx +36 -0
- package/dist/templates/native/src/App-with-trpc.tsx +3 -26
- package/dist/templates/native/src/App.tsx +5 -10
- package/dist/templates/native/src/navigation/AppRouter.tsx +121 -0
- package/dist/templates/shared/src/index.ts +3 -0
- package/dist/templates/shared/src/navigation/AppRouter.tsx +93 -0
- package/dist/templates/web/src/App-with-trpc-and-shared.tsx +32 -10
- package/dist/templates/web/src/App-with-trpc.tsx +4 -33
- package/dist/templates/web/src/App.tsx +2 -2
- package/dist/templates/web/src/navigation/AppRouter.tsx +121 -0
- package/dist/templates/web/src/navigation/AppRouterWithTrpc.tsx +117 -0
- package/dist/templates/web/vite.config.ts +10 -2
- package/package.json +1 -1
- package/templates/native/src/App-with-trpc-and-shared.tsx +36 -0
- package/templates/native/src/App-with-trpc.tsx +3 -26
- package/templates/native/src/App.tsx +5 -10
- package/templates/native/src/navigation/AppRouter.tsx +121 -0
- package/templates/shared/src/index.ts +3 -0
- package/templates/shared/src/navigation/AppRouter.tsx +93 -0
- package/templates/web/src/App-with-trpc-and-shared.tsx +32 -10
- package/templates/web/src/App-with-trpc.tsx +4 -33
- package/templates/web/src/App.tsx +2 -2
- package/templates/web/src/navigation/AppRouter.tsx +121 -0
- package/templates/web/src/navigation/AppRouterWithTrpc.tsx +117 -0
- package/templates/web/vite.config.ts +10 -2
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { RouteParam } from '@idealyst/navigation';
|
|
3
|
+
import { Screen, Text, View, Icon } from '@idealyst/components';
|
|
4
|
+
|
|
5
|
+
// Simple API test component for web-only projects
|
|
6
|
+
const ApiTest = () => {
|
|
7
|
+
const [result, setResult] = React.useState<string>('Click to test API');
|
|
8
|
+
|
|
9
|
+
const testApi = async () => {
|
|
10
|
+
try {
|
|
11
|
+
setResult('Testing...');
|
|
12
|
+
// Simple fetch test - replace with actual API endpoint
|
|
13
|
+
const response = await fetch('/api/test');
|
|
14
|
+
if (response.ok) {
|
|
15
|
+
setResult('✅ API connection successful!');
|
|
16
|
+
} else {
|
|
17
|
+
setResult('❌ API connection failed');
|
|
18
|
+
}
|
|
19
|
+
} catch (error) {
|
|
20
|
+
setResult('❌ API connection failed');
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<View spacing="sm">
|
|
26
|
+
<Text size="small">{result}</Text>
|
|
27
|
+
<button onClick={testApi} style={{ padding: '8px 16px', marginTop: '8px' }}>
|
|
28
|
+
Test API
|
|
29
|
+
</button>
|
|
30
|
+
</View>
|
|
31
|
+
);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const HomeScreen = () => (
|
|
35
|
+
<Screen>
|
|
36
|
+
<View spacing="lg">
|
|
37
|
+
<Text size="xlarge" weight="bold">Home</Text>
|
|
38
|
+
<Text size="medium">Welcome to your {{projectName}} app!</Text>
|
|
39
|
+
<View spacing="md" style={{ marginTop: 24 }}>
|
|
40
|
+
<Text size="small">
|
|
41
|
+
This app uses tab navigation. Navigate between tabs using the top bar or menu.
|
|
42
|
+
</Text>
|
|
43
|
+
</View>
|
|
44
|
+
|
|
45
|
+
{/* API Testing Component */}
|
|
46
|
+
<View spacing="md" style={{ marginTop: 32 }}>
|
|
47
|
+
<Text size="medium" weight="semibold">API Test</Text>
|
|
48
|
+
<ApiTest />
|
|
49
|
+
</View>
|
|
50
|
+
</View>
|
|
51
|
+
</Screen>
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
const ProfileScreen = () => (
|
|
55
|
+
<Screen>
|
|
56
|
+
<View spacing="lg">
|
|
57
|
+
<Text size="xlarge" weight="bold">Profile</Text>
|
|
58
|
+
<Text size="medium">User profile and account settings</Text>
|
|
59
|
+
<View spacing="md" style={{ marginTop: 24 }}>
|
|
60
|
+
<Text size="small">
|
|
61
|
+
Manage your account details and preferences here.
|
|
62
|
+
</Text>
|
|
63
|
+
</View>
|
|
64
|
+
</View>
|
|
65
|
+
</Screen>
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
const SettingsScreen = () => (
|
|
69
|
+
<Screen>
|
|
70
|
+
<View spacing="lg">
|
|
71
|
+
<Text size="xlarge" weight="bold">Settings</Text>
|
|
72
|
+
<Text size="medium">App configuration and preferences</Text>
|
|
73
|
+
<View spacing="md" style={{ marginTop: 24 }}>
|
|
74
|
+
<Text size="small">
|
|
75
|
+
Customize your app experience with various settings and options.
|
|
76
|
+
</Text>
|
|
77
|
+
</View>
|
|
78
|
+
</View>
|
|
79
|
+
</Screen>
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
const AppRouter: RouteParam = {
|
|
83
|
+
path: "/",
|
|
84
|
+
component: HomeScreen,
|
|
85
|
+
layout: {
|
|
86
|
+
type: "tab",
|
|
87
|
+
},
|
|
88
|
+
screenOptions: {
|
|
89
|
+
title: 'Home',
|
|
90
|
+
tabBarLabel: 'Home',
|
|
91
|
+
tabBarIcon: ({ focused, size }) => (
|
|
92
|
+
<Icon name="home" color={focused ? 'blue' : 'gray'} size={size || 24} />
|
|
93
|
+
),
|
|
94
|
+
},
|
|
95
|
+
routes: [
|
|
96
|
+
{
|
|
97
|
+
path: "profile",
|
|
98
|
+
component: ProfileScreen,
|
|
99
|
+
screenOptions: {
|
|
100
|
+
title: 'Profile',
|
|
101
|
+
tabBarLabel: 'Profile',
|
|
102
|
+
tabBarIcon: ({ focused, size }) => (
|
|
103
|
+
<Icon name="account" color={focused ? 'blue' : 'gray'} size={size || 24} />
|
|
104
|
+
),
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
path: "settings",
|
|
109
|
+
component: SettingsScreen,
|
|
110
|
+
screenOptions: {
|
|
111
|
+
title: 'Settings',
|
|
112
|
+
tabBarLabel: 'Settings',
|
|
113
|
+
tabBarIcon: ({ focused, size }) => (
|
|
114
|
+
<Icon name="cog" color={focused ? 'blue' : 'gray'} size={size || 24} />
|
|
115
|
+
),
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
],
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
export default AppRouter;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { RouteParam } from '@idealyst/navigation';
|
|
3
|
+
import { Screen, Text, View, Icon, Button } from '@idealyst/components';
|
|
4
|
+
import { trpc } from '../utils/trpc';
|
|
5
|
+
|
|
6
|
+
const HomeScreen = () => {
|
|
7
|
+
// Example tRPC usage
|
|
8
|
+
const [name, setName] = React.useState('{{projectName}}');
|
|
9
|
+
const { data, isLoading, error, refetch } = trpc.hello.useQuery({ name });
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<Screen>
|
|
13
|
+
<View spacing="lg">
|
|
14
|
+
<Text size="xlarge" weight="bold">Home</Text>
|
|
15
|
+
<Text size="medium">Welcome to your {{projectName}} app!</Text>
|
|
16
|
+
<View spacing="md" style={{ marginTop: 24 }}>
|
|
17
|
+
<Text size="small">
|
|
18
|
+
This app uses tab navigation with tRPC integration. Navigate between tabs using the top bar or menu.
|
|
19
|
+
</Text>
|
|
20
|
+
|
|
21
|
+
{/* tRPC API Test */}
|
|
22
|
+
<View spacing="sm" style={{ marginTop: 20 }}>
|
|
23
|
+
<Text size="medium" weight="semibold">API Test (tRPC):</Text>
|
|
24
|
+
<View spacing="xs">
|
|
25
|
+
<input
|
|
26
|
+
type="text"
|
|
27
|
+
value={name}
|
|
28
|
+
onChange={(e) => setName(e.target.value)}
|
|
29
|
+
placeholder="Enter your name"
|
|
30
|
+
style={{ padding: '8px', border: '1px solid #ccc', borderRadius: '4px' }}
|
|
31
|
+
/>
|
|
32
|
+
<Button variant="outlined" onPress={() => refetch()} size="small">
|
|
33
|
+
Test tRPC API
|
|
34
|
+
</Button>
|
|
35
|
+
</View>
|
|
36
|
+
|
|
37
|
+
{/* Results */}
|
|
38
|
+
<View style={{ marginTop: 12 }}>
|
|
39
|
+
{isLoading && <Text size="small">Loading...</Text>}
|
|
40
|
+
{error && <Text size="small" color="error">Error: {error.message}</Text>}
|
|
41
|
+
{data && <Text size="small">✅ {data.greeting}</Text>}
|
|
42
|
+
</View>
|
|
43
|
+
</View>
|
|
44
|
+
</View>
|
|
45
|
+
</View>
|
|
46
|
+
</Screen>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const ProfileScreen = () => (
|
|
51
|
+
<Screen>
|
|
52
|
+
<View spacing="lg">
|
|
53
|
+
<Text size="xlarge" weight="bold">Profile</Text>
|
|
54
|
+
<Text size="medium">User profile and account settings</Text>
|
|
55
|
+
<View spacing="md" style={{ marginTop: 24 }}>
|
|
56
|
+
<Text size="small">
|
|
57
|
+
Manage your account details and preferences here.
|
|
58
|
+
</Text>
|
|
59
|
+
</View>
|
|
60
|
+
</View>
|
|
61
|
+
</Screen>
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
const SettingsScreen = () => (
|
|
65
|
+
<Screen>
|
|
66
|
+
<View spacing="lg">
|
|
67
|
+
<Text size="xlarge" weight="bold">Settings</Text>
|
|
68
|
+
<Text size="medium">App configuration and preferences</Text>
|
|
69
|
+
<View spacing="md" style={{ marginTop: 24 }}>
|
|
70
|
+
<Text size="small">
|
|
71
|
+
Customize your app experience with various settings and options.
|
|
72
|
+
</Text>
|
|
73
|
+
</View>
|
|
74
|
+
</View>
|
|
75
|
+
</Screen>
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
const AppRouterWithTrpc: RouteParam = {
|
|
79
|
+
path: "/",
|
|
80
|
+
component: HomeScreen,
|
|
81
|
+
layout: {
|
|
82
|
+
type: "tab",
|
|
83
|
+
},
|
|
84
|
+
screenOptions: {
|
|
85
|
+
title: 'Home',
|
|
86
|
+
tabBarLabel: 'Home',
|
|
87
|
+
tabBarIcon: ({ focused, size }) => (
|
|
88
|
+
<Icon name="home" color={focused ? 'blue' : 'gray'} size={size || 24} />
|
|
89
|
+
),
|
|
90
|
+
},
|
|
91
|
+
routes: [
|
|
92
|
+
{
|
|
93
|
+
path: "profile",
|
|
94
|
+
component: ProfileScreen,
|
|
95
|
+
screenOptions: {
|
|
96
|
+
title: 'Profile',
|
|
97
|
+
tabBarLabel: 'Profile',
|
|
98
|
+
tabBarIcon: ({ focused, size }) => (
|
|
99
|
+
<Icon name="account" color={focused ? 'blue' : 'gray'} size={size || 24} />
|
|
100
|
+
),
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
path: "settings",
|
|
105
|
+
component: SettingsScreen,
|
|
106
|
+
screenOptions: {
|
|
107
|
+
title: 'Settings',
|
|
108
|
+
tabBarLabel: 'Settings',
|
|
109
|
+
tabBarIcon: ({ focused, size }) => (
|
|
110
|
+
<Icon name="cog" color={focused ? 'blue' : 'gray'} size={size || 24} />
|
|
111
|
+
),
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
],
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
export default AppRouterWithTrpc;
|
|
@@ -7,7 +7,7 @@ import path from 'path'
|
|
|
7
7
|
export default defineConfig({
|
|
8
8
|
plugins: [
|
|
9
9
|
babel({
|
|
10
|
-
filter: (id) => id.includes(
|
|
10
|
+
filter: (id) => id.includes("node_modules/@idealyst/"),
|
|
11
11
|
babelConfig: {
|
|
12
12
|
presets: [
|
|
13
13
|
['@babel/preset-typescript', {
|
|
@@ -59,8 +59,16 @@ export default defineConfig({
|
|
|
59
59
|
'@idealyst/components',
|
|
60
60
|
'@idealyst/navigation',
|
|
61
61
|
'@idealyst/theme',
|
|
62
|
-
'@
|
|
62
|
+
'@{{workspaceScope}}/shared',
|
|
63
63
|
],
|
|
64
|
+
esbuildOptions: {
|
|
65
|
+
loader: {
|
|
66
|
+
'.tsx': 'tsx',
|
|
67
|
+
'.ts': 'ts',
|
|
68
|
+
'.jsx': 'jsx',
|
|
69
|
+
'.js': 'jsx' // Important: treat .js files as JSX for React Native compatibility
|
|
70
|
+
}
|
|
71
|
+
}
|
|
64
72
|
},
|
|
65
73
|
server: {
|
|
66
74
|
host: '0.0.0.0',
|
package/package.json
CHANGED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
3
|
+
import { httpBatchLink } from '@trpc/client';
|
|
4
|
+
import { NavigatorProvider } from '@idealyst/navigation';
|
|
5
|
+
import { trpc } from './utils/trpc';
|
|
6
|
+
import { AppRouter } from '@{{workspaceScope}}/shared';
|
|
7
|
+
|
|
8
|
+
// Create tRPC client
|
|
9
|
+
const queryClient = new QueryClient();
|
|
10
|
+
|
|
11
|
+
const trpcClient = trpc.createClient({
|
|
12
|
+
links: [
|
|
13
|
+
httpBatchLink({
|
|
14
|
+
url: 'http://localhost:3000/trpc', // Update this to your API URL
|
|
15
|
+
// For device testing, you might need: 'http://192.168.1.xxx:3000/trpc'
|
|
16
|
+
// Optional: Add headers for authentication
|
|
17
|
+
// headers() {
|
|
18
|
+
// return {
|
|
19
|
+
// authorization: getAuthToken(),
|
|
20
|
+
// };
|
|
21
|
+
// },
|
|
22
|
+
}),
|
|
23
|
+
],
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
function App() {
|
|
27
|
+
return (
|
|
28
|
+
<trpc.Provider client={trpcClient} queryClient={queryClient}>
|
|
29
|
+
<QueryClientProvider client={queryClient}>
|
|
30
|
+
<NavigatorProvider route={AppRouter} />
|
|
31
|
+
</QueryClientProvider>
|
|
32
|
+
</trpc.Provider>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export default App;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
3
3
|
import { httpBatchLink } from '@trpc/client';
|
|
4
|
-
import {
|
|
4
|
+
import { NavigatorProvider } from '@idealyst/navigation';
|
|
5
5
|
import { trpc } from './utils/trpc';
|
|
6
|
+
import AppRouter from './navigation/AppRouter';
|
|
6
7
|
|
|
7
8
|
// Create tRPC client
|
|
8
9
|
const queryClient = new QueryClient();
|
|
@@ -23,34 +24,10 @@ const trpcClient = trpc.createClient({
|
|
|
23
24
|
});
|
|
24
25
|
|
|
25
26
|
function App() {
|
|
26
|
-
// Example tRPC usage
|
|
27
|
-
const { data, isLoading, error } = trpc.hello.useQuery({ name: 'React Native' });
|
|
28
|
-
|
|
29
27
|
return (
|
|
30
28
|
<trpc.Provider client={trpcClient} queryClient={queryClient}>
|
|
31
29
|
<QueryClientProvider client={queryClient}>
|
|
32
|
-
<
|
|
33
|
-
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center', padding: 20 }}>
|
|
34
|
-
<Text variant="h1" style={{ textAlign: 'center', marginBottom: 20 }}>
|
|
35
|
-
Welcome to {{appName}}!
|
|
36
|
-
</Text>
|
|
37
|
-
<Text variant="body" style={{ textAlign: 'center', marginBottom: 20 }}>
|
|
38
|
-
This is a React Native app built with the Idealyst Framework
|
|
39
|
-
</Text>
|
|
40
|
-
|
|
41
|
-
{/* tRPC Example */}
|
|
42
|
-
<View style={{ marginTop: 20, alignItems: 'center' }}>
|
|
43
|
-
<Text variant="h3" style={{ marginBottom: 10 }}>tRPC Example:</Text>
|
|
44
|
-
{isLoading && <Text>Loading...</Text>}
|
|
45
|
-
{error && <Text>Error: {error.message}</Text>}
|
|
46
|
-
{data && <Text style={{ textAlign: 'center' }}>{data.greeting}</Text>}
|
|
47
|
-
</View>
|
|
48
|
-
|
|
49
|
-
<Text variant="caption" style={{ textAlign: 'center', marginTop: 30 }}>
|
|
50
|
-
Edit src/App.tsx to get started
|
|
51
|
-
</Text>
|
|
52
|
-
</View>
|
|
53
|
-
</Screen>
|
|
30
|
+
<NavigatorProvider route={AppRouter} />
|
|
54
31
|
</QueryClientProvider>
|
|
55
32
|
</trpc.Provider>
|
|
56
33
|
);
|
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { NavigatorProvider } from '@idealyst/navigation';
|
|
3
|
+
import AppRouter from './navigation/AppRouter';
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
function AppWithShared() {
|
|
5
|
+
function App() {
|
|
6
6
|
return (
|
|
7
|
-
<
|
|
8
|
-
apiUrl="http://localhost:3000/trpc"
|
|
9
|
-
name="{{projectName}} Developer"
|
|
10
|
-
platform="mobile"
|
|
11
|
-
projectName="{{projectName}}"
|
|
12
|
-
/>
|
|
7
|
+
<NavigatorProvider route={AppRouter} />
|
|
13
8
|
);
|
|
14
9
|
}
|
|
15
10
|
|
|
16
|
-
export default
|
|
11
|
+
export default App;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { RouteParam } from '@idealyst/navigation';
|
|
3
|
+
import { Screen, Text, View, Icon, Button } from '@idealyst/components';
|
|
4
|
+
|
|
5
|
+
// Simple API test component for native-only projects
|
|
6
|
+
const ApiTest = () => {
|
|
7
|
+
const [result, setResult] = React.useState<string>('Tap to test API');
|
|
8
|
+
|
|
9
|
+
const testApi = async () => {
|
|
10
|
+
try {
|
|
11
|
+
setResult('Testing...');
|
|
12
|
+
// Simple fetch test - replace with actual API endpoint
|
|
13
|
+
const response = await fetch('http://localhost:3000/api/test');
|
|
14
|
+
if (response.ok) {
|
|
15
|
+
setResult('✅ API connection successful!');
|
|
16
|
+
} else {
|
|
17
|
+
setResult('❌ API connection failed');
|
|
18
|
+
}
|
|
19
|
+
} catch (error) {
|
|
20
|
+
setResult('❌ API connection failed');
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<View spacing="sm">
|
|
26
|
+
<Text size="small">{result}</Text>
|
|
27
|
+
<Button variant="outlined" onPress={testApi} size="small">
|
|
28
|
+
Test API
|
|
29
|
+
</Button>
|
|
30
|
+
</View>
|
|
31
|
+
);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const HomeScreen = () => (
|
|
35
|
+
<Screen>
|
|
36
|
+
<View spacing="lg">
|
|
37
|
+
<Text size="xlarge" weight="bold">Home</Text>
|
|
38
|
+
<Text size="medium">Welcome to {{appName}}!</Text>
|
|
39
|
+
<View spacing="md" style={{ marginTop: 24 }}>
|
|
40
|
+
<Text size="small">
|
|
41
|
+
This app uses tab navigation. Navigate between tabs using the bottom bar.
|
|
42
|
+
</Text>
|
|
43
|
+
</View>
|
|
44
|
+
|
|
45
|
+
{/* API Testing Component */}
|
|
46
|
+
<View spacing="md" style={{ marginTop: 32 }}>
|
|
47
|
+
<Text size="medium" weight="semibold">API Test</Text>
|
|
48
|
+
<ApiTest />
|
|
49
|
+
</View>
|
|
50
|
+
</View>
|
|
51
|
+
</Screen>
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
const ProfileScreen = () => (
|
|
55
|
+
<Screen>
|
|
56
|
+
<View spacing="lg">
|
|
57
|
+
<Text size="xlarge" weight="bold">Profile</Text>
|
|
58
|
+
<Text size="medium">User profile and account settings</Text>
|
|
59
|
+
<View spacing="md" style={{ marginTop: 24 }}>
|
|
60
|
+
<Text size="small">
|
|
61
|
+
Manage your account details and preferences here.
|
|
62
|
+
</Text>
|
|
63
|
+
</View>
|
|
64
|
+
</View>
|
|
65
|
+
</Screen>
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
const SettingsScreen = () => (
|
|
69
|
+
<Screen>
|
|
70
|
+
<View spacing="lg">
|
|
71
|
+
<Text size="xlarge" weight="bold">Settings</Text>
|
|
72
|
+
<Text size="medium">App configuration and preferences</Text>
|
|
73
|
+
<View spacing="md" style={{ marginTop: 24 }}>
|
|
74
|
+
<Text size="small">
|
|
75
|
+
Customize your app experience with various settings and options.
|
|
76
|
+
</Text>
|
|
77
|
+
</View>
|
|
78
|
+
</View>
|
|
79
|
+
</Screen>
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
const AppRouter: RouteParam = {
|
|
83
|
+
path: "/",
|
|
84
|
+
component: HomeScreen,
|
|
85
|
+
layout: {
|
|
86
|
+
type: "tab",
|
|
87
|
+
},
|
|
88
|
+
screenOptions: {
|
|
89
|
+
title: 'Home',
|
|
90
|
+
tabBarLabel: 'Home',
|
|
91
|
+
tabBarIcon: ({ focused, size }) => (
|
|
92
|
+
<Icon name="home" color={focused ? 'blue' : 'gray'} size={size || 24} />
|
|
93
|
+
),
|
|
94
|
+
},
|
|
95
|
+
routes: [
|
|
96
|
+
{
|
|
97
|
+
path: "profile",
|
|
98
|
+
component: ProfileScreen,
|
|
99
|
+
screenOptions: {
|
|
100
|
+
title: 'Profile',
|
|
101
|
+
tabBarLabel: 'Profile',
|
|
102
|
+
tabBarIcon: ({ focused, size }) => (
|
|
103
|
+
<Icon name="account" color={focused ? 'blue' : 'gray'} size={size || 24} />
|
|
104
|
+
),
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
path: "settings",
|
|
109
|
+
component: SettingsScreen,
|
|
110
|
+
screenOptions: {
|
|
111
|
+
title: 'Settings',
|
|
112
|
+
tabBarLabel: 'Settings',
|
|
113
|
+
tabBarIcon: ({ focused, size }) => (
|
|
114
|
+
<Icon name="cog" color={focused ? 'blue' : 'gray'} size={size || 24} />
|
|
115
|
+
),
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
],
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
export default AppRouter;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
// Export the unified App component
|
|
2
2
|
export { App } from './components';
|
|
3
3
|
|
|
4
|
+
// Export navigation router
|
|
5
|
+
export { default as AppRouter } from './navigation/AppRouter';
|
|
6
|
+
|
|
4
7
|
// Export tRPC client utilities
|
|
5
8
|
export { trpc, createTRPCClient, createVanillaTRPCClient } from './trpc/client';
|
|
6
9
|
export type { TRPCClientConfig, AppRouter } from './trpc/client';
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { RouteParam } from '@idealyst/navigation';
|
|
3
|
+
import { Screen, Text, View, Icon } from '@idealyst/components';
|
|
4
|
+
import { HelloWorld } from '../components/HelloWorld';
|
|
5
|
+
|
|
6
|
+
const HomeScreen = () => (
|
|
7
|
+
<Screen>
|
|
8
|
+
<View spacing="lg">
|
|
9
|
+
<Text size="xlarge" weight="bold">Home</Text>
|
|
10
|
+
<Text size="medium">Welcome to your {{projectName}} app!</Text>
|
|
11
|
+
<View spacing="md" style={{ marginTop: 24 }}>
|
|
12
|
+
<Text size="small">
|
|
13
|
+
This app uses tab navigation. Navigate between tabs using the bottom bar on mobile or the top tabs on web.
|
|
14
|
+
</Text>
|
|
15
|
+
</View>
|
|
16
|
+
|
|
17
|
+
{/* API Testing Component */}
|
|
18
|
+
<View spacing="md" style={{ marginTop: 32 }}>
|
|
19
|
+
<Text size="medium" weight="semibold">API Test</Text>
|
|
20
|
+
<HelloWorld name="{{projectName}}" />
|
|
21
|
+
</View>
|
|
22
|
+
</View>
|
|
23
|
+
</Screen>
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
const ProfileScreen = () => (
|
|
27
|
+
<Screen>
|
|
28
|
+
<View spacing="lg">
|
|
29
|
+
<Text size="xlarge" weight="bold">Profile</Text>
|
|
30
|
+
<Text size="medium">User profile and account settings</Text>
|
|
31
|
+
<View spacing="md" style={{ marginTop: 24 }}>
|
|
32
|
+
<Text size="small">
|
|
33
|
+
Manage your account details and preferences here.
|
|
34
|
+
</Text>
|
|
35
|
+
</View>
|
|
36
|
+
</View>
|
|
37
|
+
</Screen>
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
const SettingsScreen = () => (
|
|
41
|
+
<Screen>
|
|
42
|
+
<View spacing="lg">
|
|
43
|
+
<Text size="xlarge" weight="bold">Settings</Text>
|
|
44
|
+
<Text size="medium">App configuration and preferences</Text>
|
|
45
|
+
<View spacing="md" style={{ marginTop: 24 }}>
|
|
46
|
+
<Text size="small">
|
|
47
|
+
Customize your app experience with various settings and options.
|
|
48
|
+
</Text>
|
|
49
|
+
</View>
|
|
50
|
+
</View>
|
|
51
|
+
</Screen>
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
const AppRouter: RouteParam = {
|
|
55
|
+
path: "/",
|
|
56
|
+
component: HomeScreen,
|
|
57
|
+
layout: {
|
|
58
|
+
type: "tab",
|
|
59
|
+
},
|
|
60
|
+
screenOptions: {
|
|
61
|
+
title: 'Home',
|
|
62
|
+
tabBarLabel: 'Home',
|
|
63
|
+
tabBarIcon: ({ focused, size }) => (
|
|
64
|
+
<Icon name="home" color={focused ? 'blue' : 'gray'} size={size || 24} />
|
|
65
|
+
),
|
|
66
|
+
},
|
|
67
|
+
routes: [
|
|
68
|
+
{
|
|
69
|
+
path: "profile",
|
|
70
|
+
component: ProfileScreen,
|
|
71
|
+
screenOptions: {
|
|
72
|
+
title: 'Profile',
|
|
73
|
+
tabBarLabel: 'Profile',
|
|
74
|
+
tabBarIcon: ({ focused, size }) => (
|
|
75
|
+
<Icon name="account" color={focused ? 'blue' : 'gray'} size={size || 24} />
|
|
76
|
+
),
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
path: "settings",
|
|
81
|
+
component: SettingsScreen,
|
|
82
|
+
screenOptions: {
|
|
83
|
+
title: 'Settings',
|
|
84
|
+
tabBarLabel: 'Settings',
|
|
85
|
+
tabBarIcon: ({ focused, size }) => (
|
|
86
|
+
<Icon name="cog" color={focused ? 'blue' : 'gray'} size={size || 24} />
|
|
87
|
+
),
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
],
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export default AppRouter;
|
|
@@ -1,16 +1,38 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
3
|
+
import { httpBatchLink } from '@trpc/client';
|
|
4
|
+
import { BrowserRouter } from 'react-router-dom';
|
|
5
|
+
import { NavigatorProvider } from '@idealyst/navigation';
|
|
6
|
+
import { trpc } from './utils/trpc';
|
|
7
|
+
import { AppRouter } from '@{{workspaceScope}}/shared';
|
|
3
8
|
|
|
4
|
-
//
|
|
5
|
-
|
|
9
|
+
// Create tRPC client
|
|
10
|
+
const queryClient = new QueryClient();
|
|
11
|
+
|
|
12
|
+
const trpcClient = trpc.createClient({
|
|
13
|
+
links: [
|
|
14
|
+
httpBatchLink({
|
|
15
|
+
url: 'http://localhost:3000/trpc', // Update this to match your API URL
|
|
16
|
+
// Optional: Add headers for authentication
|
|
17
|
+
// headers() {
|
|
18
|
+
// return {
|
|
19
|
+
// authorization: getAuthToken(),
|
|
20
|
+
// };
|
|
21
|
+
// },
|
|
22
|
+
}),
|
|
23
|
+
],
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
function App() {
|
|
6
27
|
return (
|
|
7
|
-
<
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
28
|
+
<trpc.Provider client={trpcClient} queryClient={queryClient}>
|
|
29
|
+
<QueryClientProvider client={queryClient}>
|
|
30
|
+
<BrowserRouter>
|
|
31
|
+
<NavigatorProvider route={AppRouter} />
|
|
32
|
+
</BrowserRouter>
|
|
33
|
+
</QueryClientProvider>
|
|
34
|
+
</trpc.Provider>
|
|
13
35
|
);
|
|
14
36
|
}
|
|
15
37
|
|
|
16
|
-
export default
|
|
38
|
+
export default App;
|