Skip to content

Commit 551ae40

Browse files
author
Nico Sammito
authored
Merge pull request #84 from code0-tech/feat/#76
Project slug input validation is missing
2 parents 4ac005e + 1b1c870 commit 551ae40

2 files changed

Lines changed: 16 additions & 9 deletions

File tree

src/packages/ce/src/project/pages/ProjectSettingsPage.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import {Tab, TabList, TabTrigger} from "@code0-tech/pictor/dist/components/tab/Tab";
2-
3-
"use clients"
1+
"use client"
42

3+
import {Tab, TabList, TabTrigger} from "@code0-tech/pictor/dist/components/tab/Tab";
54
import React from "react";
65
import {Button, DResizableHandle, DResizablePanel, DResizablePanelGroup, Flex, Text} from "@code0-tech/pictor";
76
import {IconLayoutSidebar} from "@tabler/icons-react";

src/packages/ce/src/project/views/ProjectSettingsGeneralView.tsx

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ import {
99
TabContent,
1010
Text,
1111
TextInput,
12+
toast,
1213
useForm,
1314
useService,
14-
useStore,
15-
toast
15+
useStore
1616
} from "@code0-tech/pictor";
1717
import CardSection from "@code0-tech/pictor/dist/components/card/CardSection";
1818
import {useParams} from "next/navigation";
@@ -49,6 +49,8 @@ export const ProjectSettingsGeneralView: React.FC = () => {
4949
},
5050
slug: (value) => {
5151
if (!value) return "Slug is required"
52+
if (value.length < 3) return "Slug needs to be at least 3 characters"
53+
if (value.length > 50) return "Slug needs to be less than 50 characters"
5254
return null
5355
}
5456
},
@@ -84,19 +86,25 @@ export const ProjectSettingsGeneralView: React.FC = () => {
8486
<CardSection border>
8587
<Flex justify={"space-between"} align={"center"}>
8688
<Text size={"md"} hierarchy={"primary"}>Name</Text>
87-
<TextInput {...inputs.getInputProps("name")}/>
89+
<TextInput miw={"200px"} {...inputs.getInputProps("name")}/>
8890
</Flex>
8991
</CardSection>
9092
<CardSection border>
9193
<Flex justify={"space-between"} align={"center"}>
9294
<Text size={"md"} hierarchy={"primary"}>Description</Text>
93-
<TextInput {...inputs.getInputProps("description")}/>
95+
<TextInput miw={"200px"} {...inputs.getInputProps("description")}/>
9496
</Flex>
9597
</CardSection>
9698
<CardSection border>
9799
<Flex justify={"space-between"} align={"center"}>
98-
<Text size={"md"} hierarchy={"primary"}>Slug</Text>
99-
<TextInput {...inputs.getInputProps("slug")}/>
100+
<Flex style={{gap: ".35rem", flexDirection: "column"}}>
101+
<Text size={"md"} hierarchy={"primary"}>Slug</Text>
102+
<Text size={"md"} hierarchy={"tertiary"}>
103+
Think of this as your project’s unique nickname in a web address. It helps distinguish this
104+
project from others when using URL-based connections (like REST flows).
105+
</Text>
106+
</Flex>
107+
<TextInput miw={"200px"} {...inputs.getInputProps("slug")}/>
100108
</Flex>
101109
</CardSection>
102110
</Card>

0 commit comments

Comments
 (0)