refactor(all): migrate from React to Next.js

This commit is contained in:
2026-05-20 09:46:17 +03:30
parent dacbd3a328
commit f23108cda3
86 changed files with 2831 additions and 2679 deletions

17
src/lib/site.ts Normal file
View File

@@ -0,0 +1,17 @@
const trimTrailingSlash = (value: string) => value.replace(/\/$/, "");
export const siteUrl = trimTrailingSlash(
process.env.NEXT_PUBLIC_SITE_URL || "http://localhost:8080",
);
export const apiBaseUrl = trimTrailingSlash(
process.env.NEXT_PUBLIC_API_BASE_URL || "http://127.0.0.1:8000",
);
export const toAbsoluteUrl = (value?: string | null, fallbackBase = siteUrl) => {
if (!value) return undefined;
if (/^https?:\/\//i.test(value)) return value;
const normalizedBase = trimTrailingSlash(fallbackBase);
const normalizedPath = value.startsWith("/") ? value : `/${value}`;
return `${normalizedBase}${normalizedPath}`;
};