-
-
Notifications
You must be signed in to change notification settings - Fork 124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(platform): Added screen for CREATE NEW PROJECT #540
Merged
rajdip-b
merged 19 commits into
keyshade-xyz:develop
from
poswalsameer:feat/added-screen-for-create-new-project
Dec 3, 2024
Merged
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
bf82afb
feat: added screen for create new project
poswalsameer 0ac46f2
made workable fix
rajdip-b c0867f4
fixed type issue
rajdip-b 8ade314
fixed typescript issue and tested the whole flow again
poswalsameer cfbd5ec
changed types of project
poswalsameer e7e0fcd
tested the whole one more time, added new and correct types, added bo…
poswalsameer ce9fb85
made the headers part optional in every request
poswalsameer e61eae0
fixed code style in getting all projects from the current workspace
poswalsameer 66ddcd3
Merge branch 'develop' into feat/added-screen-for-create-new-project
poswalsameer 35c4c9f
updated pnpm-lock.yaml
poswalsameer 2f8e1a7
updated pnpm-lock file
poswalsameer 3024f3f
Merge branch 'develop' into feat/added-screen-for-create-new-project
rajdip-b 08a2221
fixed
rajdip-b 70e3918
update eslint config
rajdip-b c46b2ad
fixed schema tests
rajdip-b 9fcf604
updated types in platform
rajdip-b 2189cdf
fixed failing api tests
rajdip-b 2ead80a
Merge branch 'develop' into feat/added-screen-for-create-new-project
rajdip-b 2205cb4
incorporated user from schema package
rajdip-b File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,8 @@ import { toast } from 'sonner' | |
import { useRouter } from 'next/navigation' | ||
import type { | ||
CreateProjectRequest, | ||
CreateProjectResponse | ||
CreateProjectResponse, | ||
Workspace | ||
} from '@keyshade/schema' | ||
import { ProjectController } from '@keyshade/api-client' | ||
import { AddSVG } from '@public/svg/shared' | ||
|
@@ -41,7 +42,6 @@ import { | |
DialogTrigger | ||
} from '@/components/ui/dialog' | ||
import { Projects } from '@/lib/api-functions/projects' | ||
import { z } from 'zod' | ||
|
||
export default function Index(): JSX.Element { | ||
const [isSheetOpen, setIsSheetOpen] = useState<boolean>(false) | ||
|
@@ -53,16 +53,16 @@ export default function Index(): JSX.Element { | |
environments: [ | ||
{ | ||
name: '', | ||
description: '', | ||
isDefault: false | ||
projectId: Date.now().toString(), | ||
description: '' | ||
} | ||
], | ||
accessLevel: 'GLOBAL' | ||
}) | ||
|
||
const router = useRouter() | ||
|
||
const createNewProject = async () => { | ||
const createNewProject = async () => { | ||
const projectController = new ProjectController( | ||
process.env.NEXT_PUBLIC_BACKEND_URL | ||
) | ||
|
@@ -77,20 +77,23 @@ export default function Index(): JSX.Element { | |
|
||
const response = await projectController.createProject(request, {}) | ||
|
||
if (response.success) { | ||
const data = response.data as CreateProjectResponse; | ||
|
||
if (response.success && response.data ) { | ||
|
||
const createdProject: ProjectWithoutKeys = { | ||
id: response.data.id, | ||
name: response.data.name, | ||
description: response.data.description, | ||
createdAt: response.data.createdAt, | ||
updatedAt: response.data.updatedAt, | ||
storePrivateKey: response.data.storePrivateKey, | ||
isDisabled: response.data.isDisabled, | ||
accessLevel: response.data.accessLevel, | ||
lastUpdatedById: response.data.lastUpdatedById, | ||
workspaceId: response.data.workspaceId, | ||
isForked: response.data.isForked, | ||
forkedFromId: response.data.forkedFromId | ||
id: data.id, | ||
name: data.name, | ||
description: data.description, | ||
createdAt: data.createdAt, | ||
updatedAt: data.updatedAt, | ||
storePrivateKey: data.storePrivateKey, | ||
isDisabled: data.isDisabled, | ||
accessLevel: data.accessLevel as "GLOBAL" | "INTERNAL" | "PRIVATE", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Access level is already inferred as these types. |
||
lastUpdatedById: data.lastUpdatedById, | ||
workspaceId: data.workspaceId, | ||
isForked: data.isForked, | ||
forkedFromId: data.forkedFromId | ||
} | ||
|
||
setProjects((prevProjects) => [...prevProjects, createdProject]) | ||
|
@@ -285,7 +288,7 @@ export default function Index(): JSX.Element { | |
<div className="flex h-[2.25rem] w-[25.625rem] justify-end"> | ||
<Button | ||
className="font-inter h-[2.25rem] w-[8rem] rounded-[0.375rem] text-[0.875rem] font-[500]" | ||
onClick={() => void createNewProject()} | ||
onClick={createNewProject} | ||
variant="secondary" | ||
> | ||
Create project | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,8 +42,12 @@ export const zProject = z.object({ | |
|
||
export const zEnvironment = z.object({ | ||
name: z.string(), | ||
description: z.string().nullable(), | ||
isDefault: z.boolean().optional() | ||
projectId: z.string(), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do not use these. We already have type definitions set in the |
||
description: z.string().optional() | ||
|
||
// description: z.string().nullable(), | ||
// isDefault: z.boolean().optional(), | ||
|
||
}) | ||
|
||
export const zNewProject = z.object({ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can just set it to ''. Either ways, this won't be sent to the backend