Refactor appName generation in dashboard components

- Updated the appName generation logic in `AddApplication`, `AddCompose`, and `AddDatabase` components to use the `slugify` function for improved consistency and readability.
- Enhanced the `slugify` function to return a default value of "service" if the input is empty, ensuring robustness in name generation.
- Improved project name validation in `handle-project.tsx` to enforce stricter rules on naming conventions.
This commit is contained in:
Mauricio Siu
2025-05-04 20:14:49 -06:00
parent 7e365e1947
commit 86b56e2597
5 changed files with 24 additions and 18 deletions

View File

@@ -5,7 +5,7 @@ export const slugify = (text: string | undefined) => {
return "";
}
const cleanedText = text.trim().replace(/[^a-zA-Z0-9\s]/g, "");
const cleanedText = text.trim().replace(/[^a-zA-Z0-9\s]/g, "") || "service";
return slug(cleanedText, {
lower: true,