From 6558df05585a3ec4a2590c21d656c75ab6908e41 Mon Sep 17 00:00:00 2001 From: emkartal1 Date: Tue, 26 Dec 2023 19:29:26 +0100 Subject: [PATCH] Small improvements :hammer: --- src/Api/src/controllers/._userController.ts | Bin 4096 -> 0 bytes src/FLAD/components/CardMusicComponent.tsx | 5 ++--- src/FLAD/components/FriendComponent.tsx | 5 ++--- src/FLAD/components/NextButtonComponent.tsx | 5 ++--- src/FLAD/components/OnboardingComponent.tsx | 5 ++--- src/FLAD/constants/colors.ts | 20 +++++++++++++++++++ src/FLAD/constants/colorsDark.ts | 6 ------ src/FLAD/constants/colorsLight.ts | 6 ------ src/FLAD/navigation/FavoriteNavigation.tsx | 10 +++++----- src/FLAD/navigation/MessagingNavigation.tsx | 15 +++++++------- src/FLAD/navigation/SettingNavigation.tsx | 10 +++++----- src/FLAD/navigation/SpotNavigation.tsx | 10 +++++----- src/FLAD/navigation/StartNavigation.tsx | 12 +++++------ src/FLAD/screens/ChatScreen.tsx | 5 ++--- src/FLAD/screens/ConversationScreen.tsx | 21 ++++++++++---------- src/FLAD/screens/FavoriteScreen.tsx | 5 ++--- src/FLAD/screens/ProfilScreen.tsx | 5 ++--- src/FLAD/screens/SettingScreen.tsx | 5 ++--- src/FLAD/screens/SpotScreen.tsx | 5 ++--- src/FLAD/screens/StartScreen.tsx | 5 ++--- 20 files changed, 78 insertions(+), 82 deletions(-) delete mode 100644 src/Api/src/controllers/._userController.ts create mode 100644 src/FLAD/constants/colors.ts delete mode 100644 src/FLAD/constants/colorsDark.ts delete mode 100644 src/FLAD/constants/colorsLight.ts diff --git a/src/Api/src/controllers/._userController.ts b/src/Api/src/controllers/._userController.ts deleted file mode 100644 index 88aa1e667760fc6853f61c2229eecd9eef004f5b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4096 zcmZQz6=P>$Vqox1Ojhs@R)|o50+1L3ClDJkFz{^v(m+1nBL)UWIUt(=a103v`v3o@ zC`1Rt0-$mMG%bukK2%&PIX_n~v7jI)RWB#8xTLf=H6Kf7%s{i3$kztVg G{~rJtx-9wt diff --git a/src/FLAD/components/CardMusicComponent.tsx b/src/FLAD/components/CardMusicComponent.tsx index 3426f8e..a921345 100644 --- a/src/FLAD/components/CardMusicComponent.tsx +++ b/src/FLAD/components/CardMusicComponent.tsx @@ -1,8 +1,7 @@ import React from 'react'; import { StyleSheet, Text, View, Image } from 'react-native'; import { useSelector } from 'react-redux'; -import { colorsDark } from '../constants/colorsDark'; -import { colorsLight } from '../constants/colorsLight'; +import { LightTheme, DarkTheme, Theme } from "../constants/colors"; import normalize from './Normalize'; import Music from '../models/Music'; import Artist from '../models/Artist'; @@ -14,7 +13,7 @@ type CardMusicProps = { export default function CardMusic(props: CardMusicProps) { // @ts-ignore const isDark = useSelector(state => state.userReducer.dark); - const style = isDark ? colorsDark : colorsLight; + const style: Theme = isDark ? DarkTheme : LightTheme; const styles = StyleSheet.create({ container: { diff --git a/src/FLAD/components/FriendComponent.tsx b/src/FLAD/components/FriendComponent.tsx index 5126844..3355cec 100644 --- a/src/FLAD/components/FriendComponent.tsx +++ b/src/FLAD/components/FriendComponent.tsx @@ -1,8 +1,7 @@ import React from 'react'; import { StyleSheet, Text, View, Image } from 'react-native'; import { useSelector } from 'react-redux'; -import { colorsDark } from '../constants/colorsDark'; -import { colorsLight } from '../constants/colorsLight'; +import { LightTheme, DarkTheme, Theme } from "../constants/colors"; import normalize from './Normalize'; import Message from '../models/Message'; @@ -16,7 +15,7 @@ export default function Friend(props: FriendProps) { // @ts-ignore const isDark = useSelector(state => state.userReducer.dark); - const style = isDark ? colorsDark : colorsLight; + const style: Theme = isDark ? DarkTheme : LightTheme; const source = typeof props.image === 'string' ? { uri: props.image } : props.image; diff --git a/src/FLAD/components/NextButtonComponent.tsx b/src/FLAD/components/NextButtonComponent.tsx index a7ea82b..1b9abfc 100644 --- a/src/FLAD/components/NextButtonComponent.tsx +++ b/src/FLAD/components/NextButtonComponent.tsx @@ -2,13 +2,12 @@ import React, { useRef, useEffect } from 'react'; import { View, StyleSheet, TouchableOpacity, Animated, useColorScheme } from 'react-native'; import Svg, { G, Circle } from 'react-native-svg'; import { AntDesign } from '@expo/vector-icons'; -import { colorsDark } from '../constants/colorsDark'; -import { colorsLight } from '../constants/colorsLight'; +import { LightTheme, DarkTheme, Theme } from "../constants/colors"; import normalize from './Normalize'; // @ts-ignore export default function NextButton({ percentage, scrollTo }) { - const style = useColorScheme() == 'light' ? colorsLight : colorsDark; + const style: Theme = useColorScheme() == 'light' ? LightTheme : DarkTheme; const size = normalize(148); const strokeWidth = 2; diff --git a/src/FLAD/components/OnboardingComponent.tsx b/src/FLAD/components/OnboardingComponent.tsx index 41ae818..5d22aa7 100644 --- a/src/FLAD/components/OnboardingComponent.tsx +++ b/src/FLAD/components/OnboardingComponent.tsx @@ -1,12 +1,11 @@ import React from 'react'; import { View, StyleSheet, Text, Image, useWindowDimensions, useColorScheme } from 'react-native'; import normalize from './Normalize'; -import { colorsDark } from '../constants/colorsDark'; -import { colorsLight } from '../constants/colorsLight'; +import { LightTheme, DarkTheme, Theme } from "../constants/colors"; // @ts-ignore export default function OnboardingComponent({ item }) { - const style = useColorScheme() == 'light' ? colorsLight : colorsDark; + const style: Theme = useColorScheme() == 'light' ? LightTheme : DarkTheme; const { width, height } = useWindowDimensions(); const styles = StyleSheet.create({ container: { diff --git a/src/FLAD/constants/colors.ts b/src/FLAD/constants/colors.ts new file mode 100644 index 0000000..2d7f8ea --- /dev/null +++ b/src/FLAD/constants/colors.ts @@ -0,0 +1,20 @@ +export interface Theme { + body: string, + Text: string, + Card: string, + Line: string +} + +export const LightTheme: Theme = { + body: "#f2f2f6", + Text: "black", + Card: "#fff", + Line: "#e2e2e3" +} + +export const DarkTheme: Theme = { + body: "#141414", + Text: "white", + Card: "#232123", + Line: "#403F3F" +} \ No newline at end of file diff --git a/src/FLAD/constants/colorsDark.ts b/src/FLAD/constants/colorsDark.ts deleted file mode 100644 index acfde99..0000000 --- a/src/FLAD/constants/colorsDark.ts +++ /dev/null @@ -1,6 +0,0 @@ -export const colorsDark = { - "body": "#141414", - "Text": "white", - "Card": "#232123", - "Line": "#403F3F" -} \ No newline at end of file diff --git a/src/FLAD/constants/colorsLight.ts b/src/FLAD/constants/colorsLight.ts deleted file mode 100644 index 199168d..0000000 --- a/src/FLAD/constants/colorsLight.ts +++ /dev/null @@ -1,6 +0,0 @@ -export const colorsLight = { - "body": "#f2f2f6", - "Text": "black", - "Card": "#fff", - "Line": "#e2e2e3" -} \ No newline at end of file diff --git a/src/FLAD/navigation/FavoriteNavigation.tsx b/src/FLAD/navigation/FavoriteNavigation.tsx index fdb2b3f..d723d7a 100644 --- a/src/FLAD/navigation/FavoriteNavigation.tsx +++ b/src/FLAD/navigation/FavoriteNavigation.tsx @@ -3,20 +3,20 @@ import Favorite from '../screens/FavoriteScreen'; import DetailScreen from '../screens/DetailScreen'; import { createSharedElementStackNavigator } from 'react-navigation-shared-element'; -const Stack = createSharedElementStackNavigator(); +const FavoriteStack = createSharedElementStackNavigator(); export default function MusicNavigation() { return ( - - + - - + ) } \ No newline at end of file diff --git a/src/FLAD/navigation/MessagingNavigation.tsx b/src/FLAD/navigation/MessagingNavigation.tsx index 2a3b467..d204415 100644 --- a/src/FLAD/navigation/MessagingNavigation.tsx +++ b/src/FLAD/navigation/MessagingNavigation.tsx @@ -3,15 +3,14 @@ import ConversationScreen from '../screens/ConversationScreen' import { Image, View, Text, StyleSheet } from 'react-native'; import ChatScreen from '../screens/ChatScreen'; import { createStackNavigator } from '@react-navigation/stack'; -import { colorsDark } from "../constants/colorsDark"; -import { colorsLight } from "../constants/colorsLight"; +import { LightTheme, DarkTheme, Theme } from "../constants/colors"; import { useSelector } from 'react-redux'; export default function MessagingNavigation() { // @ts-ignore const isDark = useSelector(state => state.userReducer.dark); - const style = isDark ? colorsDark : colorsLight; - const Stack = createStackNavigator(); + const style: Theme = isDark ? DarkTheme : LightTheme; + const MessagingStack = createStackNavigator(); const styles = StyleSheet.create({ headerContainer: { @@ -32,13 +31,13 @@ export default function MessagingNavigation() { }); return ( - - + - ({ @@ -65,6 +64,6 @@ export default function MessagingNavigation() { }, })} /> - + ) } \ No newline at end of file diff --git a/src/FLAD/navigation/SettingNavigation.tsx b/src/FLAD/navigation/SettingNavigation.tsx index 9e545fe..9c8dfd9 100644 --- a/src/FLAD/navigation/SettingNavigation.tsx +++ b/src/FLAD/navigation/SettingNavigation.tsx @@ -4,19 +4,19 @@ import ProfilScreen from '../screens/ProfilScreen'; import { createStackNavigator } from '@react-navigation/stack'; export default function SettingNavigation() { - const Stack = createStackNavigator(); + const SettingStack = createStackNavigator(); return ( - - + - - + ) } \ No newline at end of file diff --git a/src/FLAD/navigation/SpotNavigation.tsx b/src/FLAD/navigation/SpotNavigation.tsx index 1abaeba..d8c6694 100644 --- a/src/FLAD/navigation/SpotNavigation.tsx +++ b/src/FLAD/navigation/SpotNavigation.tsx @@ -4,19 +4,19 @@ import DetailScreen from '../screens/DetailScreen'; import { createStackNavigator } from '@react-navigation/stack'; export default function SpotNavigation() { - const Stack = createStackNavigator(); + const SpotStack = createStackNavigator(); return ( - - + - - + ) } \ No newline at end of file diff --git a/src/FLAD/navigation/StartNavigation.tsx b/src/FLAD/navigation/StartNavigation.tsx index 2358fea..aeed323 100644 --- a/src/FLAD/navigation/StartNavigation.tsx +++ b/src/FLAD/navigation/StartNavigation.tsx @@ -6,26 +6,26 @@ import { createStackNavigator } from '@react-navigation/stack'; import { NavigationContainer } from '@react-navigation/native'; export default function StartNavigation() { - const Stack = createStackNavigator(); + const StartStack = createStackNavigator(); return ( - - + - - - + ) diff --git a/src/FLAD/screens/ChatScreen.tsx b/src/FLAD/screens/ChatScreen.tsx index bc56b9c..7264722 100644 --- a/src/FLAD/screens/ChatScreen.tsx +++ b/src/FLAD/screens/ChatScreen.tsx @@ -1,8 +1,7 @@ import React, { useCallback, useEffect, useState } from "react"; import { Bubble, GiftedChat, IMessage, InputToolbar, Send } from "react-native-gifted-chat"; import { faFileImage, faMicrophone } from "@fortawesome/free-solid-svg-icons" -import { colorsDark } from "../constants/colorsDark"; -import { colorsLight } from "../constants/colorsLight"; +import { LightTheme, DarkTheme, Theme } from "../constants/colors"; import { useDispatch, useSelector } from 'react-redux'; import { SafeAreaView, TouchableOpacity, View } from "react-native"; import Icon from 'react-native-vector-icons/Ionicons'; @@ -20,7 +19,7 @@ export default function Chat({ route }) { // @ts-ignore const isDark = useSelector(state => state.userReducer.dark); - const style = isDark ? colorsDark : colorsLight; + const style: Theme = isDark ? DarkTheme : LightTheme; const dispatch = useDispatch(); diff --git a/src/FLAD/screens/ConversationScreen.tsx b/src/FLAD/screens/ConversationScreen.tsx index cd1da8d..aecc80a 100644 --- a/src/FLAD/screens/ConversationScreen.tsx +++ b/src/FLAD/screens/ConversationScreen.tsx @@ -1,12 +1,11 @@ import { useNavigation } from "@react-navigation/native"; import { StyleSheet, Text, View, FlatList, TouchableOpacity, RefreshControl } from "react-native"; import { useSelector, useDispatch } from "react-redux"; -import { colorsDark } from '../constants/colorsDark'; -import { colorsLight } from '../constants/colorsLight'; +import { LightTheme, DarkTheme, Theme } from "../constants/colors"; import Friend from "../components/FriendComponent"; import normalize from '../components/Normalize'; import { useSafeAreaInsets } from "react-native-safe-area-context"; -import { useCallback, useEffect, useState } from "react"; +import { useEffect, useState } from "react"; import { getConversations } from "../redux/thunk/chatThunk"; export default function ConversationScreen() { @@ -35,7 +34,7 @@ export default function ConversationScreen() { const navigation = useNavigation(); - const style = isDark ? colorsDark : colorsLight; + const style: Theme = isDark ? DarkTheme : LightTheme; const insets = useSafeAreaInsets(); @@ -60,15 +59,15 @@ export default function ConversationScreen() { marginBottom: 5 }, body: { - alignItems: 'center', - justifyContent: 'center', - flex: 1, + alignItems: 'center', + justifyContent: 'center', + flex: 1, marginHorizontal: "7%" }, text: { - color: style.Text, - fontSize: normalize(18), - opacity: 0.8, + color: style.Text, + fontSize: normalize(18), + opacity: 0.8, textAlign: 'center' } }) @@ -81,7 +80,7 @@ export default function ConversationScreen() { {friends.length === 0 ? ( - + Pas de conversations pour le moment. 🥲{'\n'} Va liker des musiques pour créer des conversations avec des gens dans le monde ! 🔥🎆 diff --git a/src/FLAD/screens/FavoriteScreen.tsx b/src/FLAD/screens/FavoriteScreen.tsx index dcc61a0..a39d716 100644 --- a/src/FLAD/screens/FavoriteScreen.tsx +++ b/src/FLAD/screens/FavoriteScreen.tsx @@ -6,8 +6,7 @@ import { Svg, Path } from 'react-native-svg'; import FladyComponent from '../components/FladyComponent'; import { useNavigation, useFocusEffect } from "@react-navigation/native"; import { useSelector, useDispatch } from 'react-redux'; -import { colorsDark } from '../constants/colorsDark'; -import { colorsLight } from '../constants/colorsLight'; +import { LightTheme, DarkTheme, Theme } from "../constants/colors"; import { getFavoriteMusic } from '../redux/thunk/appThunk'; import { Spot } from '../models/Spot'; import { useSafeAreaInsets } from 'react-native-safe-area-context'; @@ -17,7 +16,7 @@ export default function FavoriteScreen() { // @ts-ignore const isDark = useSelector(state => state.userReducer.dark); - const style = isDark ? colorsDark : colorsLight; + const style: Theme = isDark ? DarkTheme : LightTheme; const [refreshing, setRefreshing] = useState(false); const images = [ diff --git a/src/FLAD/screens/ProfilScreen.tsx b/src/FLAD/screens/ProfilScreen.tsx index 1e3b808..09b187f 100644 --- a/src/FLAD/screens/ProfilScreen.tsx +++ b/src/FLAD/screens/ProfilScreen.tsx @@ -9,8 +9,7 @@ import * as AuthSession from 'expo-auth-session'; import normalize from '../components/Normalize'; import * as ImagePicker from 'expo-image-picker'; import { useSafeAreaInsets } from 'react-native-safe-area-context'; -import { colorsDark } from '../constants/colorsDark'; -import { colorsLight } from '../constants/colorsLight'; +import { LightTheme, DarkTheme, Theme } from "../constants/colors"; import { deleteUser } from '../redux/thunk/authThunk'; import { setImage, setMail, setName, setPassword, setSpotify } from '../redux/thunk/userThunk'; import { setErrorUpdate } from '../redux/actions/userActions'; @@ -38,7 +37,7 @@ export default function ProfilScreen() { const [oldPassword, setOldPassword] = React.useState(''); const [newPassword, setNewPassword] = React.useState(''); const [confirmPassword, setConfirmPassword] = React.useState(''); - const style = isDark ? colorsDark : colorsLight; + const style: Theme = isDark ? DarkTheme : LightTheme; const navigation = useNavigation(); const [isModalVisible, setIsModalVisible] = React.useState(false); const dispatch = useDispatch(); diff --git a/src/FLAD/screens/SettingScreen.tsx b/src/FLAD/screens/SettingScreen.tsx index b13686e..95b33a8 100644 --- a/src/FLAD/screens/SettingScreen.tsx +++ b/src/FLAD/screens/SettingScreen.tsx @@ -9,8 +9,7 @@ import { ScrollView, Switch, TextInput } from 'react-native-gesture-handler'; import CardMusic from '../components/CardMusicComponent'; import { logout } from '../redux/thunk/authThunk'; import { darkMode } from '../redux/thunk/userThunk'; -import { colorsDark } from '../constants/colorsDark'; -import { colorsLight } from '../constants/colorsLight'; +import { LightTheme, DarkTheme, Theme } from "../constants/colors"; import { User } from '../models/User'; import { useSafeAreaInsets } from 'react-native-safe-area-context'; import * as Location from 'expo-location'; @@ -40,7 +39,7 @@ export default function SettingScreen() { // @ts-ignore const isDark = useSelector(state => state.userReducer.dark); const [locationPermission, setLocationPermission] = useState(false); - const style = isDark ? colorsDark : colorsLight; + const style: Theme = isDark ? DarkTheme : LightTheme; async function ChangeDarkMode() { const newValue = !isDark; diff --git a/src/FLAD/screens/SpotScreen.tsx b/src/FLAD/screens/SpotScreen.tsx index c6b5249..5017125 100644 --- a/src/FLAD/screens/SpotScreen.tsx +++ b/src/FLAD/screens/SpotScreen.tsx @@ -13,15 +13,14 @@ import Artist from '../models/Artist'; import { addMusicToFavorite } from '../redux/thunk/appThunk'; import { addToPlaylist, removeSpot } from '../redux/thunk/spotThunk'; import UserInfoBadge from '../components/UserInfoBadgeComponent'; -import { colorsDark } from '../constants/colorsDark'; -import { colorsLight } from '../constants/colorsLight'; +import { LightTheme, DarkTheme, Theme } from "../constants/colors"; export default function SpotScreen() { //@ts-ignore const spotReducer: Spot[] = useSelector(state => state.appReducer.spot) // @ts-ignore const isDark = useSelector(state => state.userReducer.dark); - const style = isDark ? colorsDark : colorsLight; + const style: Theme = isDark ? DarkTheme : LightTheme; const [cards, setCards] = useState(spotReducer); const [currentCard, setcurrentCard] = useState(cards[cards.length - 1]); diff --git a/src/FLAD/screens/StartScreen.tsx b/src/FLAD/screens/StartScreen.tsx index 4a0b630..7a3a0c8 100644 --- a/src/FLAD/screens/StartScreen.tsx +++ b/src/FLAD/screens/StartScreen.tsx @@ -6,11 +6,10 @@ import OnboardingItem from '../components/OnboardingComponent'; import Paginator from '../components/PaginatorComponent'; import NextButton from '../components/NextButtonComponent'; import slides from '../data/slides'; -import { colorsDark } from '../constants/colorsDark'; -import { colorsLight } from '../constants/colorsLight'; +import { LightTheme, DarkTheme, Theme } from "../constants/colors"; export default function StartScreen() { - const style = useColorScheme() == 'light' ? colorsLight : colorsDark; + const style: Theme = useColorScheme() == 'light' ? LightTheme : DarkTheme; const [currentIndex, setCurrentIndex] = useState(0); const scrollX = useRef(new Animated.Value(0)).current; const slidesRef = useRef(null);