Skip to content

Commit

Permalink
feat(frontend): added in new general workspace landing page design [2…
Browse files Browse the repository at this point in the history
…024-12-15]
  • Loading branch information
CHRISCARLON committed Dec 15, 2024
1 parent 38f07dd commit ef515c0
Show file tree
Hide file tree
Showing 8 changed files with 388 additions and 186 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
"use client";
import React, { useState } from "react";
import { useRouter } from "next/navigation";

interface AddWorkspaceMemberModalProps {
isOpen: boolean;
onClose: () => void;
onSubmit: (email: string, role: "Admin" | "Read") => Promise<void>;
}
import { AddWorkspaceMemberModalProps } from "./types";

export const AddWorkspaceMemberModal: React.FC<
AddWorkspaceMemberModalProps
Expand Down
19 changes: 8 additions & 11 deletions gridwalk-ui/src/app/workspace/[workspaceId]/projectModal.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client";
import React, { useState } from "react";
import { CreateProjectModalProps } from "./types";
import { CreateProjectModalProps, DeleteProjectModalProps } from "./types";

export const CreateProjectModal: React.FC<CreateProjectModalProps> = ({
isOpen,
Expand All @@ -20,7 +20,11 @@ export const CreateProjectModal: React.FC<CreateProjectModalProps> = ({
onClose();
setProjectName("");
} catch (err) {
setError(err instanceof Error ? err.message : "An error occurred");
setError(
err instanceof Error
? err.message
: "An error occurred creating a new project"
);
} finally {
setIsLoading(false);
}
Expand Down Expand Up @@ -96,13 +100,6 @@ export const CreateProjectModal: React.FC<CreateProjectModalProps> = ({
);
};

interface DeleteProjectModalProps {
isOpen: boolean;
onClose: () => void;
projectName: string;
onConfirm: () => Promise<void>;
}

export const DeleteProjectModal: React.FC<DeleteProjectModalProps> = ({
isOpen,
onClose,
Expand All @@ -112,13 +109,13 @@ export const DeleteProjectModal: React.FC<DeleteProjectModalProps> = ({
const [isLoading, setIsLoading] = useState(false);
const [error, setError] = useState<string | null>(null);
const [confirmText, setConfirmText] = useState("");

const isDeleteEnabled = confirmText === "DELETE";

const handleDelete = async (e: React.FormEvent) => {
e.preventDefault();
if (!isDeleteEnabled) return;

setIsLoading(true);
setError(null);

Expand Down
25 changes: 25 additions & 0 deletions gridwalk-ui/src/app/workspace/[workspaceId]/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,28 @@ export interface CreateProjectModalProps {
onClose: () => void;
onSubmit: (name: string) => Promise<void>;
}

export interface DeleteProjectModalProps {
isOpen: boolean;
onClose: () => void;
projectName: string;
onConfirm: () => Promise<void>;
}

export interface AddWorkspaceMemberModalProps {
isOpen: boolean;
onClose: () => void;
onSubmit: (email: string, role: "Admin" | "Read") => Promise<void>;
}

export interface ViewWorkspaceConnectionsModalProps {
isOpen: boolean;
onClose: () => void;
workspaceId: string;
}

export interface ViewWorkspaceMemberModalProps {
isOpen: boolean;
onClose: () => void;
workspaceId: string;
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
"use client";
import React, { useEffect, useState } from "react";
import { Database, Loader2 } from "lucide-react";
import { ViewWorkspaceConnectionsModalProps } from "./types";
import {
getWorkspaceConnections,
type WorkspaceConnection,
} from "./actions/workspace/get_connections";

interface ViewWorkspaceConnectionsModalProps {
isOpen: boolean;
onClose: () => void;
workspaceId: string;
}

export const ViewWorkspaceConnectionsModal: React.FC<
ViewWorkspaceConnectionsModalProps
> = ({ isOpen, onClose, workspaceId }) => {
Expand Down
Loading

0 comments on commit ef515c0

Please sign in to comment.