From f043b75b98f0803bd81184484c25c8f6bedefc75 Mon Sep 17 00:00:00 2001 From: Mahdi Date: Sun, 24 May 2026 13:11:57 +0330 Subject: [PATCH] Compact business cards and fix production image URLs --- .env.example | 4 ++- .env.production | 1 + src/components/business/BusinessCard.vue | 46 ++++++++++++++---------- src/utils/media.ts | 9 +++-- src/views/app/AppHomeView.vue | 2 +- 5 files changed, 39 insertions(+), 23 deletions(-) diff --git a/.env.example b/.env.example index c51665f..21abf97 100644 --- a/.env.example +++ b/.env.example @@ -1,3 +1,5 @@ -# Dev: /api (Vite proxy) | Production build: .env.production +# Dev: /api (Vite proxy) | Production: see .env.production # Full local API: http://localhost:3000 VITE_API_URL=/api +# Production: https://api.montime.ir (uploads served from API) +# VITE_ASSETS_URL=https://api.montime.ir diff --git a/.env.production b/.env.production index 89903f1..2bbec04 100644 --- a/.env.production +++ b/.env.production @@ -1,2 +1,3 @@ VITE_API_URL=https://api.montime.ir +VITE_ASSETS_URL=https://api.montime.ir VITE_APP_MODE=web diff --git a/src/components/business/BusinessCard.vue b/src/components/business/BusinessCard.vue index 88e2872..e10b105 100644 --- a/src/components/business/BusinessCard.vue +++ b/src/components/business/BusinessCard.vue @@ -1,9 +1,29 @@ diff --git a/src/utils/media.ts b/src/utils/media.ts index cd73769..5f2a7e2 100644 --- a/src/utils/media.ts +++ b/src/utils/media.ts @@ -1,9 +1,14 @@ +/** Base URL for uploaded files (empty = same origin /uploads via Vite proxy). */ const assetsBase = (import.meta.env.VITE_ASSETS_URL ?? '').replace(/\/$/, ''); export function uploadUrl(path: string | null | undefined): string { if (!path) return ''; - if (path.startsWith('http')) return path; - const rel = path.startsWith('/uploads/') ? path : `/uploads/${path}`; + if (path.startsWith('http://') || path.startsWith('https://')) return path; + const rel = path.startsWith('/uploads/') + ? path + : path.startsWith('/') + ? path + : `/uploads/${path}`; return assetsBase ? `${assetsBase}${rel}` : rel; } diff --git a/src/views/app/AppHomeView.vue b/src/views/app/AppHomeView.vue index 5fe882a..1f8087e 100644 --- a/src/views/app/AppHomeView.vue +++ b/src/views/app/AppHomeView.vue @@ -42,7 +42,7 @@ > کسب‌وکاری یافت نشد. -