diff --git a/App.tsx b/App.tsx
index 75d3e21..3b8e97f 100644
--- a/App.tsx
+++ b/App.tsx
@@ -1,9 +1,9 @@
// App.tsx
-import React from 'react';
-import Navigation from "./navigation/Navigation";
-import store from "./redux/store";
-import { Provider } from "react-redux";
+import React from 'react';
+import Navigation from "./navigation/Navigation";
+import store from "./redux/store";
+import { Provider } from "react-redux";
import { SafeAreaProvider } from "react-native-safe-area-context";
export default function App() {
diff --git a/README.md b/README.md
index 43d6acd..7827381 100644
--- a/README.md
+++ b/README.md
@@ -60,31 +60,47 @@ This app will contain a home page, and a "master/detail" tab for `Moves` with ba
The home screen provides a logo, and tab navigation options to other parts of the application.
-
+
### Collection
The collection screen displays a list of `Moves` fetched from the API.
-
+>
### Detail
The detail screen displays detailed information about a selected `Move`.
-
+>
### Creating
The creating screen provides a form for creating a new `Move`.
-
+>
### Updating
The updating screen provides a form for updating an existing `Move`.
-
+>
+
+## Some business logic
+
+While the back end doesn't forbid a `Move` from being both weak against and effective against the same one type,
+it should. That's one of the flaws of that API.
+
+In this app, we did implement the business logic described above in our callbacks for our `MultiSelect` elements, like
+so:
+
+```typescript
+const handleSelectType = (selectedTypes: string[], setTypes: React.Dispatch>, otherSelectedTypes: string[]) => {
+ const uniqueSelectedTypes = Array.from(new Set(selectedTypes));
+ const withoutDuplicatesFromOtherColumn = uniqueSelectedTypes.filter(type => !otherSelectedTypes.includes(type));
+ setTypes(withoutDuplicatesFromOtherColumn);
+};
+```
## Using the app
@@ -94,9 +110,16 @@ In order to use this app, you will need to run the dedicated backend. A `README`
with [instructions](https://github.com/draialexis/pokemong_api#user-content-prep-steps) is provided
for that purpose.
+### Connecting to the backend locally
+
+First, please find the `config.ts` file at the root of this project, and replace ~~`192.168.0.15`~~
+with the IPv4 address associated with your own Wi-Fi adapter.
+
+To find that address out, you can run `ipconfig` on Windows or `ifconfig` on macOS/Linux in your terminal.
+
### Running this app
-With the [Expo CLI](https://docs.expo.dev/more/expo-cli/) installed, at the root of the project, simply run
+Then, with the [Expo CLI](https://docs.expo.dev/more/expo-cli/) installed, at the root of the project, simply run
```bash
npx expo start
diff --git a/components/AlertModal.tsx b/components/AlertModal.tsx
index d0cca41..cd00fbd 100644
--- a/components/AlertModal.tsx
+++ b/components/AlertModal.tsx
@@ -1,6 +1,6 @@
// components/AlertModal.tsx
import { Button, Modal, StyleSheet, Text, View } from 'react-native';
-import React from 'react';
+import React from 'react';
type AlertModalProps = {
visible: boolean;
diff --git a/components/MoveListItem.tsx b/components/MoveListItem.tsx
index 874ce42..0e3a83d 100644
--- a/components/MoveListItem.tsx
+++ b/components/MoveListItem.tsx
@@ -1,7 +1,7 @@
// components/MoveListItem.test.ts
-import { Move } from "../entities/Move";
-import React from "react";
+import { Move } from "../entities/Move";
+import React from "react";
import { StyleSheet, Text, TouchableOpacity, ViewStyle } from "react-native";
type MoveListItemProps = {
diff --git a/components/TypeTacticsInfoList.test.tsx b/components/TypeTacticsInfoList.test.tsx
index 0899a7d..eaeee19 100644
--- a/components/TypeTacticsInfoList.test.tsx
+++ b/components/TypeTacticsInfoList.test.tsx
@@ -1,9 +1,9 @@
// components/TypeTacticsInfoList.test.ts
-import React from 'react';
-import { render } from '@testing-library/react-native';
+import React from 'react';
+import { render } from '@testing-library/react-native';
import TypeTacticsInfoList from './TypeTacticsInfoList';
-import { TypeName } from "../entities/TypeName";
+import { TypeName } from "../entities/TypeName";
describe('TypeTacticsInfoList component', () => {
it('renders types correctly', () => {
diff --git a/components/TypeTacticsInfoList.tsx b/components/TypeTacticsInfoList.tsx
index d95b1e0..f023ba0 100644
--- a/components/TypeTacticsInfoList.tsx
+++ b/components/TypeTacticsInfoList.tsx
@@ -1,6 +1,6 @@
// components/TypeTacticsInfoList.ts
-import React from "react";
+import React from "react";
import { ScrollView, StyleSheet, Text, View } from "react-native";
type TypeListProps = {
diff --git a/config.ts b/config.ts
index 3b99d72..b7ae1ac 100644
--- a/config.ts
+++ b/config.ts
@@ -1,2 +1,2 @@
// config.ts
-export const API_BASE_URL = 'http://localhost:8080';
+export const API_BASE_URL = 'http://192.168.0.15:8080';
diff --git a/entities/Move.ts b/entities/Move.ts
index bc81044..0f1603c 100644
--- a/entities/Move.ts
+++ b/entities/Move.ts
@@ -1,6 +1,6 @@
// entities/Move.ts
-import { Type } from "./Type";
+import { Type } from "./Type";
import { MoveCategoryName } from "./MoveCategoryName";
export interface Move {
diff --git a/navigation/Navigation.tsx b/navigation/Navigation.tsx
index 3742d5e..c163ee4 100644
--- a/navigation/Navigation.tsx
+++ b/navigation/Navigation.tsx
@@ -1,15 +1,15 @@
// navigation/Navigation.tsx
-import React from 'react';
-import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
-import { NavigationContainer } from '@react-navigation/native';
-import MoveListScreen from '../screens/moves/MoveListScreen';
-import MoveDetailScreen from '../screens/moves/MoveDetailScreen';
-import HomeScreen from '../screens/HomeScreen';
-import { createStackNavigator } from '@react-navigation/stack';
+import React from 'react';
+import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
+import { NavigationContainer } from '@react-navigation/native';
+import MoveListScreen from '../screens/moves/MoveListScreen';
+import MoveDetailScreen from '../screens/moves/MoveDetailScreen';
+import HomeScreen from '../screens/HomeScreen';
+import { createStackNavigator } from '@react-navigation/stack';
import { RootStackParamList, RootTabParamList } from "./navigationTypes";
-import { Image, StyleSheet } from 'react-native';
-import MoveFormScreen from "../screens/moves/MoveFormScreen";
+import { Image, StyleSheet } from 'react-native';
+import MoveFormScreen from "../screens/moves/MoveFormScreen";
const Stack = createStackNavigator();
const Tab = createBottomTabNavigator();
diff --git a/redux/actions/moveActions.ts b/redux/actions/moveActions.ts
index 267155c..f6f9dcc 100644
--- a/redux/actions/moveActions.ts
+++ b/redux/actions/moveActions.ts
@@ -1,10 +1,8 @@
// redux/actions/moveAction.ts
import { CREATE_MOVE, DELETE, DELETE_MOVE, GET, GET_MOVES, MOVE_ERROR, POST, PUT, UPDATE_MOVE } from '../constants';
-import {
- Move
-} from "../../entities/Move";
-import { Dispatch } from "redux";
-import { API_BASE_URL } from "../../config";
+import { Move } from "../../entities/Move";
+import { Dispatch } from "redux";
+import { API_BASE_URL } from "../../config";
export const createMove = (move: Move) => {
diff --git a/redux/reducers/moveReducer.ts b/redux/reducers/moveReducer.ts
index 0339c30..2d4062a 100644
--- a/redux/reducers/moveReducer.ts
+++ b/redux/reducers/moveReducer.ts
@@ -1,6 +1,6 @@
// redux/reducers/moveReducer.ts
import { CREATE_MOVE, DELETE_MOVE, GET_MOVES, MOVE_ERROR, UPDATE_MOVE } from '../constants';
-import { Move } from "../../entities/Move";
+import { Move } from "../../entities/Move";
export type MoveState = {
moves: Move[];
diff --git a/redux/store.ts b/redux/store.ts
index 78aff04..19d830b 100644
--- a/redux/store.ts
+++ b/redux/store.ts
@@ -1,6 +1,6 @@
// redux/store.ts
-import { configureStore } from '@reduxjs/toolkit'
+import { configureStore } from '@reduxjs/toolkit'
import moveReducer, { MoveState } from './reducers/moveReducer';
export type AppDispatch = typeof store.dispatch;
diff --git a/screens/HomeScreen.tsx b/screens/HomeScreen.tsx
index af331b3..b9df2ce 100644
--- a/screens/HomeScreen.tsx
+++ b/screens/HomeScreen.tsx
@@ -1,6 +1,6 @@
// screens/HomeScreen.tsx
-import React from 'react';
+import React from 'react';
import { Image, View } from 'react-native';
const HomeScreen = () => {
diff --git a/screens/moves/MoveDetailScreen.tsx b/screens/moves/MoveDetailScreen.tsx
index 0a85552..0ace9be 100644
--- a/screens/moves/MoveDetailScreen.tsx
+++ b/screens/moves/MoveDetailScreen.tsx
@@ -1,15 +1,15 @@
// screens/moves/MoveDetailScreen.tsx
-import React, { useEffect } from 'react';
+import React, { useEffect } from 'react';
import { Button, ScrollView, StyleSheet, Text, View } from 'react-native';
-import { RouteProp } from '@react-navigation/native';
-import { RootStackParamList } from "../../navigation/navigationTypes";
-import TypeTacticsInfoList from "../../components/TypeTacticsInfoList"
-import { StackNavigationProp } from "@react-navigation/stack";
-import { MOVE_DETAIL, MOVE_FORM } from '../../navigation/constants';
-import { useSelector } from "react-redux";
-import { RootState } from "../../redux/store";
-import { Move } from "../../entities/Move";
+import { RouteProp } from '@react-navigation/native';
+import { RootStackParamList } from "../../navigation/navigationTypes";
+import TypeTacticsInfoList from "../../components/TypeTacticsInfoList"
+import { StackNavigationProp } from "@react-navigation/stack";
+import { MOVE_DETAIL, MOVE_FORM } from '../../navigation/constants';
+import { useSelector } from "react-redux";
+import { RootState } from "../../redux/store";
+import { Move } from "../../entities/Move";
type MoveDetailScreenNavigationProp = StackNavigationProp;
@@ -35,7 +35,10 @@ const MoveDetailScreen = ({ navigation, route }: Props) => {
return (
-