Spaces:
Sleeping
Sleeping
import { routing } from '@/libs/i18nNavigation'; | |
import { type ClassValue, clsx } from 'clsx'; | |
import { twMerge } from 'tailwind-merge'; | |
export const getBaseUrl = () => { | |
if (process.env.NEXT_PUBLIC_APP_URL) { | |
return process.env.NEXT_PUBLIC_APP_URL; | |
} | |
if ( | |
process.env.VERCEL_ENV === 'production' | |
&& process.env.VERCEL_PROJECT_PRODUCTION_URL | |
) { | |
return `https://${process.env.VERCEL_PROJECT_PRODUCTION_URL}`; | |
} | |
if (process.env.VERCEL_URL) { | |
return `https://${process.env.VERCEL_URL}`; | |
} | |
return 'http://localhost:3000'; | |
}; | |
export const getI18nPath = (url: string, locale: string) => { | |
if (locale === routing.defaultLocale) { | |
return url; | |
} | |
return `/${locale}${url}`; | |
}; | |
export function cn(...inputs: ClassValue[]) { | |
return twMerge(clsx(inputs)); | |
} | |