diff options
| author | Yash <[email protected]> | 2024-04-01 02:19:54 +0000 |
|---|---|---|
| committer | Yash <[email protected]> | 2024-04-01 02:19:54 +0000 |
| commit | 8d698325e1513f2d770c9339f966590460b878ff (patch) | |
| tree | ef595d7a096885e4115818a52567a8955eeaf4e0 /apps/web/src/lib | |
| parent | fix delete button on dark mode (diff) | |
| download | supermemory-8d698325e1513f2d770c9339f966590460b878ff.tar.xz supermemory-8d698325e1513f2d770c9339f966590460b878ff.zip | |
add new page popover
Diffstat (limited to 'apps/web/src/lib')
| -rw-r--r-- | apps/web/src/lib/utils.ts | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/apps/web/src/lib/utils.ts b/apps/web/src/lib/utils.ts index d084ccad..6b8f3fd9 100644 --- a/apps/web/src/lib/utils.ts +++ b/apps/web/src/lib/utils.ts @@ -1,6 +1,19 @@ -import { type ClassValue, clsx } from "clsx" -import { twMerge } from "tailwind-merge" +"use client"; +import { type ClassValue, clsx } from "clsx"; +import { twMerge } from "tailwind-merge"; export function cn(...inputs: ClassValue[]) { - return twMerge(clsx(inputs)) + return twMerge(clsx(inputs)); +} + +// removes http(s?):// and / from the url +export function cleanUrl(url: string) { + if (url.endsWith("/")) { + url = url.slice(0, -1); + } + return url.startsWith("https://") + ? url.slice(8) + : url.startsWith("http://") + ? url.slice(7) + : url; } |