1
1
<template >
2
2
<v-tooltip top >
3
3
<template v-slot :activator =" { on } " >
4
- <v-card color =" darken-1" flat hover :class =" { incompatible: !compatible }" class =" draggable-card mod-card white--text" style =" margin-top : 10px ; padding : 0 10px ;"
4
+ <v-card color =" darken-1" flat hover :class =" { incompatible: !compatible }"
5
+ class =" draggable-card mod-card white--text" style =" margin-top : 10px ; padding : 0 10px ;"
5
6
draggable v-on =" on" @dragstart =" onDragStart" @dblclick =" tryOpen" >
6
7
<v-layout justify-center align-center fill-height >
7
8
<v-flex v-if =" icon" xs4 style =" padding : 0 10px 0 0 ;" fill-height >
@@ -58,22 +59,37 @@ export default {
58
59
return this .$repo .getters .selectedProfile .mcversion ;
59
60
},
60
61
acceptedRange () {
61
- return this .data .acceptedMinecraftVersions ? this .data .acceptedMinecraftVersions : ` [${ this .data .mcversion } ]` ;
62
+ if (this .data .acceptedMinecraftVersions ) {
63
+ return this .data .acceptedMinecraftVersions ;
64
+ }
65
+ if (/ ^ \[ . + \] $ / .test (this .data .mcversion )) {
66
+ return this .data .mcversion ;
67
+ }
68
+ return ` [${ this .data .mcversion } ]` ;
62
69
},
63
70
compatible () {
64
- return isCompatible (this .acceptedRange , this .mcversion );
71
+ try {
72
+ return isCompatible (this .acceptedRange , this .mcversion );
73
+ } catch (e) {
74
+ console .error (this .data .modid );
75
+ console .error (e);
76
+ return false ;
77
+ }
65
78
},
66
79
},
67
80
mounted () {
68
- this .$repo .dispatch (' readForgeLogo' , this .hash ).then ((icon ) => {
69
- if (typeof icon === ' string' && icon !== ' ' ) {
70
- this .icon = ` data:image/png;base64, ${ icon} ` ;
71
- } else {
72
- this .icon = unknownPack;
73
- }
74
- });
81
+ this .readLogo ();
75
82
},
76
83
methods: {
84
+ readLogo () {
85
+ this .$repo .dispatch (' readForgeLogo' , this .hash ).then ((icon ) => {
86
+ if (typeof icon === ' string' && icon !== ' ' ) {
87
+ this .icon = ` data:image/png;base64, ${ icon} ` ;
88
+ } else {
89
+ this .icon = unknownPack;
90
+ }
91
+ });
92
+ },
77
93
onDragStart (e ) {
78
94
e .dataTransfer .setData (' Index' , ` ${ this .isSelected ? ' R' : ' L' }${ this .index } ` );
79
95
},
@@ -91,7 +107,7 @@ export default {
91
107
background-color : #e65100 ;
92
108
}
93
109
.draggable-card :hover {
94
- background-color : #388E3C ;
110
+ background-color : #388e3c ;
95
111
}
96
112
97
113
.title {
0 commit comments