Fix de bugs venant du merge

CardDetail
Corentin RICHARD 2 years ago
parent 33ce875c5a
commit ec10ce594a

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

18661
package-lock.json generated

File diff suppressed because it is too large Load Diff

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

@ -20,7 +20,8 @@ export default appReducer = (state = initialState, action) => {
StorageHeart.setItem("favoriteList",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
const tab = state.favoriteCards.concat([a.route.card])

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

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

@ -11,6 +11,7 @@ import { setFavList } from "../redux/actions/action_setFavList";
//* Components
import { ListItemComponent } from '../components/ListItemComponent';
import Item from '../components/ListeFavComponent';
//@ts-ignore
export default function ListScreen({navigation}){
@ -43,13 +44,13 @@ export default function ListScreen({navigation}){
data={filteredList}
renderItem={({item}) =>
<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'})}>
<ListItemComponent url={item.img}/>
<Item route={{
card: item,
bool: false
}} ></Item>
</TouchableHighlight>
</View>
}

Loading…
Cancel
Save