parent
a3e567f291
commit
90b1e450e1
@ -1,13 +1,13 @@
|
|||||||
import axios from 'axios';
|
import axios from "axios";
|
||||||
|
|
||||||
const apiClient = axios.create({
|
const apiClient = axios.create({
|
||||||
baseURL: 'https://codefirst.iut.uca.fr/containers/Optifit-optifit-ef-api/api/v1/',
|
baseURL:
|
||||||
timeout: 10000,
|
"https://codefirst.iut.uca.fr/containers/Optifit-optifit-ef-api/api/v1/",
|
||||||
headers: {
|
timeout: 10000,
|
||||||
'Accept': 'application/json',
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
Accept: "application/json",
|
||||||
// ajoute ici les headers supplémentaires, ex. Auth
|
"Content-Type": "application/json",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export default apiClient;
|
export default apiClient;
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
import apiClient from "@/api/client";
|
|
||||||
import { EXERCICES } from "@/api/endpoints";
|
|
||||||
import { AbstractService } from "../abstract.service";
|
|
||||||
|
|
||||||
export class ExerciceService extends AbstractService {
|
|
||||||
async getExercices() {
|
|
||||||
return this.request(async () => {
|
|
||||||
const response = await apiClient.get(EXERCICES.GETALL);
|
|
||||||
return response.data.data;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,14 @@
|
|||||||
|
import { EXERCICES } from "@/api/endpoints";
|
||||||
|
import { Workout } from "@/model/Workout";
|
||||||
|
import { AbstractService } from "../abstract.service";
|
||||||
|
import { IExerciceInterface } from "./exercice.service.interface";
|
||||||
|
|
||||||
|
export class ExerciceAPIService
|
||||||
|
extends AbstractService
|
||||||
|
implements IExerciceInterface
|
||||||
|
{
|
||||||
|
async getExercices(): Promise<Workout[]> {
|
||||||
|
const data = await this.request(EXERCICES.GETALL);
|
||||||
|
return data.data.map((item: any) => Workout.fromJson(item));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,3 @@
|
|||||||
|
export interface IExerciceInterface {
|
||||||
|
getExercices(): Promise<any>;
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
import { AbstractService } from "../abstract.service";
|
||||||
|
import { IExerciceInterface } from "./exercice.service.interface";
|
||||||
|
|
||||||
|
export class ExerciceStubService
|
||||||
|
extends AbstractService
|
||||||
|
implements IExerciceInterface
|
||||||
|
{
|
||||||
|
async getExercices() {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
@ -1,14 +1,31 @@
|
|||||||
import apiClient from "@/api/client";
|
|
||||||
import { AUTH } from "@/api/endpoints";
|
|
||||||
import { User } from "@/model/User";
|
import { User } from "@/model/User";
|
||||||
|
import { setItemAsync } from "expo-secure-store";
|
||||||
import { AbstractService as AbstractAPIService } from "../abstract.service";
|
import { AbstractService as AbstractAPIService } from "../abstract.service";
|
||||||
import { IUserService } from "./user.service.interface";
|
import { IUserService } from "./user.service.interface";
|
||||||
|
|
||||||
export class UserAPIService extends AbstractAPIService implements IUserService {
|
export class UserAPIService extends AbstractAPIService implements IUserService {
|
||||||
async login(email: string, password: string): Promise<User> {
|
async login(email: string, password: string): Promise<User> {
|
||||||
return this.request(async () => {
|
const body = new URLSearchParams({
|
||||||
const response = await apiClient.get(AUTH.LOGIN);
|
grant_type: "password",
|
||||||
return response.data.data;
|
client_id: email,
|
||||||
|
client_secret: this.CLIENT_SECRET,
|
||||||
|
email,
|
||||||
|
password,
|
||||||
|
scope: this.SCOPES,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const res = await fetch(`${this.IDP_URL}/connect/token`, {
|
||||||
|
method: "POST",
|
||||||
|
headers: { "Content-Type": "application/x-www-form-urlencoded" },
|
||||||
|
body: body.toString(),
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!res.ok) throw new Error(`Auth failed: ${res.status}`);
|
||||||
|
const json = await res.json();
|
||||||
|
|
||||||
|
await setItemAsync(this.ACCESS_TOKEN_PATH, json.access_token);
|
||||||
|
await setItemAsync(this.REFRESH_TOKEN_PATH, json.refresh_token);
|
||||||
|
|
||||||
|
return json;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
import {SafeAreaView, View, Text} from "react-native";
|
|
||||||
import React from "react";
|
|
||||||
import InternalError from "@/components/error/InternalErrorProblem";
|
import InternalError from "@/components/error/InternalErrorProblem";
|
||||||
|
import React from "react";
|
||||||
|
import { SafeAreaView, View } from "react-native";
|
||||||
|
|
||||||
export default function AddScreen() {
|
export default function AddScreen() {
|
||||||
return (
|
return (
|
||||||
<SafeAreaView>
|
<SafeAreaView>
|
||||||
<View>
|
<View>
|
||||||
<InternalError/>
|
<InternalError />
|
||||||
</View>
|
</View>
|
||||||
</SafeAreaView>
|
</SafeAreaView>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//<Text className="m-7 font-extrabold">Welcome to Add Screen </Text>
|
//<Text className="m-7 font-extrabold">Welcome to Add Screen </Text>
|
||||||
// <Text>We will do it soon</Text>
|
// <Text>We will do it soon</Text>
|
||||||
|
@ -1,19 +1,17 @@
|
|||||||
|
import { Stack } from "expo-router";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import {Stack} from "expo-router";
|
|
||||||
|
|
||||||
export default function RootoLayout() {
|
export default function RootoLayout() {
|
||||||
return (
|
return (
|
||||||
<Stack screenOptions={{
|
<Stack
|
||||||
headerShown: false,
|
screenOptions={{
|
||||||
}}
|
headerShown: false,
|
||||||
initialRouteName={"ExercicesScreen"}
|
}}
|
||||||
>
|
initialRouteName={"ExercicesScreen"}
|
||||||
<Stack.Screen name="ExercicesScreen" />
|
>
|
||||||
|
<Stack.Screen name="ExercicesScreen" />
|
||||||
|
|
||||||
<Stack.Screen name="WorkoutScreen"/>
|
<Stack.Screen name="WorkoutScreen" />
|
||||||
|
</Stack>
|
||||||
</Stack>
|
);
|
||||||
|
}
|
||||||
);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
@ -1,14 +1,13 @@
|
|||||||
import {SafeAreaView, Text, View} from "react-native";
|
|
||||||
import React from "react";
|
|
||||||
import Blocked from "@/components/error/BlockedProblem";
|
import Blocked from "@/components/error/BlockedProblem";
|
||||||
|
import React from "react";
|
||||||
|
import { SafeAreaView, View } from "react-native";
|
||||||
|
|
||||||
export default function HelpsScreen() {
|
export default function HelpsScreen() {
|
||||||
return (
|
return (
|
||||||
<SafeAreaView>
|
<SafeAreaView>
|
||||||
<View>
|
<View>
|
||||||
<Blocked/>
|
<Blocked />
|
||||||
</View>
|
</View>
|
||||||
</SafeAreaView>
|
</SafeAreaView>
|
||||||
|
);
|
||||||
);
|
}
|
||||||
}
|
|
||||||
|
@ -1,15 +1,14 @@
|
|||||||
|
import { Stack } from "expo-router";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import {Stack} from "expo-router";
|
|
||||||
import HelpsScreen from "@/app/(tabs)/(help)/HelpsScreen";
|
|
||||||
|
|
||||||
export default function RootoLayout() {
|
export default function RootoLayout() {
|
||||||
return (
|
return (
|
||||||
<Stack screenOptions={{
|
<Stack
|
||||||
headerShown: false,
|
screenOptions={{
|
||||||
}}>
|
headerShown: false,
|
||||||
<Stack.Screen name="HelpsScreen" />
|
}}
|
||||||
</Stack>
|
>
|
||||||
|
<Stack.Screen name="HelpsScreen" />
|
||||||
);
|
</Stack>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,6 @@
|
|||||||
import {SafeAreaView, Text, View} from "react-native";
|
|
||||||
import React from "react";
|
|
||||||
import HomeScreen from "@/app/(tabs)/(home)/HomeScreen";
|
import HomeScreen from "@/app/(tabs)/(home)/HomeScreen";
|
||||||
|
import React from "react";
|
||||||
|
|
||||||
export default function App() {
|
export default function App() {
|
||||||
|
return <HomeScreen />;
|
||||||
return (
|
}
|
||||||
<HomeScreen/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
@ -1,37 +1,50 @@
|
|||||||
import Text from "@/components/ui/Text";
|
|
||||||
import React, {forwardRef} from "react";
|
|
||||||
import {Image, View, ViewProps} from "react-native";
|
|
||||||
import BackButton from "@/components/BackButton";
|
import BackButton from "@/components/BackButton";
|
||||||
|
import Text from "@/components/ui/Text";
|
||||||
|
import React, { forwardRef } from "react";
|
||||||
|
import { Image, View, ViewProps } from "react-native";
|
||||||
|
|
||||||
import {Entypo} from "@expo/vector-icons";
|
import { Entypo } from "@expo/vector-icons";
|
||||||
|
|
||||||
export interface ProblemProps extends ViewProps{
|
export interface ProblemProps extends ViewProps {
|
||||||
picture: string;
|
picture: string;
|
||||||
problem: string;
|
problem: string;
|
||||||
description: string;
|
description: string;
|
||||||
information: string;
|
information: string;
|
||||||
isVisible?: boolean;
|
isVisible?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default forwardRef<any, ProblemProps> (({className, ...Props}, ref) => {
|
export default forwardRef<any, ProblemProps>(({ className, ...Props }, ref) => {
|
||||||
return (
|
return (
|
||||||
<View className={"gap-4 justify-between h-3/4" + " " + className} {...Props} ref={ref}>
|
<View
|
||||||
<View className="flex-row justify-between items-center p-4">
|
className={"gap-4 justify-between h-3/4" + " " + className}
|
||||||
<BackButton/>
|
{...Props}
|
||||||
</View>
|
ref={ref}
|
||||||
|
>
|
||||||
|
<View className="flex-row justify-between items-center p-4">
|
||||||
|
<BackButton />
|
||||||
|
</View>
|
||||||
|
|
||||||
<View className="flex-row justify-center">
|
<View className="flex-row justify-center">
|
||||||
<Image className="aspect-square w-3/5 h-3/5" source={Props.picture}/>
|
<Image className="aspect-square w-3/5 h-3/5" source={Props.picture} />
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<Text position="center" weight="bold" size="3xl"> {Props.problem} </Text>
|
<Text position="center" weight="bold" size="3xl">
|
||||||
<Text size="lg" position="center" className="text-gray-400"> {Props.description} </Text>
|
{" "}
|
||||||
<View className="flex-row justify-center">
|
{Props.problem}{" "}
|
||||||
<View className="flex-row items-center border-2 rounded-2xl bg-red-300 border-red-600 p-4">
|
</Text>
|
||||||
<Entypo name="warning" size={30} color="red"/>
|
<Text size="lg" position="center" className="text-gray-400">
|
||||||
<Text size="lg" position="center"> {Props.information} </Text>
|
{" "}
|
||||||
</View>
|
{Props.description}{" "}
|
||||||
</View>
|
</Text>
|
||||||
|
<View className="flex-row justify-center">
|
||||||
|
<View className="flex-row items-center border-2 rounded-2xl bg-red-300 border-red-600 p-4">
|
||||||
|
<Entypo name="warning" size={30} color="red" />
|
||||||
|
<Text size="lg" position="center">
|
||||||
|
{" "}
|
||||||
|
{Props.information}{" "}
|
||||||
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
);
|
</View>
|
||||||
});
|
</View>
|
||||||
|
);
|
||||||
|
});
|
||||||
|
@ -1,113 +1,114 @@
|
|||||||
import {Text, TouchableOpacity, View} from "react-native";
|
import React, { useRef, useState } from "react";
|
||||||
import {CurveType, LineChart} from "react-native-gifted-charts";
|
import { Text, TouchableOpacity, View } from "react-native";
|
||||||
import React, {useRef, useState} from "react";
|
import { CurveType, LineChart } from "react-native-gifted-charts";
|
||||||
|
|
||||||
export default function ActivitiesComponent() {
|
export default function ActivitiesComponent() {
|
||||||
const ref = useRef(null)
|
const ref = useRef(null);
|
||||||
const [dateSelected, setDateSelected] = useState('1d');
|
const [dateSelected, setDateSelected] = useState("1d");
|
||||||
const [lineData, setLineData] = useState([
|
const [lineData, setLineData] = useState([
|
||||||
{value: 4},
|
{ value: 4 },
|
||||||
{value: 14},
|
{ value: 14 },
|
||||||
{value: 8},
|
{ value: 8 },
|
||||||
{value: 38},
|
{ value: 38 },
|
||||||
{value: 36},
|
{ value: 36 },
|
||||||
{value: 28},
|
{ value: 28 },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const months = ['1d','1w','1m','1y','All']
|
const months = ["1d", "1w", "1m", "1y", "All"];
|
||||||
const changeMonthSelected = (ind: number) => {
|
const changeMonthSelected = (ind: number) => {
|
||||||
const selectedMonth = months[ind];
|
const selectedMonth = months[ind];
|
||||||
setDateSelected(selectedMonth);
|
setDateSelected(selectedMonth);
|
||||||
|
|
||||||
// Update lineData based on the selected month
|
// Update lineData based on the selected month
|
||||||
let newData: React.SetStateAction<{ value: number; }[]>;
|
let newData: React.SetStateAction<{ value: number }[]>;
|
||||||
switch (selectedMonth) {
|
switch (selectedMonth) {
|
||||||
case '1d':
|
case "1d":
|
||||||
newData = [
|
newData = [
|
||||||
{value: 4},
|
{ value: 4 },
|
||||||
{value: 14},
|
{ value: 14 },
|
||||||
{value: 8},
|
{ value: 8 },
|
||||||
{value: 38},
|
{ value: 38 },
|
||||||
{value: 36},
|
{ value: 36 },
|
||||||
{value: 28},
|
{ value: 28 },
|
||||||
];
|
];
|
||||||
break;
|
break;
|
||||||
case '1w':
|
case "1w":
|
||||||
newData = [
|
newData = [
|
||||||
{value: 8},
|
{ value: 8 },
|
||||||
{value: 14},
|
{ value: 14 },
|
||||||
{value: 8},
|
{ value: 8 },
|
||||||
{value: 38},
|
{ value: 38 },
|
||||||
{value: 14},
|
{ value: 14 },
|
||||||
{value: 28},
|
{ value: 28 },
|
||||||
{value: 4},
|
{ value: 4 },
|
||||||
];
|
];
|
||||||
break;
|
break;
|
||||||
case '1m':
|
case "1m":
|
||||||
newData = [
|
newData = [
|
||||||
{value: 10},
|
{ value: 10 },
|
||||||
{value: 20},
|
{ value: 20 },
|
||||||
{value: 30},
|
{ value: 30 },
|
||||||
{value: 40},
|
{ value: 40 },
|
||||||
{value: 50},
|
{ value: 50 },
|
||||||
{value: 60},
|
{ value: 60 },
|
||||||
];
|
];
|
||||||
break;
|
break;
|
||||||
case '1y':
|
case "1y":
|
||||||
newData = [
|
newData = [
|
||||||
{value: 15},
|
{ value: 15 },
|
||||||
{value: 25},
|
{ value: 25 },
|
||||||
{value: 35},
|
{ value: 35 },
|
||||||
{value: 45},
|
{ value: 45 },
|
||||||
{value: 55},
|
{ value: 55 },
|
||||||
{value: 65},
|
{ value: 65 },
|
||||||
];
|
];
|
||||||
break;
|
break;
|
||||||
case 'All':
|
case "All":
|
||||||
newData = [
|
newData = [
|
||||||
{value: 5},
|
{ value: 5 },
|
||||||
{value: 15},
|
{ value: 15 },
|
||||||
{value: 25},
|
{ value: 25 },
|
||||||
{value: 35},
|
{ value: 35 },
|
||||||
{value: 45},
|
{ value: 45 },
|
||||||
{value: 55},
|
{ value: 55 },
|
||||||
];
|
];
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
newData = [];
|
newData = [];
|
||||||
}
|
}
|
||||||
setLineData(newData);
|
setLineData(newData);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View className="bg-gray-200 rounded-2xl p-1 h-full">
|
<View className="bg-gray-200 rounded-2xl p-1 h-full">
|
||||||
<View className=" m-2 flex-row justify-center rounded-2xl bg-white">
|
<View className=" m-2 flex-row justify-center rounded-2xl bg-white">
|
||||||
{months.map((item, index) => {
|
{months.map((item, index) => {
|
||||||
return (
|
return (
|
||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
key={index}
|
key={index}
|
||||||
className={`w-16 h-10 flex items-center justify-center rounded-xl ${
|
className={`w-16 h-10 flex items-center justify-center rounded-xl ${
|
||||||
dateSelected === item
|
dateSelected === item
|
||||||
? "bg-orange-500 border-2 border-orange-300"
|
? "bg-orange-500 border-2 border-orange-300"
|
||||||
: "bg-transparent "
|
: "bg-transparent "
|
||||||
}`}
|
}`}
|
||||||
onPress={() => changeMonthSelected(index)}>
|
onPress={() => changeMonthSelected(index)}
|
||||||
<Text className="font-extrabold">{months[index]}</Text>
|
>
|
||||||
</TouchableOpacity>
|
<Text className="font-extrabold">{months[index]}</Text>
|
||||||
);
|
</TouchableOpacity>
|
||||||
})}
|
);
|
||||||
</View>
|
})}
|
||||||
<LineChart
|
</View>
|
||||||
scrollRef={ref}
|
<LineChart
|
||||||
data={lineData}
|
scrollRef={ref}
|
||||||
areaChart
|
data={lineData}
|
||||||
curved
|
areaChart
|
||||||
initialSpacing={0}
|
curved
|
||||||
rotateLabel
|
initialSpacing={0}
|
||||||
isAnimated={true}
|
rotateLabel
|
||||||
startFillColor="orange"
|
isAnimated={true}
|
||||||
curveType={CurveType.QUADRATIC}
|
startFillColor="orange"
|
||||||
/>
|
curveType={CurveType.QUADRATIC}
|
||||||
</View>
|
/>
|
||||||
);
|
</View>
|
||||||
}
|
);
|
||||||
|
}
|
||||||
|
@ -1,51 +1,51 @@
|
|||||||
import {FlatList, TouchableOpacity,Text, View} from "react-native";
|
|
||||||
import {useState} from "react";
|
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
|
import { useState } from "react";
|
||||||
|
import { FlatList, Text, TouchableOpacity, View } from "react-native";
|
||||||
|
|
||||||
export default function CalendarComponent() {
|
export default function CalendarComponent() {
|
||||||
const [selectedDay] = useState(dayjs().date());
|
const [selectedDay] = useState(dayjs().date());
|
||||||
|
|
||||||
const days = Array.from({ length: 7 }, (_, index) => {
|
const days = Array.from({ length: 7 }, (_, index) => {
|
||||||
const day = dayjs().add(index, "day");
|
const day = dayjs().add(index, "day");
|
||||||
return {
|
return {
|
||||||
id: day.date(),
|
id: day.date(),
|
||||||
label: day.format("ddd"),
|
label: day.format("ddd"),
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View className="bg-transparent">
|
<View className="bg-transparent">
|
||||||
<FlatList
|
<FlatList
|
||||||
horizontal
|
horizontal
|
||||||
data={days}
|
data={days}
|
||||||
keyExtractor={(item) => item.id.toString()}
|
keyExtractor={(item) => item.id.toString()}
|
||||||
showsHorizontalScrollIndicator={false}
|
showsHorizontalScrollIndicator={false}
|
||||||
contentContainerStyle={{ gap: 12 }} // Espacement entre les items
|
contentContainerStyle={{ gap: 12 }} // Espacement entre les items
|
||||||
renderItem={({ item }) => (
|
renderItem={({ item }) => (
|
||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
className={`w-16 h-20 flex items-center justify-center rounded-xl ${
|
className={`w-16 h-20 flex items-center justify-center rounded-xl ${
|
||||||
selectedDay === item.id
|
selectedDay === item.id
|
||||||
? "bg-orange-500 border-2 border-orange-300"
|
? "bg-orange-500 border-2 border-orange-300"
|
||||||
: "bg-black"
|
: "bg-black"
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
<Text
|
<Text
|
||||||
className={`text-sm ${
|
className={`text-sm ${
|
||||||
selectedDay === item.id ? "text-white" : "text-gray-400"
|
selectedDay === item.id ? "text-white" : "text-gray-400"
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
{item.label}
|
{item.label}
|
||||||
</Text>
|
</Text>
|
||||||
<Text
|
<Text
|
||||||
className={`text-lg font-bold ${
|
className={`text-lg font-bold ${
|
||||||
selectedDay === item.id ? "text-white" : "text-gray-200"
|
selectedDay === item.id ? "text-white" : "text-gray-200"
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
{item.id}
|
{item.id}
|
||||||
</Text>
|
</Text>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,16 @@
|
|||||||
import React from "react";
|
|
||||||
import {FEATURE_LOCKED} from "@/components/Errors";
|
|
||||||
import Error from "@/app/(utility)/Error";
|
import Error from "@/app/(utility)/Error";
|
||||||
|
//@ts-ignore
|
||||||
import blockedPict from "@/assets/images/Blocked.png";
|
import blockedPict from "@/assets/images/Blocked.png";
|
||||||
|
import { FEATURE_LOCKED } from "@/components/Errors";
|
||||||
|
import React from "react";
|
||||||
|
|
||||||
export default function Blocked() {
|
export default function Blocked() {
|
||||||
return (
|
return (
|
||||||
<Error
|
<Error
|
||||||
picture={blockedPict}
|
picture={blockedPict}
|
||||||
problem="Fonctionnalité bloquée"
|
problem="Fonctionnalité bloquée"
|
||||||
description={FEATURE_LOCKED}
|
description={FEATURE_LOCKED}
|
||||||
information="Devenez PREMIUM pour débloquer"
|
information="Devenez PREMIUM pour débloquer"
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,16 @@
|
|||||||
import React from "react";
|
|
||||||
import {INTERNAL_ERROR} from "@/components/Errors";
|
|
||||||
import Error from "@/app/(utility)/Error";
|
import Error from "@/app/(utility)/Error";
|
||||||
|
//@ts-ignore
|
||||||
import internalErrorPict from "@/assets/images/InternalError.png";
|
import internalErrorPict from "@/assets/images/InternalError.png";
|
||||||
|
import { INTERNAL_ERROR } from "@/components/Errors";
|
||||||
|
import React from "react";
|
||||||
|
|
||||||
export default function InternalError() {
|
export default function InternalError() {
|
||||||
return (
|
return (
|
||||||
<Error
|
<Error
|
||||||
picture={internalErrorPict}
|
picture={internalErrorPict}
|
||||||
problem="Problème interne"
|
problem="Problème interne"
|
||||||
description={INTERNAL_ERROR}
|
description={INTERNAL_ERROR}
|
||||||
information="Contactez le support"
|
information="Contactez le support"
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,16 @@
|
|||||||
import React from "react";
|
|
||||||
import {MAINTENANCE} from "@/components/Errors";
|
|
||||||
import Error from "@/app/(utility)/Error";
|
import Error from "@/app/(utility)/Error";
|
||||||
|
//@ts-ignore
|
||||||
import maintenancePict from "@/assets/images/Maintenance.png";
|
import maintenancePict from "@/assets/images/Maintenance.png";
|
||||||
|
import { MAINTENANCE } from "@/components/Errors";
|
||||||
|
import React from "react";
|
||||||
|
|
||||||
export default function Maintenance() {
|
export default function Maintenance() {
|
||||||
return (
|
return (
|
||||||
<Error
|
<Error
|
||||||
picture={maintenancePict}
|
picture={maintenancePict}
|
||||||
problem="Maintenance"
|
problem="Maintenance"
|
||||||
description={MAINTENANCE}
|
description={MAINTENANCE}
|
||||||
information="Revenez plus tard"
|
information="Revenez plus tard"
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,16 @@
|
|||||||
import React from "react";
|
|
||||||
import {NO_INTERNET} from "@/components/Errors";
|
|
||||||
import Error from "@/app/(utility)/Error";
|
import Error from "@/app/(utility)/Error";
|
||||||
|
//@ts-ignore
|
||||||
import noInternetPict from "@/assets/images/NoInternet.png";
|
import noInternetPict from "@/assets/images/NoInternet.png";
|
||||||
|
import { NO_INTERNET } from "@/components/Errors";
|
||||||
|
import React from "react";
|
||||||
|
|
||||||
export default function NoInternet() {
|
export default function NoInternet() {
|
||||||
return (
|
return (
|
||||||
<Error
|
<Error
|
||||||
picture={noInternetPict}
|
picture={noInternetPict}
|
||||||
problem="Pas d'internet"
|
problem="Pas d'internet"
|
||||||
description={NO_INTERNET}
|
description={NO_INTERNET}
|
||||||
information="Réessayez plus tard"
|
information="Réessayez plus tard"
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,16 @@
|
|||||||
import React from "react";
|
|
||||||
import {NOT_AUTHORIZED} from "@/components/Errors";
|
|
||||||
import Error from "@/app/(utility)/Error";
|
import Error from "@/app/(utility)/Error";
|
||||||
|
//@ts-ignore
|
||||||
import notAllowedPict from "@/assets/images/NotAllowed.png";
|
import notAllowedPict from "@/assets/images/NotAllowed.png";
|
||||||
|
import { NOT_AUTHORIZED } from "@/components/Errors";
|
||||||
|
import React from "react";
|
||||||
|
|
||||||
export default function NotAllowedProblem() {
|
export default function NotAllowedProblem() {
|
||||||
return (
|
return (
|
||||||
<Error
|
<Error
|
||||||
picture={notAllowedPict}
|
picture={notAllowedPict}
|
||||||
problem="Pas autorisé"
|
problem="Pas autorisé"
|
||||||
description={NOT_AUTHORIZED}
|
description={NOT_AUTHORIZED}
|
||||||
information="Connectez vous avec plus de privilèges"
|
information="Connectez vous avec plus de privilèges"
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,16 @@
|
|||||||
import React from "react";
|
|
||||||
import {NOT_FOUND} from "@/components/Errors";
|
|
||||||
import Error from "@/app/(utility)/Error";
|
import Error from "@/app/(utility)/Error";
|
||||||
|
//@ts-ignore
|
||||||
import notFoundPict from "@/assets/images/NotFound.png";
|
import notFoundPict from "@/assets/images/NotFound.png";
|
||||||
|
import { NOT_FOUND } from "@/components/Errors";
|
||||||
|
import React from "react";
|
||||||
|
|
||||||
export default function NotFound() {
|
export default function NotFound() {
|
||||||
return (
|
return (
|
||||||
<Error
|
<Error
|
||||||
picture={notFoundPict}
|
picture={notFoundPict}
|
||||||
problem="Introuvable"
|
problem="Introuvable"
|
||||||
description={NOT_FOUND}
|
description={NOT_FOUND}
|
||||||
information="Status Code : 404"
|
information="Status Code : 404"
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,118 @@
|
|||||||
export interface Workout {
|
export class Workout {
|
||||||
id: string;
|
private _id?: string;
|
||||||
name: string;
|
private _name?: string;
|
||||||
description: string;
|
private _description?: string;
|
||||||
duration: number;
|
private _duration?: number;
|
||||||
image: string;
|
private _image?: string;
|
||||||
video: string;
|
private _video?: string;
|
||||||
nbSeries: number;
|
private _nbSeries?: number;
|
||||||
nbRepetitions: number;
|
private _nbRepetitions?: number;
|
||||||
|
|
||||||
|
constructor({
|
||||||
|
id,
|
||||||
|
name,
|
||||||
|
description,
|
||||||
|
duration,
|
||||||
|
image,
|
||||||
|
video,
|
||||||
|
nbSeries,
|
||||||
|
nbRepetitions,
|
||||||
|
}: {
|
||||||
|
id?: string;
|
||||||
|
name?: string;
|
||||||
|
description?: string;
|
||||||
|
duration?: number;
|
||||||
|
image?: string;
|
||||||
|
video?: string;
|
||||||
|
nbSeries?: number;
|
||||||
|
nbRepetitions?: number;
|
||||||
|
} = {}) {
|
||||||
|
this._id = id;
|
||||||
|
this._name = name;
|
||||||
|
this._description = description;
|
||||||
|
this._duration = duration;
|
||||||
|
this._image = image;
|
||||||
|
this._video = video;
|
||||||
|
this._nbSeries = nbSeries;
|
||||||
|
this._nbRepetitions = nbRepetitions;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Getters
|
||||||
|
get id(): string | undefined {
|
||||||
|
return this._id;
|
||||||
|
}
|
||||||
|
|
||||||
|
get name(): string | undefined {
|
||||||
|
return this._name;
|
||||||
|
}
|
||||||
|
|
||||||
|
get description(): string | undefined {
|
||||||
|
return this._description;
|
||||||
|
}
|
||||||
|
|
||||||
|
get duration(): number | undefined {
|
||||||
|
return this._duration;
|
||||||
|
}
|
||||||
|
|
||||||
|
get image(): string | undefined {
|
||||||
|
return this._image;
|
||||||
|
}
|
||||||
|
|
||||||
|
get video(): string | undefined {
|
||||||
|
return this._video;
|
||||||
|
}
|
||||||
|
|
||||||
|
get nbSeries(): number | undefined {
|
||||||
|
return this._nbSeries;
|
||||||
|
}
|
||||||
|
|
||||||
|
get nbRepetitions(): number | undefined {
|
||||||
|
return this._nbRepetitions;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Setters
|
||||||
|
set id(value: string | undefined) {
|
||||||
|
this._id = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
set name(value: string | undefined) {
|
||||||
|
this._name = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
set description(value: string | undefined) {
|
||||||
|
this._description = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
set duration(value: number | undefined) {
|
||||||
|
this._duration = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
set image(value: string | undefined) {
|
||||||
|
this._image = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
set video(value: string | undefined) {
|
||||||
|
this._video = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
set nbSeries(value: number | undefined) {
|
||||||
|
this._nbSeries = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
set nbRepetitions(value: number | undefined) {
|
||||||
|
this._nbRepetitions = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
static fromJson(json: any): Workout {
|
||||||
|
return new Workout({
|
||||||
|
id: json.id,
|
||||||
|
name: json.name,
|
||||||
|
description: json.description,
|
||||||
|
duration: json.duration,
|
||||||
|
image: json.image,
|
||||||
|
video: json.video,
|
||||||
|
nbSeries: json.nbSeries,
|
||||||
|
nbRepetitions: json.nbRepetitions,
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in new issue