mirror of
https://github.com/docmost/docmost.git
synced 2025-11-20 23:11:10 +10:00
Allow creation of space
* other fixes and cleanups
This commit is contained in:
@ -1,5 +1,3 @@
|
||||
import { UserRole } from "@/lib/types.ts";
|
||||
|
||||
export function formatMemberCount(memberCount: number): string {
|
||||
if (memberCount === 1) {
|
||||
return "1 member";
|
||||
@ -15,3 +13,15 @@ export function extractPageSlugId(input: string): string {
|
||||
const parts = input.split("-");
|
||||
return parts.length > 1 ? parts[parts.length - 1] : input;
|
||||
}
|
||||
|
||||
export const computeSpaceSlug = (name: string) => {
|
||||
const alphanumericName = name.replace(/[^a-zA-Z0-9\s]/g, "");
|
||||
if (alphanumericName.includes(" ")) {
|
||||
return alphanumericName
|
||||
.split(" ")
|
||||
.map((word) => word.charAt(0).toUpperCase())
|
||||
.join("");
|
||||
} else {
|
||||
return alphanumericName.toLowerCase();
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user