diff --git a/app/app.vue b/app/app.vue index 4f09288..7b58bca 100644 --- a/app/app.vue +++ b/app/app.vue @@ -19,19 +19,4 @@ onMounted(() => { }); - + diff --git a/app/composables/useVillageHelpers.ts b/app/composables/useVillageHelpers.ts new file mode 100644 index 0000000..18da496 --- /dev/null +++ b/app/composables/useVillageHelpers.ts @@ -0,0 +1,37 @@ +export const useVillageHelpers = () => { + /** + * Converts numeric coordinates to a chess-like format (e.g., 0,0 -> A7). + * The grid is 5 columns (A-E) and 7 rows (1-7). + * Rows are numbered from bottom to top, so y=6 is row '1'. + * @param x The column index (0-4). + * @param y The row index (0-6). + */ + const formatCoordinates = (x: number, y: number): string => { + const col = String.fromCharCode('A'.charCodeAt(0) + x); + const row = 7 - y; + return `${col}${row}`; + }; + + /** + * Finds and replaces all occurrences of numeric coordinates like (x, y) + * in a string with the chess-like format. + * @param message The message string. + */ + const formatMessageCoordinates = (message: string): string => { + if (!message) return ''; + // Regex to find coordinates like (1, 2) + return message.replace(/\((\d+), (\d+)\)/g, (match, xStr, yStr) => { + const x = parseInt(xStr, 10); + const y = parseInt(yStr, 10); + if (!isNaN(x) && !isNaN(y)) { + return formatCoordinates(x, y); + } + return match; // Return original if parsing fails + }); + }; + + return { + formatCoordinates, + formatMessageCoordinates, + }; +}; diff --git a/app/layouts/default.vue b/app/layouts/default.vue index 664afc2..2709b16 100644 --- a/app/layouts/default.vue +++ b/app/layouts/default.vue @@ -5,7 +5,7 @@ {{ user.nickname }} 💰 {{ displayedCoins }} ✨ {{ displayedExp }} - + @@ -94,43 +94,31 @@ watch(() => user.value?.exp, (newExp, oldExp) => { display: flex; flex-direction: column; min-height: 100vh; + background-color: var(--background-color); } .top-bar { - background-color: #5a4b3a; /* Dark earthy brown */ - padding: 10px 15px; - border-bottom: 2px solid #4a3b2a; /* Darker brown border */ + background-color: var(--container-bg-color); + padding: 10px 20px; + border-bottom: 1px solid var(--border-color); display: flex; - justify-content: flex-end; /* Align user info to the right */ + justify-content: flex-end; align-items: center; - color: #f0ead6; /* Creamy white text */ + color: var(--text-color); + box-shadow: 0 2px 4px rgba(0,0,0,0.05); } .user-info-top { display: flex; align-items: center; - gap: 15px; - font-size: 0.9em; -} - -.logout-button { - background-color: #a34a2a; /* Burnt orange/reddish brown */ - color: white; - border: 1px solid #7b3b22; - padding: 5px 10px; - border-radius: 5px; - cursor: pointer; - font-size: 0.8em; - transition: background-color 0.2s; -} - -.logout-button:hover { - background-color: #8e3f22; + gap: 20px; + font-size: 0.95em; + font-weight: 500; } .main-content { flex-grow: 1; - padding-bottom: 60px; /* Space for bottom nav */ + padding-bottom: 70px; /* Space for bottom nav */ } .bottom-nav { @@ -138,12 +126,12 @@ watch(() => user.value?.exp, (newExp, oldExp) => { bottom: 0; left: 0; width: 100%; - background-color: #5a4b3a; /* Dark earthy brown */ - border-top: 2px solid #4a3b2a; /* Darker brown border */ + background-color: var(--container-bg-color); + border-top: 1px solid var(--border-color); display: flex; justify-content: space-around; padding: 5px 0; - box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.2); /* Slightly darker shadow */ + box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.05); z-index: 1000; } @@ -152,22 +140,23 @@ watch(() => user.value?.exp, (newExp, oldExp) => { flex-direction: column; align-items: center; text-decoration: none; - color: #f0ead6; /* Creamy white text */ - font-size: 0.7em; + color: var(--text-color-light); + font-size: 0.75em; padding: 5px; transition: color 0.2s; } .nav-item:hover { - color: #ffcc00; /* Gold/yellow on hover */ + color: var(--primary-color); } .nav-item .icon { - font-size: 1.5em; + font-size: 1.8em; margin-bottom: 2px; } -.nav-item.router-link-active { - color: #ffcc00; /* Gold/yellow for active link */ +.nav-item.router-link-exact-active { + color: var(--primary-color); + font-weight: 600; } diff --git a/app/pages/habits.vue b/app/pages/habits.vue index d1e5df4..225007a 100644 --- a/app/pages/habits.vue +++ b/app/pages/habits.vue @@ -1,53 +1,69 @@