make my shit work

This commit is contained in:
Иван 2025-12-19 20:41:46 +03:00
parent da29133989
commit ee31b639b2
3 changed files with 48 additions and 42 deletions

View File

@ -4,9 +4,9 @@ const nextConfig: NextConfig = {
images: {
remotePatterns: [
{
protocol: "http",
hostname: "89.169.188.2",
pathname: '/**'
protocol: "https",
hostname: "api.travelmarine.ru",
pathname: "/**",
},
],
unoptimized: true,

View File

@ -7,7 +7,7 @@ const useApiClient = () => {
const authPopup = useAuthPopup();
const apiClient = axios.create({
baseURL: "http://89.169.188.2/api",
baseURL: "https://api.travelmarine.ru",
headers: {
"Content-Type": "application/json",
},

View File

@ -1,21 +1,26 @@
import { clsx, type ClassValue } from "clsx"
import { twMerge } from "tailwind-merge"
import { clsx, type ClassValue } from "clsx";
import { twMerge } from "tailwind-merge";
import { differenceInHours, parseISO } from "date-fns";
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs))
return twMerge(clsx(inputs));
}
const API_BASE_URL = "http://89.169.188.2";
const API_BASE_URL = "https://api.travelmarine.ru";
export const getImageUrl = (relativePath: string): string => {
if (!relativePath) return "";
// Если путь уже абсолютный, возвращаем как есть
if (relativePath.startsWith("http://") || relativePath.startsWith("https://")) {
if (
relativePath.startsWith("http://") ||
relativePath.startsWith("https://")
) {
return relativePath;
}
// Убираем начальный слеш, если есть, и формируем абсолютный URL
const cleanPath = relativePath.startsWith("/") ? relativePath.slice(1) : relativePath;
const cleanPath = relativePath.startsWith("/")
? relativePath.slice(1)
: relativePath;
return `${API_BASE_URL}/${cleanPath}`;
};
@ -67,7 +72,8 @@ export const calculateTotalPrice = (
// Добавляем разницу в минутах
const minutesDiff =
(arrivalDateTime.getMinutes() - departureDateTime.getMinutes()) / 60;
(arrivalDateTime.getMinutes() - departureDateTime.getMinutes()) /
60;
hoursDiff += minutesDiff;
// Округляем до ближайших 0.5 часа