From 304bf7ffa8a80d74a72e5c1fd7f09d0720012ccd Mon Sep 17 00:00:00 2001 From: Cristi Ciobanu Date: Thu, 3 Jul 2025 10:12:34 +0200 Subject: [PATCH] add test project app side --- __fixtures__/test-project/.gitignore | 15 +++ __fixtures__/test-project/app/.env.example | 2 + __fixtures__/test-project/app/ambient.d.ts | 33 ++++++ __fixtures__/test-project/app/app.json | 42 +++++++ .../test-project/app/app/(tabs)/_layout.tsx | 65 ++++++++++ .../test-project/app/app/(tabs)/admin.tsx | 35 ++++++ .../test-project/app/app/(tabs)/index.tsx | 42 +++++++ .../test-project/app/app/+not-found.tsx | 34 ++++++ __fixtures__/test-project/app/app/_layout.tsx | 50 ++++++++ __fixtures__/test-project/app/app/modal.tsx | 77 ++++++++++++ .../test-project/app/app/posts/[id].tsx | 47 ++++++++ .../app/assets/fonts/SpaceMono-Regular.ttf | Bin 0 -> 93252 bytes .../app/assets/images/adaptive-icon.png | Bin 0 -> 17547 bytes .../app/assets/images/favicon.png | Bin 0 -> 1466 bytes .../test-project/app/assets/images/icon.png | Bin 0 -> 22380 bytes .../app/assets/images/splash-icon.png | Bin 0 -> 17547 bytes .../test-project/app/components/BlogPost.tsx | 60 ++++++++++ .../test-project/app/components/HapticTab.tsx | 20 ++++ .../test-project/app/components/Post.tsx | 106 +++++++++++++++++ .../app/components/ThemedScrollView.tsx | 38 ++++++ .../app/components/ThemedText.tsx | 62 ++++++++++ .../app/components/ThemedView.tsx | 24 ++++ .../components/ui/TabBarBackground.ios.tsx | 21 ++++ .../app/components/ui/TabBarBackground.tsx | 6 + .../test-project/app/constants/Colors.ts | 26 ++++ __fixtures__/test-project/app/context/auth.ts | 12 ++ .../test-project/app/hooks/useColorScheme.ts | 1 + .../app/hooks/useColorScheme.web.ts | 22 ++++ .../test-project/app/hooks/useThemeColor.ts | 21 ++++ __fixtures__/test-project/app/package.json | 45 +++++++ .../test-project/app/scripts/reset-project.js | 112 ++++++++++++++++++ __fixtures__/test-project/app/tsconfig.json | 10 ++ __fixtures__/test-project/package.json | 9 +- 33 files changed, 1034 insertions(+), 3 deletions(-) create mode 100644 __fixtures__/test-project/app/.env.example create mode 100644 __fixtures__/test-project/app/ambient.d.ts create mode 100644 __fixtures__/test-project/app/app.json create mode 100644 __fixtures__/test-project/app/app/(tabs)/_layout.tsx create mode 100644 __fixtures__/test-project/app/app/(tabs)/admin.tsx create mode 100644 __fixtures__/test-project/app/app/(tabs)/index.tsx create mode 100644 __fixtures__/test-project/app/app/+not-found.tsx create mode 100644 __fixtures__/test-project/app/app/_layout.tsx create mode 100644 __fixtures__/test-project/app/app/modal.tsx create mode 100644 __fixtures__/test-project/app/app/posts/[id].tsx create mode 100755 __fixtures__/test-project/app/assets/fonts/SpaceMono-Regular.ttf create mode 100644 __fixtures__/test-project/app/assets/images/adaptive-icon.png create mode 100644 __fixtures__/test-project/app/assets/images/favicon.png create mode 100644 __fixtures__/test-project/app/assets/images/icon.png create mode 100644 __fixtures__/test-project/app/assets/images/splash-icon.png create mode 100644 __fixtures__/test-project/app/components/BlogPost.tsx create mode 100644 __fixtures__/test-project/app/components/HapticTab.tsx create mode 100644 __fixtures__/test-project/app/components/Post.tsx create mode 100644 __fixtures__/test-project/app/components/ThemedScrollView.tsx create mode 100644 __fixtures__/test-project/app/components/ThemedText.tsx create mode 100644 __fixtures__/test-project/app/components/ThemedView.tsx create mode 100644 __fixtures__/test-project/app/components/ui/TabBarBackground.ios.tsx create mode 100644 __fixtures__/test-project/app/components/ui/TabBarBackground.tsx create mode 100644 __fixtures__/test-project/app/constants/Colors.ts create mode 100644 __fixtures__/test-project/app/context/auth.ts create mode 100644 __fixtures__/test-project/app/hooks/useColorScheme.ts create mode 100644 __fixtures__/test-project/app/hooks/useColorScheme.web.ts create mode 100644 __fixtures__/test-project/app/hooks/useThemeColor.ts create mode 100644 __fixtures__/test-project/app/package.json create mode 100755 __fixtures__/test-project/app/scripts/reset-project.js create mode 100644 __fixtures__/test-project/app/tsconfig.json diff --git a/__fixtures__/test-project/.gitignore b/__fixtures__/test-project/.gitignore index 31d9637ede..a43a187263 100644 --- a/__fixtures__/test-project/.gitignore +++ b/__fixtures__/test-project/.gitignore @@ -22,3 +22,18 @@ api/src/lib/generateGraphiQLHeader.* !.yarn/releases !.yarn/sdks !.yarn/versions + +# Expo +.expo +web-build +expo-env.d.ts +.kotlin/ +*.orig.* +*.jks +*.p8 +*.p12 +*.key +*.mobileprovision +.metro-health-check* +*.pem +*.tsbuildinfo diff --git a/__fixtures__/test-project/app/.env.example b/__fixtures__/test-project/app/.env.example new file mode 100644 index 0000000000..4f700f16d3 --- /dev/null +++ b/__fixtures__/test-project/app/.env.example @@ -0,0 +1,2 @@ +# EXPO_PUBLIC_RWJS_API_GRAPHQL_URL=http://localhost:8911/graphql +# EXPO_PUBLIC_API_URL=http://localhost:8911 diff --git a/__fixtures__/test-project/app/ambient.d.ts b/__fixtures__/test-project/app/ambient.d.ts new file mode 100644 index 0000000000..6e4456a167 --- /dev/null +++ b/__fixtures__/test-project/app/ambient.d.ts @@ -0,0 +1,33 @@ +/* eslint-disable no-var */ + +declare global { + /** + * FQDN or absolute path to the GraphQL serverless function, without the trailing slash. + * Example: `./redwood/functions/graphql` or `https://api.redwoodjs.com/graphql` + */ + var RWJS_API_GRAPHQL_URL: string + + /** + * URL or absolute path to serverless functions, without the trailing slash. + * Example: `./redwood/functions/` or `https://api.redwoodjs.com/` + **/ + var RWJS_API_URL: string + + // Provided by Vite.config in the user's project + var RWJS_ENV: { + RWJS_API_GRAPHQL_URL: string + /** URL or absolute path to serverless functions */ + RWJS_API_URL: string + } + + namespace NodeJS { + interface Global { + /** URL or absolute path to the GraphQL serverless function */ + RWJS_API_GRAPHQL_URL: string + /** URL or absolute path to serverless functions */ + RWJS_API_URL: string + } + } +} + +export {} diff --git a/__fixtures__/test-project/app/app.json b/__fixtures__/test-project/app/app.json new file mode 100644 index 0000000000..428a0b339a --- /dev/null +++ b/__fixtures__/test-project/app/app.json @@ -0,0 +1,42 @@ +{ + "expo": { + "name": "app", + "slug": "app", + "version": "1.0.0", + "orientation": "portrait", + "icon": "./assets/images/icon.png", + "scheme": "app", + "userInterfaceStyle": "automatic", + "newArchEnabled": true, + "ios": { + "supportsTablet": true + }, + "android": { + "adaptiveIcon": { + "foregroundImage": "./assets/images/adaptive-icon.png", + "backgroundColor": "#ffffff" + }, + "edgeToEdgeEnabled": true + }, + "web": { + "bundler": "metro", + "output": "static", + "favicon": "./assets/images/favicon.png" + }, + "plugins": [ + "expo-router", + [ + "expo-splash-screen", + { + "image": "./assets/images/splash-icon.png", + "imageWidth": 200, + "resizeMode": "contain", + "backgroundColor": "#ffffff" + } + ] + ], + "experiments": { + "typedRoutes": true + } + } +} diff --git a/__fixtures__/test-project/app/app/(tabs)/_layout.tsx b/__fixtures__/test-project/app/app/(tabs)/_layout.tsx new file mode 100644 index 0000000000..dde407a022 --- /dev/null +++ b/__fixtures__/test-project/app/app/(tabs)/_layout.tsx @@ -0,0 +1,65 @@ +import React from 'react' + +import MaterialIcons from '@expo/vector-icons/MaterialIcons' +import { Link, Tabs } from 'expo-router' +import { Button, Platform, View } from 'react-native' + +import { HapticTab } from '@/components/HapticTab' +import TabBarBackground from '@/components/ui/TabBarBackground' +import { Colors } from '@/constants/Colors' +import { useAuth } from '@/context/auth' +import { useColorScheme } from '@/hooks/useColorScheme' + +export default function TabLayout() { + const colorScheme = useColorScheme() + const { isAuthenticated, logOut } = useAuth() + + return ( + ( + + {isAuthenticated ? ( +