feat: rebuild app using vike

This commit is contained in:
2024-02-22 12:15:04 +00:00
parent 87ef4ca1e3
commit 9777ae1676
104 changed files with 2214 additions and 2976 deletions
+2
View File
@@ -0,0 +1,2 @@
export const BASE_URL =
typeof window !== "undefined" ? location.protocol + "//" + location.host : "";
+11
View File
@@ -0,0 +1,11 @@
import { createTRPCReact } from "@trpc/react-query";
import type { AppRouter } from "~/server/routers/_app";
export const getBaseUrl = () => {
if (typeof window !== "undefined") return "";
return `http://localhost:${process.env.PORT ?? 3000}`;
};
const trpc = createTRPCReact<AppRouter>({});
export default trpc;
+15
View File
@@ -0,0 +1,15 @@
import { type ClassValue, clsx } from "clsx";
import { twMerge } from "tailwind-merge";
import { BASE_URL } from "./consts";
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}
export function getFileExt(filename: string) {
return filename.substring(filename.lastIndexOf(".") + 1);
}
export function getUrl(...path: string[]) {
return BASE_URL + ("/" + path.join("/")).replace(/\/\/+/g, "/");
}