Fix de bugs venant du merge

CardDetail
Corentin RICHARD 2 years ago
parent 33ce875c5a
commit ec10ce594a

@ -1,45 +1,37 @@
export class Card { export class Card {
constructor(id: number,name :string,health : number, attack : number, manaCost : number, rarityId : number, flavorText : string, classId : number, multiClassIds : any, img : string, imgGold : string, cropImage : string, artistName : string, fav : Boolean){//,set : CardSet,type : Type,clas : Classe,rarity : string,, desc : string,flavor : string,artist : string,collectible : boolean,elite : boolean,race : string, cropImg :string) { constructor(id: string,name :string,health : string, attack : string, manaCost : string, rarityId : string, flavorText : string, classId : string, multiClassIds : any, img : string, imgGold : string, cropImage : string, artistName : string, fav : boolean){
this._id=id this.id=id
this._name=name this.name=name
//this._set=set //this._set=set
// this._type=type // this._type=type
// this._class=clas // this._class=clas
// this._rarity=rarity // this._rarity=rarity
this._manaCost=manaCost this.manaCost=manaCost
this._attack = attack this.attack = attack
this._health = health this.health = health
this._rarityId = rarityId this.rarityId = rarityId
// this._desc = desc // this._desc = desc
this._flavorText = flavorText this.flavorText = flavorText
this._classId = classId this.classId = classId
this._multiClassIds = multiClassIds this.multiClassIds = multiClassIds
this._artistName = artistName this.artistName = artistName
// this._collectible = collectible // this._collectible = collectible
this._img = img this.img = img
this._imgGold = imgGold this.imgGold = imgGold
this._cropImage = cropImage this.cropImage = cropImage
this._fav = fav this.fav = fav
} }
// ID // // ID //
private _id : number; public id: string;
get id(): number {
return this._id
}
// NAME // // NAME //
private _name : string; public name: string
get name(): string {
return this._name;
}
set name(value: string) {
this._name = value;
}
// set set(value : CardSet){ // set set(value : CardSet){
// this._set = value // this._set = value
@ -71,30 +63,13 @@ export class Card {
// this._rarity = value ; // this._rarity = value ;
// } // }
private _manaCost: number; public manaCost : string;
get manaCost(): number {
return this._manaCost;
}
set manaCost(value: number) {
this._manaCost = value;
}
private _attack : number;
get attack(): number { public attack : string;
return this._attack; public health : string;
}
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 // private _desc : string
// get desc(): string { // get desc(): string {
@ -103,48 +78,17 @@ export class Card {
// set desc(value: string) { // set desc(value: string) {
// this._desc = value ; // this._desc = value ;
// } // }
private _classId : number; public classId : string;
get classId(): number {
return this._classId;
}
set classId(value: number) {
this._classId = value ;
}
private _flavorText : string; public flavorText : string
get flavorText(): string {
return this._flavorText;
}
set flavor(value: string) {
this._flavorText = value ;
}
private _rarityId : number; public rarityId : string
get rarityId(): number {
return this._rarityId;
}
set rarityId(value: number) {
this._rarityId = value ;
}
private _multiClassIds : string; public multiClassIds : any;
get multiClassIds(): string {
return this._multiClassIds;
}
set multiClassIds(value: string) {
this._multiClassIds = value ;
}
private _artistName : string; public artistName : string;
get artistName(): string {
return this._artistName;
}
set artistName(value: string) {
this._artistName = value ;
}
// private _collectible : boolean // private _collectible : boolean
// get collectible(): boolean { // get collectible(): boolean {
// return this._collectible; // return this._collectible;
@ -153,33 +97,11 @@ export class Card {
// this._collectible = value; // this._collectible = value;
// } // }
private _img : string public img : string;
public imgGold : 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 ;
}
private _cropImage : string; public cropImage : string;
get cropImage(): string {
return this._cropImage;
}
set cropImage(value: string) {
this._cropImage = value;
}
//FAV// //FAV//
public _fav; public fav : boolean;
get fav(): Boolean {
return this._fav
}
} }

18661
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -32,6 +32,7 @@
}, },
"dependencies": { "dependencies": {
"@jest/globals": "^29.5.0", "@jest/globals": "^29.5.0",
"@react-native-async-storage/async-storage": "1.17.11",
"@react-navigation/bottom-tabs": "^6.5.5", "@react-navigation/bottom-tabs": "^6.5.5",
"@react-navigation/native": "^6.1.4", "@react-navigation/native": "^6.1.4",
"@react-navigation/native-stack": "^6.9.10", "@react-navigation/native-stack": "^6.9.10",
@ -51,8 +52,7 @@
"react-native-table-component": "^1.2.2", "react-native-table-component": "^1.2.2",
"react-native-web": "~0.18.11", "react-native-web": "~0.18.11",
"react-redux": "^8.0.5", "react-redux": "^8.0.5",
"redux": "^4.2.1", "redux": "^4.2.1"
"@react-native-async-storage/async-storage": "1.17.11"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.20.0", "@babel/core": "^7.20.0",

@ -20,7 +20,8 @@ export default appReducer = (state = initialState, action) => {
StorageHeart.setItem("favoriteList",tab) StorageHeart.setItem("favoriteList",tab)
return {...state, favoriteCards : tab}; return {...state, favoriteCards : tab};
} }
if( Array.from(state.favoriteCards).every((elem) => elem != a.route.card)){ //@ts-ignore
if( Array.from(state.favoriteCards).every((elem) => elem.id != a.route.card.id)){
//@ts-ignore //@ts-ignore
const tab = state.favoriteCards.concat([a.route.card]) const tab = state.favoriteCards.concat([a.route.card])

@ -17,8 +17,11 @@ export default function HomeScreen({navigation}) {
const loadFavCards = async () => { const loadFavCards = async () => {
//@ts-ignore //@ts-ignore
const list = await StorageHeart.getItem("favoriteList") const list = await StorageHeart.getItem("favoriteList")
if(list!=null){
//@ts-ignore //@ts-ignore
dispatch(setList(list)) dispatch(setList(list))
}
}; };
loadFavCards(); loadFavCards();
@ -32,7 +35,6 @@ export default function HomeScreen({navigation}) {
loadCards(); loadCards();
}, [dispatch]); }, [dispatch]);
const tabNav = Navigation()
// affichage de la homePage // affichage de la homePage

@ -28,14 +28,14 @@ export default function ListScreen({navigation}){
style={styles.textInput} style={styles.textInput}
value={searchValue} value={searchValue}
onChangeText={text => setSearchValue(text)} onChangeText={text => setSearchValue(text)}
placeholder="Rechercher une carte..." placeholder="Rechercher une carte...."
/> />
<FlatList <FlatList
numColumns={2} numColumns={2}
data={filteredList} data={filteredList}
renderItem={({item}) => renderItem={({item}) =>
<TouchableHighlight onPress={() => navigation.navigate("ListFav")}> <TouchableHighlight onPress={() => navigation.navigate("DetailCard", {card :item, other : 'anything'})}>
<Item route={{ <Item route={{
card: item, card: item,
bool: true bool: true

@ -11,6 +11,7 @@ import { setFavList } from "../redux/actions/action_setFavList";
//* Components //* Components
import { ListItemComponent } from '../components/ListItemComponent'; import { ListItemComponent } from '../components/ListItemComponent';
import Item from '../components/ListeFavComponent';
//@ts-ignore //@ts-ignore
export default function ListScreen({navigation}){ export default function ListScreen({navigation}){
@ -43,13 +44,13 @@ export default function ListScreen({navigation}){
data={filteredList} data={filteredList}
renderItem={({item}) => renderItem={({item}) =>
<View> <View>
<TouchableHighlight testID="button" style={item.fav?styles.favoriteButtonFav:styles.favoriteButtonNonFav}
onPress={() => HandleAddFav({route: { card: item, bool: false }} as CardProps)} >
<FontAwesome name="heart-o" size={50} color="#fff" />
</TouchableHighlight>
<TouchableHighlight style={styles.imageItem} onPress={() => navigation.navigate("DetailCard", {card :item, other : 'anything'})}> <TouchableHighlight style={styles.imageItem} onPress={() => navigation.navigate("DetailCard", {card :item, other : 'anything'})}>
<ListItemComponent url={item.img}/> <Item route={{
card: item,
bool: false
}} ></Item>
</TouchableHighlight> </TouchableHighlight>
</View> </View>
} }

Loading…
Cancel
Save