From c4562e5f529991b0770a2d8dead2e1cea3f77aa2 Mon Sep 17 00:00:00 2001
From: Louis Capitanchik <contact@louiscap.co>
Date: Mon, 24 Oct 2022 02:18:02 +0100
Subject: [PATCH] Fix image paths for Gitlab Pages

---
 src/data/testlevel1.json | 14 +++++++-------
 src/data/testlevel2.json | 20 ++++++++++----------
 src/game/Level.js        |  2 +-
 src/render/Level.js      |  4 ++--
 4 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/src/data/testlevel1.json b/src/data/testlevel1.json
index 7e2fcca..ae04d18 100644
--- a/src/data/testlevel1.json
+++ b/src/data/testlevel1.json
@@ -18,8 +18,8 @@
     {
       "name": "charles",
       "images": {
-        "text": "/charles-text.png",
-        "entity": "/charles.png"
+        "text": "charles-text.png",
+        "entity": "charles.png"
       },
       "text_start_locations": [
         {
@@ -37,8 +37,8 @@
     {
       "name": "wall",
       "images": {
-        "text": "/wall-text.png",
-        "entity": "/wall.png"
+        "text": "wall-text.png",
+        "entity": "wall.png"
       },
       "text_start_locations": [
         {
@@ -98,7 +98,7 @@
         "data": "adjectives/you"
       },
       "images": {
-        "text": "/you-text.png"
+        "text": "you-text.png"
       },
       "text_start_locations": [
         {
@@ -114,7 +114,7 @@
         "data": "adjectives/push"
       },
       "images": {
-        "text": "/push-text.png"
+        "text": "push-text.png"
       },
       "text_start_locations": [
         {
@@ -133,7 +133,7 @@
         }
       },
       "images": {
-        "text": "/stop-text.png"
+        "text": "stop-text.png"
       },
       "text_start_locations": [
         {
diff --git a/src/data/testlevel2.json b/src/data/testlevel2.json
index 02301cb..09c411c 100644
--- a/src/data/testlevel2.json
+++ b/src/data/testlevel2.json
@@ -23,8 +23,8 @@
     {
       "name": "charles",
       "images": {
-        "text": "/charles-text.png",
-        "entity": "/charles.png"
+        "text": "charles-text.png",
+        "entity": "charles.png"
       },
       "text_start_locations": [
         {
@@ -41,8 +41,8 @@
     },    {
       "name": "flag",
       "images": {
-        "text": "/flag-text.png",
-        "entity": "/flag.png"
+        "text": "flag-text.png",
+        "entity": "flag.png"
       },
       "text_start_locations": [
         {
@@ -60,8 +60,8 @@
     {
       "name": "wall",
       "images": {
-        "text": "/wall-text.png",
-        "entity": "/wall.png"
+        "text": "wall-text.png",
+        "entity": "wall.png"
       },
       "text_start_locations": [
         {
@@ -257,7 +257,7 @@
         "data": "adjectives/you"
       },
       "images": {
-        "text": "/you-text.png"
+        "text": "you-text.png"
       },
       "text_start_locations": [
         {
@@ -273,7 +273,7 @@
         "data": "adjectives/push"
       },
       "images": {
-        "text": "/push-text.png"
+        "text": "push-text.png"
       },
       "text_start_locations": [
         {
@@ -293,7 +293,7 @@
         }
       },
       "images": {
-        "text": "/stop-text.png"
+        "text": "stop-text.png"
       },
       "text_start_locations": [
         {
@@ -312,7 +312,7 @@
         }
       },
       "images": {
-        "text": "/win-text.png"
+        "text": "win-text.png"
       },
       "text_start_locations": [
         {
diff --git a/src/game/Level.js b/src/game/Level.js
index fc7d38b..1495c26 100644
--- a/src/game/Level.js
+++ b/src/game/Level.js
@@ -82,7 +82,7 @@ export default class Level {
         if (source.hasOwnProperty('connectors')) {
             for (const { x, y, type: cType } of source.connectors) {
                 const entity = new Entity([x, y], textNoun)
-                entity.fallbackImage = `/${ cType }-text.png`
+                entity.fallbackImage = `${ cType }-text.png`
                 entity.meta = {
                     type: 'connector',
                     name: cType,
diff --git a/src/render/Level.js b/src/render/Level.js
index 015f6f3..5f7dac9 100644
--- a/src/render/Level.js
+++ b/src/render/Level.js
@@ -95,7 +95,7 @@ export default class Level extends React.Component<Props> {
             <div className="level-container">
                 {[...range(width)].map(x =>
                     [...range(height)].map(y => (
-                        <img src="/background.png" className="level-tile" style={{
+                        <img src="background.png" className="level-tile" style={{
                             left: (margin * x) + (x * 32 * scale),
                             top: (margin * y) + (y * 32 * scale),
                             width: size * scale,
@@ -123,7 +123,7 @@ export default class Level extends React.Component<Props> {
                     const top = (margin * y) + (y * 32 * scale)
 
                     return (
-                        <img className="level-entity" src={`/${ cType }-text.png`} style={{
+                        <img className="level-entity" src={`${ cType }-text.png`} style={{
                             left,
                             top,
                             width: size * scale,
-- 
GitLab