@@ -58,6 +58,7 @@ const DisplayUserProduct = (props) => {
5858 const [ currentDesign , setCurrentDesign ] = useState ( '' ) ;
5959 const [ currentColor , setCurrentColor ] = useState ( null ) ;
6060 const [ intervalId , setIntervalId ] = useState ( undefined ) ;
61+ const [ showingLocation , setShowingLocation ] = useState ( 'front' ) ;
6162
6263 // T-Shirt Color Maps
6364 const tShirtMap = {
@@ -140,20 +141,24 @@ const DisplayUserProduct = (props) => {
140141 if ( default_location === 'front' ) {
141142 setCurrentDesign ( window . location . origin + "/api/images/" + currentProduct . filename_front ) ;
142143 setCurrentColor ( getColor ( 'front' ) ) ;
144+ setShowingLocation ( 'front' ) ;
143145 }
144146 else if ( default_location === 'back' ) {
145147 setCurrentDesign ( window . location . origin + "/api/images/" + currentProduct . filename_back ) ;
146148 setCurrentColor ( getColor ( 'back' ) ) ;
149+ setShowingLocation ( 'back' ) ;
147150 }
148151 }
149152 else if ( state === 1 ) {
150153 if ( default_location === 'front' ) {
151154 setCurrentDesign ( window . location . origin + "/api/images/" + currentProduct . filename_back ) ;
152155 setCurrentColor ( getColor ( 'back' ) ) ;
156+ setShowingLocation ( 'back' ) ;
153157 }
154158 else if ( default_location === 'back' ) {
155159 setCurrentDesign ( window . location . origin + "/api/images/" + currentProduct . filename_front ) ;
156160 setCurrentColor ( getColor ( 'front' ) ) ;
161+ setShowingLocation ( 'front' ) ;
157162 }
158163 }
159164 } , [ currentProduct , color , style , state ] ) ;
@@ -198,10 +203,12 @@ const DisplayUserProduct = (props) => {
198203 setCurrentDesign ( prevDesign => {
199204 if ( prevDesign === window . location . origin + "/api/images/" + currentProduct . filename_front ) {
200205 setCurrentColor ( getColor ( 'back' ) ) ;
206+ setShowingLocation ( 'back' ) ;
201207 return ( window . location . origin + "/api/images/" + currentProduct . filename_back ) ;
202208 }
203209 else {
204210 setCurrentColor ( getColor ( 'front' ) ) ;
211+ setShowingLocation ( 'front' ) ;
205212 return ( window . location . origin + "/api/images/" + currentProduct . filename_front ) ;
206213 }
207214 } ) ;
@@ -228,20 +235,24 @@ const DisplayUserProduct = (props) => {
228235 if ( default_location === 'front' ) {
229236 setCurrentDesign ( window . location . origin + "/api/images/" + currentProduct . filename_front ) ;
230237 setCurrentColor ( getColor ( 'front' ) ) ;
238+ setShowingLocation ( 'front' ) ;
231239 }
232240 else if ( default_location === 'back' ) {
233241 setCurrentDesign ( window . location . origin + "/api/images/" + currentProduct . filename_back ) ;
234242 setCurrentColor ( getColor ( 'back' ) ) ;
243+ setShowingLocation ( 'back' ) ;
235244 }
236245 }
237246 else if ( state === 1 ) {
238247 if ( default_location === 'front' ) {
239248 setCurrentDesign ( window . location . origin + "/api/images/" + currentProduct . filename_back ) ;
240249 setCurrentColor ( getColor ( 'back' ) ) ;
250+ setShowingLocation ( 'back' ) ;
241251 }
242252 else if ( default_location === 'back' ) {
243253 setCurrentDesign ( window . location . origin + "/api/images/" + currentProduct . filename_front ) ;
244254 setCurrentColor ( getColor ( 'front' ) ) ;
255+ setShowingLocation ( 'front' ) ;
245256 }
246257 }
247258 }
@@ -257,10 +268,12 @@ const DisplayUserProduct = (props) => {
257268 setCurrentDesign ( prevDesign => {
258269 if ( prevDesign === window . location . origin + "/api/images/" + currentProduct . filename_front ) {
259270 setCurrentColor ( getColor ( 'back' ) ) ;
271+ setShowingLocation ( 'back' ) ;
260272 return ( window . location . origin + "/api/images/" + currentProduct . filename_back ) ;
261273 }
262274 else {
263275 setCurrentColor ( getColor ( 'front' ) ) ;
276+ setShowingLocation ( 'front' ) ;
264277 return ( window . location . origin + "/api/images/" + currentProduct . filename_front ) ;
265278 }
266279 } ) ;
@@ -274,24 +287,26 @@ const DisplayUserProduct = (props) => {
274287 } ;
275288
276289 if ( style !== "Other" ) {
290+ const designClass = ( showingLocation === 'front' && currentProduct . style_size === 'pocket' ) ? 'design-pocket' : 'design' ;
291+
277292 if ( enlarge ) {
278- return (
279- < div
280- className = "fullDesign"
281- onMouseEnter = { handleMouseEnter }
282- onMouseLeave = { handleMouseLeave } >
283- < img
284- src = { currentColor }
285- alt = "Product Style"
286- className = "tshirt"
287- />
288- < img
289- src = { currentDesign }
290- alt = "Product Design"
291- className = "design"
292- />
293- </ div >
294- ) ;
293+ return (
294+ < div
295+ className = "fullDesign"
296+ onMouseEnter = { handleMouseEnter }
297+ onMouseLeave = { handleMouseLeave } >
298+ < img
299+ src = { currentColor }
300+ alt = "Product Style"
301+ className = "tshirt"
302+ />
303+ < img
304+ src = { currentDesign }
305+ alt = "Product Design"
306+ className = { designClass }
307+ />
308+ </ div >
309+ ) ;
295310 }
296311 else {
297312 return (
@@ -305,7 +320,7 @@ const DisplayUserProduct = (props) => {
305320 < img
306321 src = { currentDesign }
307322 alt = "Product Design"
308- className = "design"
323+ className = { designClass }
309324 />
310325 </ div >
311326 ) ;
0 commit comments