Pierre Ferreira 2 years ago
commit 0a37b6c59a

@ -8,7 +8,7 @@ import StackNavigation from './navigation/StackNavigation';
import { createStackNavigator } from '@react-navigation/stack'; import { createStackNavigator } from '@react-navigation/stack';
// Import your application store // Import your application store
import store from "./redux/store"; //import store from "./redux/store";
import { import {

@ -0,0 +1,14 @@
// export class ApiDataManager{
// public async getCards() : Promise<String[]> {
// const CardPromise = await fetch('https://omgvamp-hearthstone-v1.p.rapidapi.com/cards')
// const CardListJson = await CardPromise.json();
// const CardList: String[] = Array.of(CardListJson);
// return CardList;
// }
// }

@ -1,188 +1,14 @@
export class City { import { Card } from "../models/Card"
private _name: string;
private _latitude: number;
private _longitude: number;
constructor(name: string, latitude: number, longitude: number) { export class StubLib {
this._name = name;
this._latitude = latitude;
this._longitude = longitude;
}
get name(): string {
return this._name;
}
set name(value: string) {
this._name = value;
}
get latitude(): number {
return this._latitude;
}
set latitude(value: number) {
this._latitude = value;
}
get longitude(): number {
return this._longitude;
}
set longitude(value: number) {
this._longitude = value;
}
}
export class Weather {
private _at: string;
private _visibility: number;
private _weatherType: string;
private _weatherDescription: string;
private _temperature: number;
private _temperatureFeelsLike: number;
private _humidity: number;
private _windSpeed: number;
private _pressure: number;
private _city: City;
constructor(at: string, visibility: number, weatherType: string, weatherDescription: string, temperature: number, temperatureFeelsLike: number, humidity: number, windSpeed: number, pressure: number, city: City) {
this._at = at;
this._visibility = visibility;
this._weatherType = weatherType;
this._weatherDescription = weatherDescription;
this._temperature = temperature;
this._temperatureFeelsLike = temperatureFeelsLike;
this._humidity = humidity;
this._windSpeed = windSpeed;
this._pressure = pressure;
this._city = city;
}
get at(): string {
return this._at;
}
set at(value: string) {
this._at = value;
}
get visibility(): number {
return this._visibility;
}
set visibility(value: number) {
this._visibility = value;
}
get weatherType(): string {
return this._weatherType;
}
set weatherType(value: string) {
this._weatherType = value;
}
get weatherDescription(): string {
return this._weatherDescription;
}
set weatherDescription(value: string) {
this._weatherDescription = value;
}
get temperature(): number {
return this._temperature;
}
set temperature(value: number) {
this._temperature = value;
}
get temperatureFeelsLike(): number {
return this._temperatureFeelsLike;
}
set temperatureFeelsLike(value: number) {
this._temperatureFeelsLike = value;
}
get humidity(): number {
return this._humidity;
}
set humidity(value: number) {
this._humidity = value;
}
get windSpeed(): number { public getCards(): Card[] {
return this._windSpeed; const NOUNOURS_LIST : Card[] = [
} new Card("c1","Chewie"),
new Card("r2","Rupert"),
set windSpeed(value: number) { new Card("a3","Ronflex"),
this._windSpeed = value; ]
} return NOUNOURS_LIST
get pressure(): number {
return this._pressure;
}
set pressure(value: number) {
this._pressure = value;
}
get city(): City {
return this._city;
}
set city(value: City) {
this._city = value;
} }
} }
export const CITIES_DATA: City[] = [
new City("Paris", 48.866667, 2.333333),
new City("Clermont-Ferrand", 45.777222, 3.087025),
new City("Lyon", 45.764043, 4.835659),
new City("Marseille", 43.296482, 5.36978),
new City("Bruxelles", 50.85034, 4.35171),
];
export const FAVORITE_CITY_DATA =
new City("Clermont-Ferrand", 45.777222, 3.087025);
export const DEFAULT_SELECTED_CITY_DATA: City =
new City("Paris", 48.866667, 2.333333);
export const WEATHER_DATA: Weather[] = [
new Weather("2023-01-22 09:55:59", 10000, "Nuageux",
"couvert", 0.52, -4.34,
82, 5.14, 1032,
new City("Paris", 48.866667, 2.333333)
),
new Weather("2023-01-22 09:55:59", 10000, "Nuageux",
"couvert", 0.52, -4.34,
82, 5.14, 1032,
new City("Clermont-Ferrand", 45.777222, 3.087025)
),
new Weather("2023-01-22 09:55:59", 10000, "Nuageux",
"couvert", 0.52, -4.34,
82, 5.14, 1032,
new City("Lyon", 45.764043, 4.835659)
),
new Weather("2023-01-22 09:55:59", 10000, "Nuageux",
"couvert", 0.52, -4.34,
82, 5.14, 1032,
new City("Marseille", 43.296482, 5.36978)
),
new Weather("2023-01-22 09:55:59", 10000, "Nuageux",
"couvert", 0.52, -4.34,
82, 5.14, 1032,
new City("Bruxelles", 50.85034, 4.35171)
),
];
export const getCurrentWeather = (cityName: string) => {
if (cityName === undefined) return {};
return WEATHER_DATA.filter(elt => elt.city.name === cityName)[0];
}

@ -0,0 +1,165 @@
import {isValidNumber} from "react-native-gesture-handler/lib/typescript/web_hammer/utils";
export class Card {
constructor(id: string,name :string,set : string,type : string,faction : string,rarity : string,cost : number,attack : number, health : number, desc : string,flavor : string,artist : string,collectible : boolean,elite : boolean,race : string, img : string, imgGold : string) {
this._id=id
this._name=name
this._set=set
this._type=type
this._faction=faction
this._rarity=rarity
this._cost=cost
this._attack = attack
this._health = health
this._desc = desc
this._flavor = flavor
this._artist = artist
this._collectible = collectible
this._elite = elite
this._race = race
this._img = img
this._imgGold = imgGold
}
// ID //
private _id : string;
get id(): string {
return this._id
}
// NAME //
private _name : string;
get name(): string {
return this._name;
}
set name(value: string) {
this._name = value;
}
private _set : string;
get set(): string{
return this._set
}
set set(value : string){
this._set = value
}
private _type : string;
get type():string{
return this._type
}
set type(value : string){
this._type=value
}
private _faction : string;
get faction():string{
return this._faction
}
set faction(value : string){
this._faction=value
}
private _rarity : string
get rarity(): string {
return this._rarity;
}
set rarity(value: string) {
this._rarity = value ;
}
private _cost : number
get cost(): number {
return this._cost;
}
set cost(value: number) {
this._cost = value ;
}
private _attack : number
get attack(): number {
return this._attack;
}
set attack(value: number) {
this._attack = value ;
}
private _health : number
get health(): number {
return this._health;
}
set health(value: number) {
this._health = value ;
}
private _desc : string
get desc(): string {
return this._desc;
}
set desc(value: string) {
this._desc = value ;
}
private _flavor : string
get flavor(): string {
return this._flavor;
}
set flavor(value: string) {
this._flavor = value ;
}
private _artist : string
get artist(): string {
return this._artist;
}
set artist(value: string) {
this._artist = value ;
}
private _collectible : boolean
get collectible(): boolean {
return this._collectible;
}
set collectible(value: boolean ){
this._collectible = value;
}
private _elite : boolean
get elite(): boolean {
return this._elite;
}
set elite(value: boolean) {
this._elite = value ;
}
private _race : string
get race(): string {
return this._race;
}
set race(value: string) {
this._race = value ;
}
private _img : string
get img(): string {
return this._img;
}
set img(value: string) {
this._img = value ;
}
private _imgGold : string
get imgGold(): string {
return this._imgGold;
}
set imgGold(value: string) {
this._imgGold = value ;
}
}

@ -11,34 +11,8 @@ import { ThunkAction } from 'redux-thunk';
//? possiblement à supprimer //? possiblement à supprimer
import { Card, getAllCards } from "../redux/actions/getAllCards" import { Card, getAllCards } from "../redux/actions/getAllCards"
import { StubLib } from '../data/stub';
import { Card } from '../models/Card';
export const DATA = [
{
id: '1',
title: "premier élément",
},
{
id: '2',
title: "second élément",
},
{
id: '3',
title: "élément",
},
{
id: '4',
title: "Rick",
},
{
id: '5',
title: "Corentin",
},
{
id: '10',
title: "dernier élément",
},
];
//@ts-ignore //@ts-ignore
const Item = ({title}) => ( const Item = ({title}) => (
@ -71,16 +45,16 @@ export default function ListScreen({navigation}){
// loadCards(); // loadCards();
// }, [dispatch]); // }, [dispatch]);
const {getCards} = new StubLib();
const list: Card[] = getCards();
const req = fetch('https://omgvamp-hearthstone-v1.p.rapidapi.com/cards')
return ( return (
<View style={styles.container}> <View style={styles.container}>
<View style={styles.border}> <Text>{}</Text>
<Text>Maman, prend la caméra ! !</Text> <FlatList data={list}
<StatusBar style="auto" /> renderItem={({item}) => <Item title={item.name} />}
<Text>{count}</Text>
<Button onPress={()=> setCount(count+1)} title="+1"/>
</View>
<FlatList data={DATA}
renderItem={({item}) => <Item title={item.title} />}
keyExtractor={item => item.id}/> keyExtractor={item => item.id}/>
{/* <FlatList data={nList} renderItem={({item}) => {/* <FlatList data={nList} renderItem={({item}) =>
@ -91,6 +65,8 @@ export default function ListScreen({navigation}){
</TouchableHighlight> </TouchableHighlight>
} keyExtractor={(item: Card) => item.name}/> */} } keyExtractor={(item: Card) => item.name}/> */}
</View> </View>
); );
} }

@ -1887,7 +1887,7 @@
"@react-navigation/stack@^6.3.14": "@react-navigation/stack@^6.3.14":
version "6.3.14" version "6.3.14"
resolved "https://registry.npmjs.org/@react-navigation/stack/-/stack-6.3.14.tgz" resolved "https://registry.yarnpkg.com/@react-navigation/stack/-/stack-6.3.14.tgz#de282d8bc5616bfb12fa4c89f18792193563fb7a"
integrity sha512-a1ivkESWsZYimUQHr3TA2Nu2g3FALEyJqQ8bJxXkEcBp+5cglOakhfKbbCuNV2knC/9zjUmP9N0Q3Jh3fK9nfw== integrity sha512-a1ivkESWsZYimUQHr3TA2Nu2g3FALEyJqQ8bJxXkEcBp+5cglOakhfKbbCuNV2knC/9zjUmP9N0Q3Jh3fK9nfw==
dependencies: dependencies:
"@react-navigation/elements" "^1.3.15" "@react-navigation/elements" "^1.3.15"

Loading…
Cancel
Save