From ed31546842ab701faca39081dd620adc627ef2cf Mon Sep 17 00:00:00 2001 From: Halit Aksoy Date: Sun, 24 Mar 2024 14:23:08 +0300 Subject: [PATCH] [mobile] reorganize folder structure --- mobile/App.tsx | 51 ------------------------------- mobile/__tests__/App.test.tsx | 2 +- mobile/app.json | 2 +- mobile/index.js | 2 +- mobile/src/App.tsx | 22 +++++++++++++ mobile/src/localization/en.ts | 3 +- mobile/src/localization/tr.ts | 3 +- mobile/src/screens/GameScreen.tsx | 13 ++++++++ mobile/src/screens/HomeScreen.tsx | 16 ++++++++++ mobile/src/screens/LobyScreen.tsx | 14 +++++++++ mobile/src/types/index.ts | 13 ++++++++ 11 files changed, 85 insertions(+), 56 deletions(-) delete mode 100644 mobile/App.tsx create mode 100644 mobile/src/App.tsx create mode 100644 mobile/src/screens/GameScreen.tsx create mode 100644 mobile/src/screens/HomeScreen.tsx create mode 100644 mobile/src/screens/LobyScreen.tsx create mode 100644 mobile/src/types/index.ts diff --git a/mobile/App.tsx b/mobile/App.tsx deleted file mode 100644 index d294934..0000000 --- a/mobile/App.tsx +++ /dev/null @@ -1,51 +0,0 @@ - -import * as React from 'react'; -import { View, Text, Button } from 'react-native'; -import { NavigationContainer } from '@react-navigation/native'; -import { createNativeStackNavigator } from '@react-navigation/native-stack'; -import type { NativeStackScreenProps } from '@react-navigation/native-stack'; -import { useTranslation } from 'react-i18next'; - -type RootStackParamList = { - Home: undefined, - Loby: undefined, - Game: {gameId: string} -}; - -type HomeScreenProps = NativeStackScreenProps; -type LobyScreenProps = NativeStackScreenProps; - -function HomeScreen({ navigation, route }: HomeScreenProps) { - return ( - - - - ); -} - -function LobyScreen({ navigation, route }: LobyScreenProps) { - const { t } = useTranslation(); - - return ( - - {t('hello')} - - ); -} - -const Stack = createNativeStackNavigator(); - -function App() { - return ( - - - - - - - ); -} - -export default App; \ No newline at end of file diff --git a/mobile/__tests__/App.test.tsx b/mobile/__tests__/App.test.tsx index 9eac6fb..fe831ed 100644 --- a/mobile/__tests__/App.test.tsx +++ b/mobile/__tests__/App.test.tsx @@ -4,7 +4,7 @@ import 'react-native'; import React from 'react'; -import App from '../App'; +import App from '../src/App'; // Note: import explicitly to use the types shipped with jest. import {it} from '@jest/globals'; diff --git a/mobile/app.json b/mobile/app.json index 6208f83..9a759d7 100644 --- a/mobile/app.json +++ b/mobile/app.json @@ -1,4 +1,4 @@ { "name": "mancala_mobile", - "displayName": "mancala_mobile" + "displayName": "Mancala" } diff --git a/mobile/index.js b/mobile/index.js index cf7e487..2744208 100644 --- a/mobile/index.js +++ b/mobile/index.js @@ -3,7 +3,7 @@ */ import {AppRegistry} from 'react-native'; -import App from './App'; +import App from './src/App'; import {name as appName} from './app.json'; import './src/localization/i18n'; diff --git a/mobile/src/App.tsx b/mobile/src/App.tsx new file mode 100644 index 0000000..9863282 --- /dev/null +++ b/mobile/src/App.tsx @@ -0,0 +1,22 @@ + +import * as React from 'react'; +import { NavigationContainer } from '@react-navigation/native'; +import { createNativeStackNavigator } from '@react-navigation/native-stack'; +import { RootStackParamList } from './types'; +import { HomeScreen } from './screens/HomeScreen'; +import LobyScreen from './screens/LobyScreen'; + +const Stack = createNativeStackNavigator(); + +function App() { + return ( + + + + + + + ); +} + +export default App; \ No newline at end of file diff --git a/mobile/src/localization/en.ts b/mobile/src/localization/en.ts index e23e378..090d986 100644 --- a/mobile/src/localization/en.ts +++ b/mobile/src/localization/en.ts @@ -1,5 +1,6 @@ export default { translation: { - hello: 'Hello', + newGame: "New Game", + searchingOppenent: 'Please wait, searching opponent...', } }; \ No newline at end of file diff --git a/mobile/src/localization/tr.ts b/mobile/src/localization/tr.ts index 308ddc5..be382f8 100644 --- a/mobile/src/localization/tr.ts +++ b/mobile/src/localization/tr.ts @@ -1,5 +1,6 @@ export default { translation: { - hello: 'Merhaba', + newGame: "Yeni Oyun", + searchingOppenent: 'Lütfen bekleyin, rakip bulunuyor...', } }; \ No newline at end of file diff --git a/mobile/src/screens/GameScreen.tsx b/mobile/src/screens/GameScreen.tsx new file mode 100644 index 0000000..b8c1e6a --- /dev/null +++ b/mobile/src/screens/GameScreen.tsx @@ -0,0 +1,13 @@ +import * as React from 'react'; +import { View, Button } from 'react-native'; +import { useTranslation } from 'react-i18next'; +import { GameScreenProps } from '../types'; + +export function GameScreen({ navigation, route }: GameScreenProps) { + const { t } = useTranslation(); + + return ( + + + ); +} diff --git a/mobile/src/screens/HomeScreen.tsx b/mobile/src/screens/HomeScreen.tsx new file mode 100644 index 0000000..487249d --- /dev/null +++ b/mobile/src/screens/HomeScreen.tsx @@ -0,0 +1,16 @@ +import * as React from 'react'; +import { View, Button } from 'react-native'; +import { useTranslation } from 'react-i18next'; +import { HomeScreenProps } from '../types'; + +export function HomeScreen({ navigation, route }: HomeScreenProps) { + const { t } = useTranslation(); + + return ( + + + + ); +} diff --git a/mobile/src/screens/LobyScreen.tsx b/mobile/src/screens/LobyScreen.tsx new file mode 100644 index 0000000..687372c --- /dev/null +++ b/mobile/src/screens/LobyScreen.tsx @@ -0,0 +1,14 @@ +import * as React from 'react'; +import { View, Text, Button } from 'react-native'; +import { useTranslation } from 'react-i18next'; +import { LobyScreenProps } from '../types'; + +export default function LobyScreen({ navigation, route }: LobyScreenProps) { + const { t } = useTranslation(); + + return ( + + {t('searchingOppenent')} + + ); +} \ No newline at end of file diff --git a/mobile/src/types/index.ts b/mobile/src/types/index.ts new file mode 100644 index 0000000..68c4b85 --- /dev/null +++ b/mobile/src/types/index.ts @@ -0,0 +1,13 @@ +import type { NativeStackScreenProps } from '@react-navigation/native-stack'; + +export type RootStackParamList = { + Home: undefined, + Loby: undefined, + Game: { gameId: string } +}; + +export type HomeScreenProps = NativeStackScreenProps; + +export type LobyScreenProps = NativeStackScreenProps; + +export type GameScreenProps = NativeStackScreenProps;