Compare commits

...

10 Commits

Author SHA1 Message Date
mehedi-hasan a480eb930e feat: add login page 2024-05-06 10:59:53 +06:00
mehedi-hasan 05bda6a7a5 feat: edit commit page 2024-05-05 21:49:39 +06:00
mehedi-hasan 73c88598e7 feat: edit evaluation page 2024-05-05 21:36:03 +06:00
mehedi-hasan 3c068397d6 feat: edit skill page 2024-05-05 21:23:41 +06:00
mehedi-hasan 723ccc7919 feat: edit criteria page 2024-05-04 23:38:19 +06:00
mehedi-hasan cbc0cde9e8 feat: edit api communication page 2024-05-04 23:05:38 +06:00
mehedi-hasan df83c049c9 feat: edit configuration page 2024-05-03 20:49:43 +06:00
mehedi-hasan 3081b2fed7 feat: edit account page 2024-05-03 20:33:39 +06:00
mehedi-hasan 1c7f752f11 feat: organization edit page 2024-05-03 20:08:09 +06:00
mehedi-hasan 1a384dce5f feat: user edit page 2024-05-03 19:43:59 +06:00
40 changed files with 967 additions and 242 deletions

View File

@ -0,0 +1,76 @@
"use client";
import { Button } from "@/components/ui/button";
import {
Card,
CardContent,
CardDescription,
CardFooter,
CardHeader,
CardTitle,
} from "@/components/ui/card";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import { useRouter } from "next/navigation";
export default function Login() {
const router = useRouter();
return (
<div className="w-screen h-screen grid place-items-center">
<Card className="w-[400px]">
<CardHeader className="space-y-1">
<CardTitle className="text-2xl">Login</CardTitle>
<CardDescription>
Enter your email and password below to login
</CardDescription>
</CardHeader>
<CardContent className="grid gap-4">
{/* <div className="grid grid-cols-2 gap-6">
<Button variant="outline">
<Icons.gitHub className="mr-2 h-4 w-4" />
Github
</Button>
<Button variant="outline">
<Icons.google className="mr-2 h-4 w-4" />
Google
</Button>
</div> */}
{/* <div className="relative">
<div className="absolute inset-0 flex items-center">
<span className="w-full border-t" />
</div>
<div className="relative flex justify-center text-xs uppercase">
<span className="bg-background px-2 text-muted-foreground">
Or continue with
</span>
</div>
</div> */}
<div className="grid gap-2">
<Label htmlFor="email">Email</Label>
<Input
id="email"
type="email"
placeholder="Enter your email..."
defaultValue="johndoe@gmail.com"
/>
</div>
<div className="grid gap-2">
<Label htmlFor="password">Password</Label>
<Input
id="password"
type="password"
placeholder="Enter your password..."
defaultValue="123456"
/>
</div>
</CardContent>
<CardFooter>
<Button className="w-full" onClick={() => router.push("/dashboard")}>
Login
</Button>
</CardFooter>
</Card>
</div>
);
}

View File

@ -1,4 +1,6 @@
import AddAccountForm from "@/components/add-account-form";
"use client"
import AccountForm from "@/components/account-form";
import Breadcrumb from "@/components/breadcrumb";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area";
@ -10,25 +12,29 @@ const breadcrumbItems = [
{ title: "Add" },
];
export default function SettingsDisplayPage() {
export default function Page() {
return (
<ScrollArea className="h-[calc(100vh-53px)]">
<div className="flex-1 space-y-4 p-4 md:p-8 pt-6">
<div className="flex-1 space-y-4 p-4 md:p-8 pt-6">
<Breadcrumb items={breadcrumbItems} />
<div className="w-full h-full flex justify-center items-center">
<Card className="max-w-[700px] w-full">
<CardHeader>
<CardTitle className="mb-4 font-bold text-xl">
Create Account
</CardTitle>
<Separator />
</CardHeader>
<Card className="max-w-[700px] w-full">
<CardHeader>
<CardTitle className="mb-4 font-bold text-xl">
Create Account
</CardTitle>
<Separator />
</CardHeader>
<CardContent>
<AddAccountForm />
</CardContent>
</Card>
</div>
<CardContent>
<AccountForm
onSubmit={() => {}}
btn1_content="Create"
btn2_content="Create and add another"
/>
</CardContent>
</Card>
</div>
</div>
<ScrollBar />
</ScrollArea>

View File

@ -0,0 +1,48 @@
"use client";
import AccountForm from "@/components/account-form";
import Breadcrumb from "@/components/breadcrumb";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area";
import { Separator } from "@/components/ui/separator";
import { dummyAccounts } from "@/constants/data";
import { Account } from "@/types/account";
const breadcrumbItems = [
{ title: "Dashboard", link: "/dashboard" },
{ title: "Accounts", link: "/dashboard/accounts" },
{ title: "Edit" },
];
export default function Page({ params }: { params: { id: string } }) {
const account = dummyAccounts.find((account) => account.id === +params.id);
return (
<ScrollArea className="h-[calc(100vh-53px)]">
<div className="flex-1 space-y-4 p-4 md:p-8 pt-6">
<Breadcrumb items={breadcrumbItems} />
<div className="w-full h-full flex justify-center items-center">
<Card className="max-w-[700px] w-full">
<CardHeader>
<CardTitle className="mb-4 font-bold text-xl">
Edit Account
</CardTitle>
<Separator />
</CardHeader>
<CardContent>
<AccountForm
account={account as Account}
onSubmit={() => {}}
btn1_content="Save and continue editing"
btn2_content="Save changes"
/>
</CardContent>
</Card>
</div>
</div>
<ScrollBar />
</ScrollArea>
);
}

View File

@ -1,4 +1,6 @@
import AddAPICommunicationForm from "@/components/add-api-communication-form";
"use client";
import AddAPICommunicationForm from "@/components/api-communication-form";
import Breadcrumb from "@/components/breadcrumb";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area";
@ -10,7 +12,7 @@ const breadcrumbItems = [
{ title: "Add" },
];
export default function SettingsDisplayPage() {
export default function Page() {
return (
<ScrollArea className="h-[calc(100vh-53px)]">
<div className="flex-1 space-y-4 p-4 md:p-8 pt-6">
@ -25,7 +27,11 @@ export default function SettingsDisplayPage() {
</CardHeader>
<CardContent>
<AddAPICommunicationForm />
<AddAPICommunicationForm
onSubmit={() => {}}
btn1_content="Create"
btn2_content="Create and add another"
/>
</CardContent>
</Card>
</div>

View File

@ -0,0 +1,49 @@
"use client";
import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area";
import { Separator } from "@/components/ui/separator";
import Breadcrumb from "@/components/breadcrumb";
import { dummyApiCommunications } from "@/constants/data";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import APICommunicationForm from "@/components/api-communication-form";
import { ApiCommunication } from "@/types/api-communication";
const breadcrumbItems = [
{ title: "Dashboard", link: "/dashboard" },
{ title: "Api Communications", link: "/dashboard/api-communications" },
{ title: "Edit" },
];
export default function Page({ params }: { params: { id: string } }) {
const apiCommunication = dummyApiCommunications.find(
(apiCommunication) => apiCommunication.id === +params.id
);
return (
<ScrollArea className="h-[calc(100vh-53px)]">
<div className="flex-1 space-y-4 p-4 md:p-8 pt-6">
<Breadcrumb items={breadcrumbItems} />
<div className="w-full h-full flex justify-center items-center">
<Card className="max-w-[700px] w-full mb-8">
<CardHeader>
<CardTitle className="mb-4 font-bold text-xl">
Edit Api Communication
</CardTitle>
<Separator />
</CardHeader>
<CardContent>
<APICommunicationForm
apiCommunication={apiCommunication as ApiCommunication}
onSubmit={() => {}}
btn1_content="Save and continue editing"
btn2_content="Save changes"
/>
</CardContent>
</Card>
</div>
</div>
<ScrollBar />
</ScrollArea>
);
}

View File

@ -1,3 +1,5 @@
"use client"
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area";
import { Separator } from "@/components/ui/separator";
@ -10,7 +12,7 @@ const breadcrumbItems = [
{ title: "Create Commit" },
];
export default function SettingsDisplayPage() {
export default function Page() {
return (
<ScrollArea className="h-[calc(100vh-53px)]">
<div className="flex-1 space-y-4 p-4 md:p-8 pt-6">
@ -25,7 +27,11 @@ export default function SettingsDisplayPage() {
</CardHeader>
<CardContent>
<CommitForm />
<CommitForm
onSubmit={() => {}}
btn1_content="Create"
btn2_content="Create and add another"
/>
</CardContent>
</Card>
</div>

View File

@ -0,0 +1,48 @@
"use client";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area";
import { Separator } from "@/components/ui/separator";
import Breadcrumb from "@/components/breadcrumb";
import { dummyCommits } from "@/constants/data";
import { Commit } from "@/types/commit";
import CommitForm from "@/components/commit-form";
const breadcrumbItems = [
{ title: "Dashboard", link: "/dashboard" },
{ title: "Commits", link: "/dashboard/commits" },
{ title: "Edit" },
];
export default function Page({ params }: { params: { id: string } }) {
const commit = dummyCommits.find((commit) => commit.id === params.id);
console.log(commit)
return (
<ScrollArea className="h-[calc(100vh-53px)]">
<div className="flex-1 space-y-4 p-4 md:p-8 pt-6">
<Breadcrumb items={breadcrumbItems} />
<div className="w-full h-full flex justify-center items-center">
<Card className="max-w-[700px] w-full">
<CardHeader>
<CardTitle className="mb-4 font-bold text-xl">
Edit Commit
</CardTitle>
<Separator />
</CardHeader>
<CardContent>
<CommitForm
commit={commit as Commit}
onSubmit={() => {}}
btn1_content="Save and continue editing"
btn2_content="Save changes"
/>
</CardContent>
</Card>
</div>
</div>
<ScrollBar />
</ScrollArea>
);
}

View File

@ -1,7 +1,9 @@
"use client"
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area";
import { Separator } from "@/components/ui/separator";
import AddConfigurationForm from "@/components/add-configuration-form";
import ConfigurationForm from "@/components/configuration-form";
import Breadcrumb from "@/components/breadcrumb";
const breadcrumbItems = [
@ -10,25 +12,29 @@ const breadcrumbItems = [
{ title: "Add" },
];
export default function SettingsDisplayPage() {
export default function Page() {
return (
<ScrollArea className="h-[calc(100vh-53px)]">
<div className="flex-1 space-y-4 p-4 md:p-8 pt-6">
<div className="flex-1 space-y-4 p-4 md:p-8 pt-6">
<Breadcrumb items={breadcrumbItems} />
<div className="w-full h-full flex justify-center items-center">
<Card className="max-w-[700px] w-full">
<CardHeader>
<CardTitle className="mb-4 font-bold text-xl">
Create Configuration
</CardTitle>
<Separator />
</CardHeader>
<Card className="max-w-[700px] w-full">
<CardHeader>
<CardTitle className="mb-4 font-bold text-xl">
Create Configuration
</CardTitle>
<Separator />
</CardHeader>
<CardContent>
<AddConfigurationForm />
</CardContent>
</Card>
</div>
<CardContent>
<ConfigurationForm
onSubmit={() => {}}
btn1_content="Create"
btn2_content="Create and add another"
/>
</CardContent>
</Card>
</div>
</div>
<ScrollBar />
</ScrollArea>

View File

@ -0,0 +1,47 @@
"use client";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area";
import { Separator } from "@/components/ui/separator";
import ConfigurationForm from "@/components/configuration-form";
import Breadcrumb from "@/components/breadcrumb";
import { dummyConfigurations } from "@/constants/data";
import { Configuration } from "@/types/configuration";
const breadcrumbItems = [
{ title: "Dashboard", link: "/dashboard" },
{ title: "Configurations", link: "/dashboard/configurations" },
{ title: "Edit" },
];
export default function Page({ params }: { params: { id: string } }) {
const configuration = dummyConfigurations.find((configuration) => configuration.id === +params.id);
return (
<ScrollArea className="h-[calc(100vh-53px)]">
<div className="flex-1 space-y-4 p-4 md:p-8 pt-6">
<Breadcrumb items={breadcrumbItems} />
<div className="w-full h-full flex justify-center items-center">
<Card className="max-w-[700px] w-full">
<CardHeader>
<CardTitle className="mb-4 font-bold text-xl">
Edit Configuration
</CardTitle>
<Separator />
</CardHeader>
<CardContent>
<ConfigurationForm
configuration={configuration as Configuration}
onSubmit={() => {}}
btn1_content="Save and continue editing"
btn2_content="Save changes"
/>
</CardContent>
</Card>
</div>
</div>
<ScrollBar />
</ScrollArea>
);
}

View File

@ -1,9 +1,11 @@
"use client";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area";
import { Separator } from "@/components/ui/separator";
import AddCriteriaForm from "@/components/add-criteria-form";
import AddCriteriaForm from "@/components/criteria-form";
export default function SettingsDisplayPage() {
export default function Page() {
return (
<ScrollArea className="h-[calc(100vh-53px)]">
<div className="flex-1 space-y-4 p-4 md:p-8 pt-6 w-full h-full flex justify-center items-center">
@ -16,7 +18,11 @@ export default function SettingsDisplayPage() {
</CardHeader>
<CardContent>
<AddCriteriaForm />
<AddCriteriaForm
onSubmit={() => {}}
btn1_content="Save and continue editing"
btn2_content="Save changes"
/>
</CardContent>
</Card>
</div>

View File

@ -0,0 +1,55 @@
"use client";
import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area";
import { Separator } from "@/components/ui/separator";
import ConfigurationForm from "@/components/configuration-form";
import Breadcrumb from "@/components/breadcrumb";
import {
dummyApiCommunications,
dummyConfigurations,
dummyCriteria,
} from "@/constants/data";
import { Configuration } from "@/types/configuration";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import APICommunicationForm from "@/components/api-communication-form";
import { ApiCommunication } from "@/types/api-communication";
import CriteriaForm from "@/components/criteria-form";
import { Criteria } from "@/types/criteria";
const breadcrumbItems = [
{ title: "Dashboard", link: "/dashboard" },
{ title: "Api Communications", link: "/dashboard/api-communications" },
{ title: "Edit" },
];
export default function Page({ params }: { params: { id: string } }) {
const criteria = dummyCriteria.find((criteria) => criteria.id === +params.id);
return (
<ScrollArea className="h-[calc(100vh-53px)]">
<div className="flex-1 space-y-4 p-4 md:p-8 pt-6">
<Breadcrumb items={breadcrumbItems} />
<div className="w-full h-full flex justify-center items-center">
<Card className="max-w-[700px] w-full mb-8">
<CardHeader>
<CardTitle className="mb-4 font-bold text-xl">
Edit Criteria
</CardTitle>
<Separator />
</CardHeader>
<CardContent>
<CriteriaForm
criteria={criteria as Criteria}
onSubmit={() => {}}
btn1_content="Save and continue editing"
btn2_content="Save changes"
/>
</CardContent>
</Card>
</div>
</div>
<ScrollBar />
</ScrollArea>
);
}

View File

@ -1,8 +1,10 @@
"use client"
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area";
import { Separator } from "@/components/ui/separator";
import Breadcrumb from "@/components/breadcrumb";
import AddEvaluationForm from "@/components/evaluation-form";
import EvaluationForm from "@/components/evaluation-form";
const breadcrumbItems = [
{ title: "Dashboard", link: "/dashboard" },
@ -10,7 +12,7 @@ const breadcrumbItems = [
{ title: "Add" },
];
export default function SettingsDisplayPage() {
export default function Page() {
return (
<ScrollArea className="h-[calc(100vh-53px)]">
<div className="flex-1 space-y-4 p-4 md:p-8 pt-6">
@ -25,7 +27,11 @@ export default function SettingsDisplayPage() {
</CardHeader>
<CardContent>
<AddEvaluationForm/>
<EvaluationForm
onSubmit={() => {}}
btn1_content="Create"
btn2_content="Create and add another"
/>
</CardContent>
</Card>
</div>

View File

@ -0,0 +1,49 @@
"use client";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area";
import { Separator } from "@/components/ui/separator";
import Breadcrumb from "@/components/breadcrumb";
import EvaluationForm from "@/components/evaluation-form";
import { Evaluation } from "@/types/evaluation";
import { dummyEvaluations } from "@/constants/data";
const breadcrumbItems = [
{ title: "Dashboard", link: "/dashboard" },
{ title: "Evaluation", link: "/dashboard/evaluations" },
{ title: "Edit" },
];
export default function Page({ params }: { params: { id: string } }) {
const evaluation = dummyEvaluations.find(
(evaluation) => evaluation.id === +params.id
);
return (
<ScrollArea className="h-[calc(100vh-53px)]">
<div className="flex-1 space-y-4 p-4 md:p-8 pt-6">
<Breadcrumb items={breadcrumbItems} />
<div className="w-full h-full flex justify-center items-center">
<Card className="max-w-[700px] w-full">
<CardHeader>
<CardTitle className="mb-4 font-bold text-xl">
Edit Evaluation
</CardTitle>
<Separator />
</CardHeader>
<CardContent>
<EvaluationForm
evaluation={evaluation as Evaluation}
onSubmit={() => {}}
btn1_content="Save and continue editing"
btn2_content="Save changes"
/>
</CardContent>
</Card>
</div>
<ScrollBar />
</div>
</ScrollArea>
);
}

View File

@ -1,7 +1,9 @@
"use client";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area";
import { Separator } from "@/components/ui/separator";
import AddOrganizationForm from "@/components/add-organization-form";
import OrganizationForm from "@/components/organization-form";
import Breadcrumb from "@/components/breadcrumb";
const breadcrumbItems = [
@ -10,7 +12,7 @@ const breadcrumbItems = [
{ title: "Add" },
];
export default function SettingsDisplayPage() {
export default function Page() {
return (
<ScrollArea className="h-[calc(100vh-53px)]">
<div className="flex-1 space-y-4 p-4 md:p-8 pt-6">
@ -25,7 +27,11 @@ export default function SettingsDisplayPage() {
</CardHeader>
<CardContent>
<AddOrganizationForm />
<OrganizationForm
onSubmit={() => {}}
btn1_content="Create"
btn2_content="Create and add another"
/>
</CardContent>
</Card>
</div>

View File

@ -0,0 +1,46 @@
"use client"
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area";
import { Separator } from "@/components/ui/separator";
import OrganizationForm from "@/components/organization-form";
import Breadcrumb from "@/components/breadcrumb";
import { dummyOrganizations } from "@/constants/data";
import { Organization } from "@/types/organization";
const breadcrumbItems = [
{ title: "Dashboard", link: "/dashboard" },
{ title: "Organizations", link: "/dashboard/organizations" },
{ title: "Edit" },
];
export default function Page({ params }: { params: { id: string } }) {
const organization = dummyOrganizations.find((organization) => organization.id === +params.id);
return (
<ScrollArea className="h-[calc(100vh-53px)]">
<div className="flex-1 space-y-4 p-4 md:p-8 pt-6">
<Breadcrumb items={breadcrumbItems} />
<div className="w-full h-full flex justify-center items-center">
<Card className="max-w-[700px] w-full">
<CardHeader>
<CardTitle className="mb-4 font-bold text-xl">
Edit Organization
</CardTitle>
<Separator />
</CardHeader>
<CardContent>
<OrganizationForm organization={organization as Organization}
onSubmit={() => {}}
btn1_content="Save and continue editing"
btn2_content="Save changes" />
</CardContent>
</Card>
</div>
</div>
<ScrollBar />
</ScrollArea>
);
}

View File

@ -1,7 +1,9 @@
"use client";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area";
import { Separator } from "@/components/ui/separator";
import AddSkillForm from "@/components/add-skill-form";
import SkillForm from "@/components/skill-form";
import Breadcrumb from "@/components/breadcrumb";
const breadcrumbItems = [
@ -10,7 +12,7 @@ const breadcrumbItems = [
{ title: "Add" },
];
export default function SettingsDisplayPage() {
export default function Page() {
return (
<ScrollArea className="h-[calc(100vh-53px)]">
<div className="flex-1 space-y-4 p-4 md:p-8 pt-6">
@ -25,7 +27,11 @@ export default function SettingsDisplayPage() {
</CardHeader>
<CardContent>
<AddSkillForm />
<SkillForm
onSubmit={() => {}}
btn1_content="Create"
btn2_content="Create and add another"
/>
</CardContent>
</Card>
</div>

View File

@ -0,0 +1,47 @@
"use client";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area";
import { Separator } from "@/components/ui/separator";
import SkillForm from "@/components/skill-form";
import Breadcrumb from "@/components/breadcrumb";
import { dummySkills } from "@/constants/data";
import { Skill } from "@/types/skill";
const breadcrumbItems = [
{ title: "Dashboard", link: "/dashboard" },
{ title: "Skills", link: "/dashboard/skills" },
{ title: "Edit" },
];
export default function Page({ params }: { params: { id: string } }) {
const skill = dummySkills.find((skill) => skill.id === +params.id);
return (
<ScrollArea className="h-[calc(100vh-53px)]">
<div className="flex-1 space-y-4 p-4 md:p-8 pt-6">
<Breadcrumb items={breadcrumbItems} />
<div className="w-full h-full flex justify-center items-center">
<Card className="max-w-[700px] w-full">
<CardHeader>
<CardTitle className="mb-4 font-bold text-xl">
Edit Skill
</CardTitle>
<Separator />
</CardHeader>
<CardContent>
<SkillForm
skill={skill as Skill}
onSubmit={() => {}}
btn1_content="Save and continue editing"
btn2_content="Save changes"
/>
</CardContent>
</Card>
</div>
<ScrollBar />
</div>
</ScrollArea>
);
}

View File

@ -1,13 +1,8 @@
import AddUserForm from "@/components/add-user-form";
"use client";
import UserForm from "@/components/user-form";
import Breadcrumb from "@/components/breadcrumb";
import { Button } from "@/components/ui/button";
import {
Card,
CardContent,
CardFooter,
CardHeader,
CardTitle,
} from "@/components/ui/card";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area";
import { Separator } from "@/components/ui/separator";
@ -17,24 +12,28 @@ const breadcrumbItems = [
{ title: "Add" },
];
export default function SettingsDisplayPage() {
export default function Page() {
return (
<ScrollArea className="h-[calc(100vh-53px)]">
<div className="flex-1 space-y-4 p-4 md:p-8 pt-6">
<Breadcrumb items={breadcrumbItems} />
<Breadcrumb items={breadcrumbItems} />
<div className="w-full h-full flex justify-center items-center">
<Card className="max-w-[700px] w-full mb-8">
<CardHeader>
<CardTitle className="mb-4 font-bold text-xl">
Create User
</CardTitle>
<Separator />
</CardHeader>
<Card className="max-w-[700px] w-full mb-8">
<CardHeader>
<CardTitle className="mb-4 font-bold text-xl">
Create User
</CardTitle>
<Separator />
</CardHeader>
<CardContent>
<AddUserForm />
</CardContent>
</Card>
<CardContent>
<UserForm
onSubmit={() => {}}
btn1_content="Create"
btn2_content="Create and add another"
/>
</CardContent>
</Card>
</div>
</div>
<ScrollBar />

View File

@ -0,0 +1,49 @@
"use client";
import UserForm from "@/components/user-form";
import Breadcrumb from "@/components/breadcrumb";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area";
import { Separator } from "@/components/ui/separator";
import { dummyUsers } from "@/constants/data";
import { User } from "@/types/user";
const breadcrumbItems = [
{ title: "Dashboard", link: "/dashboard" },
{ title: "Users", link: "/dashboard/users" },
{ title: "Edit" },
];
export default function Page({ params }: { params: { id: string } }) {
const user = dummyUsers.find((user) => user.id === +params.id);
return (
<ScrollArea className="h-[calc(100vh-53px)]">
<div className="flex-1 space-y-4 p-4 md:p-8 pt-6">
<Breadcrumb items={breadcrumbItems} />
<div className="w-full h-full flex justify-center items-center">
<Card className="max-w-[700px] w-full mb-8">
<CardHeader>
<CardTitle className="mb-4 font-bold text-xl">
Edit User
</CardTitle>
<Separator />
</CardHeader>
<CardContent>
<UserForm
user={user as User}
onSubmit={() => {}}
btn1_content="Save and continue editing"
btn2_content="Save changes"
/>
</CardContent>
</Card>
</div>
</div>
<ScrollBar />
</ScrollArea>
);
}

View File

@ -22,20 +22,15 @@ import {
SelectTrigger,
SelectValue,
} from "./ui/select";
import { Account } from "@/types/account";
const displayFormSchema = z.object({
email: z
.string({
required_error: "Please select a user.",
})
.trim()
.email(),
email: z.string().trim().min(1, { message: "Please select a user." }).email(),
balance: z.string().trim().min(1, "Balance is required."),
organization: z
.string({
required_error: "Please select an organization.",
})
.trim(),
.string()
.trim()
.min(1, { message: "Please select an organization." }),
});
type DisplayFormValues = z.infer<typeof displayFormSchema>;
@ -47,10 +42,26 @@ const defaultValues: Partial<DisplayFormValues> = {
organization: "",
};
export default function AddAccountForm() {
type Props = {
account?: Account;
onSubmit: () => void;
btn1_content: string;
btn2_content: string;
};
export default function AccountForm({
account,
onSubmit: onFormSubmit,
btn1_content,
btn2_content,
}: Props) {
const form = useForm<DisplayFormValues>({
resolver: zodResolver(displayFormSchema),
defaultValues,
defaultValues: {
balance: account?.balance ? String(account?.balance) : "",
email: account?.email || "",
organization: account?.organization || "",
},
});
function onSubmit(data: DisplayFormValues) {
@ -73,21 +84,19 @@ export default function AddAccountForm() {
render={({ field }) => (
<FormItem>
<FormLabel>User</FormLabel>
<Select onValueChange={field.onChange} defaultValue={field.value}>
<Select onValueChange={field.onChange} value={field.value}>
<FormControl>
<SelectTrigger>
<SelectValue placeholder="Select a user" />
</SelectTrigger>
</FormControl>
<SelectContent>
<SelectItem value="johndoe@gmail.com">
johndoe@gmail.com
<SelectItem value="john@gmail.com">john@gmail.com</SelectItem>
<SelectItem value="sarah@example.com">
sarah@example.com
</SelectItem>
<SelectItem value="adramov@gmail.com">
adramov@gmail.com
</SelectItem>
<SelectItem value="hello@gmail.com">
hello@gmail.com
<SelectItem value="michael@example.com">
michael@example.com
</SelectItem>
</SelectContent>
</Select>
@ -123,8 +132,11 @@ export default function AddAccountForm() {
</SelectTrigger>
</FormControl>
<SelectContent>
<SelectItem value="Skilld">Skilld</SelectItem>
<SelectItem value="Ecareers">Ecareers</SelectItem>
<SelectItem value="XYZ Tech Inc.">XYZ Tech Inc.</SelectItem>
<SelectItem value="ABC Solutions">ABC Solutions</SelectItem>
<SelectItem value="Acme Corporation">
Acme Corporation
</SelectItem>
</SelectContent>
</Select>
<FormMessage />
@ -134,10 +146,10 @@ export default function AddAccountForm() {
<div className="flex items-center gap-4 flex-col sm:flex-row">
<Button className="w-full" size="lg">
Create
{btn1_content}
</Button>
<Button variant="secondary" className="w-full" size="lg">
Create and add another
{btn2_content}
</Button>
</div>
</form>

View File

@ -14,6 +14,7 @@ import { Organization } from "@/types/organization";
import { User } from "@/types/user";
import { BookCheck, Edit, MoreHorizontal, Trash } from "lucide-react";
import Link from "next/link";
import { useRouter } from "next/navigation";
import { useState } from "react";
@ -49,14 +50,15 @@ export const CellAction: React.FC<CellActionProps> = ({ data }) => {
<DropdownMenuContent align="end">
<DropdownMenuLabel>Actions</DropdownMenuLabel>
<DropdownMenuItem
className="cursor-pointer"
// onClick={() =>
// router.push(`#`)
// }
>
<Edit className="mr-2 h-4 w-4" /> Update
<DropdownMenuItem className="cursor-pointer p-0">
<Link
href={`/dashboard/accounts/edit/${data.id}`}
className="flex items-center gap-2 px-2 py-1.5 w-full"
>
<Edit className="h-4 w-4" /> Edit
</Link>
</DropdownMenuItem>
<DropdownMenuItem
className="cursor-pointer"
onClick={() => setIsDeleteModalOpen(true)}

View File

@ -23,6 +23,7 @@ import {
SelectValue,
} from "./ui/select";
import { Textarea } from "./ui/textarea";
import { ApiCommunication } from "@/types/api-communication";
const displayFormSchema = z.object({
pt: z
@ -77,22 +78,43 @@ const displayFormSchema = z.object({
type DisplayFormValues = z.infer<typeof displayFormSchema>;
// This can come from your database or API.
const defaultValues: Partial<DisplayFormValues> = {
pt: "",
messages: "",
completion: "",
ct: "",
tt: "",
status: "",
type: "",
evaluation: "",
// // This can come from your database or API.
// const defaultValues: Partial<DisplayFormValues> = {
// pt: "",
// messages: "",
// completion: "",
// ct: "",
// tt: "",
// status: "",
// type: "",
// evaluation: "",
// };
type Props = {
apiCommunication?: ApiCommunication;
onSubmit: () => void;
btn1_content: string;
btn2_content: string;
};
export default function AddAPICommunicationForm() {
export default function APICommunicationForm({
apiCommunication,
onSubmit: onFormSubmit,
btn1_content,
btn2_content,
}: Props) {
const form = useForm<DisplayFormValues>({
resolver: zodResolver(displayFormSchema),
defaultValues,
defaultValues: {
pt: apiCommunication?.pt ? String(apiCommunication.pt) : "",
messages: apiCommunication?.messages || "",
completion: apiCommunication?.completion || "",
ct: apiCommunication?.ct ? String(apiCommunication.ct) : "",
tt: apiCommunication?.tt ? String(apiCommunication.tt) : "",
status: apiCommunication?.status || "",
type: apiCommunication?.type || "",
evaluation: apiCommunication?.evaluation || "",
},
});
function onSubmit(data: DisplayFormValues) {
@ -104,6 +126,8 @@ export default function AddAPICommunicationForm() {
</pre>
),
});
onFormSubmit();
}
return (
@ -215,11 +239,12 @@ export default function AddAPICommunicationForm() {
</SelectTrigger>
</FormControl>
<SelectContent>
<SelectItem value="Uploaded at: 2023-09-20 00:00:00 - Uploader: jschultz@php.net - Developer: fabien@potencier.org - Status: finished">
<SelectItem className="truncate" value="Uploaded at: 2023-09-20 00:00:00 - Uploader: jschultz@php.net - Developer: fabien@potencier.org - Status: finished">
Uploaded at: 2023-09-20 00:00:00 - Uploader:
jschultz@php.net - Developer: fabien@potencier.org - Status:
finished
</SelectItem>
</SelectContent>
</Select>
<FormMessage />
@ -229,10 +254,10 @@ export default function AddAPICommunicationForm() {
<div className="flex items-center gap-4 flex-col sm:flex-row">
<Button className="w-full" size="lg">
Create
{btn1_content}
</Button>
<Button variant="secondary" className="w-full" size="lg">
Create and add another
{btn2_content}
</Button>
</div>
</form>

View File

@ -12,6 +12,7 @@ import { useToast } from "@/components/ui/use-toast";
import { ApiCommunication } from "@/types/api-communication";
import { Edit, MoreHorizontal, Trash } from "lucide-react";
import Link from "next/link";
import { useRouter } from "next/navigation";
import { useState } from "react";
@ -47,13 +48,13 @@ export const CellAction: React.FC<CellActionProps> = ({ data }) => {
<DropdownMenuContent align="end">
<DropdownMenuLabel>Actions</DropdownMenuLabel>
<DropdownMenuItem
className="cursor-pointer"
// onClick={() =>
// router.push(`#`)
// }
>
<Edit className="mr-2 h-4 w-4" /> Update
<DropdownMenuItem className="cursor-pointer p-0">
<Link
href={`/dashboard/api-communications/edit/${data.id}`}
className="flex items-center gap-2 px-2 py-1.5 w-full"
>
<Edit className="h-4 w-4" /> Edit
</Link>
</DropdownMenuItem>
<DropdownMenuItem
className="cursor-pointer"

View File

@ -27,6 +27,7 @@ import {
import { cn } from "@/lib/utils";
import { CommandList } from "cmdk";
import { useState } from "react";
import { Commit } from "@/types/commit";
const statuses = [
"new",
@ -69,14 +70,34 @@ const defaultValues: Partial<DisplayFormValues> = {
commitDate: "",
};
export default function CommitForm() {
type Props = {
commit?: Commit;
onSubmit: () => void;
btn1_content: string;
btn2_content: string;
};
export default function CommitForm({
commit,
onSubmit: onFormSubmit,
btn1_content,
btn2_content,
}: Props) {
const [isStatusPopoverOpen, setIsStatusPopoverOpen] = useState(false);
const [isTypePopoverOpen, setIsTypePopoverOpen] = useState(false);
const [isEvaluationPopoverOpen, setIsEvaluationPopoverOpen] = useState(false);
const form = useForm<DisplayFormValues>({
resolver: zodResolver(displayFormSchema),
defaultValues,
defaultValues: {
id: commit?.id || "",
hash: commit?.hash || "",
status: commit?.status || "",
retryCount: commit?.retryCount || "",
type: commit?.type || "",
evaluation: commit?.evaluation || "",
commitDate: commit?.commitDate || "",
},
});
function onSubmit(data: DisplayFormValues) {
@ -88,6 +109,8 @@ export default function CommitForm() {
</pre>
),
});
onFormSubmit();
}
return (
@ -348,10 +371,10 @@ export default function CommitForm() {
<div className="flex items-center gap-4 flex-col sm:flex-row">
<Button className="w-full" size="lg">
Create
{btn1_content}
</Button>
<Button variant="secondary" className="w-full" size="lg">
Create and add another
{btn2_content}
</Button>
</div>
</form>

View File

@ -16,6 +16,7 @@ import { EvaluationStart } from "@/types/evaluation-start";
import { Skill } from "@/types/skill";
import { Edit, GitCommit, MoreHorizontal, Trash } from "lucide-react";
import Link from "next/link";
import { useRouter } from "next/navigation";
import { useState } from "react";
@ -51,13 +52,13 @@ export const CellAction: React.FC<CellActionProps> = ({ data }) => {
<DropdownMenuContent align="end">
<DropdownMenuLabel>Actions</DropdownMenuLabel>
<DropdownMenuItem
className="cursor-pointer"
// onClick={() =>
// router.push(`#`)
// }
>
<Edit className="mr-2 h-4 w-4" /> Edit
<DropdownMenuItem className="cursor-pointer p-0">
<Link
href={`/dashboard/commits/edit/${data.id}`}
className="flex items-center gap-2 px-2 py-1.5 w-full"
>
<Edit className="h-4 w-4" /> Edit
</Link>
</DropdownMenuItem>
<DropdownMenuItem
className="cursor-pointer"

View File

@ -15,6 +15,7 @@ import {
} from "@/components/ui/form";
import { toast } from "@/components/ui/use-toast";
import { Input } from "./ui/input";
import { Configuration } from "@/types/configuration";
const displayFormSchema = z.object({
name: z.string().trim().min(1, "Name is required."),
@ -23,16 +24,25 @@ const displayFormSchema = z.object({
type DisplayFormValues = z.infer<typeof displayFormSchema>;
// This can come from your database or API.
const defaultValues: Partial<DisplayFormValues> = {
name: "",
value: "",
type Props = {
configuration?: Configuration;
onSubmit: () => void;
btn1_content: string;
btn2_content: string;
};
export default function AddConfigurationForm() {
export default function ConfigurationForm({
configuration,
onSubmit: onFormSubmit,
btn1_content,
btn2_content,
}: Props) {
const form = useForm<DisplayFormValues>({
resolver: zodResolver(displayFormSchema),
defaultValues,
defaultValues: {
name: configuration?.name || "",
value: configuration?.value || "",
},
});
function onSubmit(data: DisplayFormValues) {
@ -78,10 +88,10 @@ export default function AddConfigurationForm() {
<div className="flex items-center gap-4 flex-col sm:flex-row">
<Button className="w-full" size="lg">
Create
{btn1_content}
</Button>
<Button variant="secondary" className="w-full" size="lg">
Create and add another
{btn2_content}
</Button>
</div>
</form>

View File

@ -12,6 +12,7 @@ import { useToast } from "@/components/ui/use-toast";
import { Configuration } from "@/types/configuration";
import { BookCheck, Edit, MoreHorizontal, Trash } from "lucide-react";
import Link from "next/link";
import { useRouter } from "next/navigation";
import { useState } from "react";
@ -47,13 +48,13 @@ export const CellAction: React.FC<CellActionProps> = ({ data }) => {
<DropdownMenuContent align="end">
<DropdownMenuLabel>Actions</DropdownMenuLabel>
<DropdownMenuItem
className="cursor-pointer"
// onClick={() =>
// router.push(`#`)
// }
>
<Edit className="mr-2 h-4 w-4" /> Update
<DropdownMenuItem className="cursor-pointer p-0">
<Link
href={`/dashboard/configurations/edit/${data.id}`}
className="flex items-center gap-2 px-2 py-1.5 w-full"
>
<Edit className="h-4 w-4" /> Edit
</Link>
</DropdownMenuItem>
<DropdownMenuItem
className="cursor-pointer"

View File

@ -16,6 +16,7 @@ import {
import { toast } from "@/components/ui/use-toast";
import { Input } from "./ui/input";
import { Textarea } from "./ui/textarea";
import { Criteria } from "@/types/criteria";
const displayFormSchema = z.object({
name: z.string().trim().min(1, "Name is required."),
@ -25,17 +26,33 @@ const displayFormSchema = z.object({
type DisplayFormValues = z.infer<typeof displayFormSchema>;
// This can come from your database or API.
const defaultValues: Partial<DisplayFormValues> = {
name: "",
description: "",
prompt: "",
// // This can come from your database or API.
// const defaultValues: Partial<DisplayFormValues> = {
// name: "",
// description: "",
// prompt: "",
// };
type Props = {
criteria?: Criteria;
onSubmit: () => void;
btn1_content: string;
btn2_content: string;
};
export default function AddCriteriaForm() {
export default function CriteriaForm({
criteria,
onSubmit: onFormSubmit,
btn1_content,
btn2_content,
}: Props) {
const form = useForm<DisplayFormValues>({
resolver: zodResolver(displayFormSchema),
defaultValues,
defaultValues: {
name: criteria?.name || "",
description: criteria?.description || "",
prompt: criteria?.prompt || "",
},
});
function onSubmit(data: DisplayFormValues) {
@ -47,6 +64,8 @@ export default function AddCriteriaForm() {
</pre>
),
});
onFormSubmit();
}
return (
@ -94,10 +113,10 @@ export default function AddCriteriaForm() {
<div className="flex items-center gap-4 flex-col sm:flex-row">
<Button className="w-full" size="lg">
Create
{btn1_content}
</Button>
<Button variant="secondary" className="w-full" size="lg">
Create and add another
{btn2_content}
</Button>
</div>
</form>

View File

@ -13,6 +13,7 @@ import { Criteria } from "@/types/criteria";
import { EvaluationStart } from "@/types/evaluation-start";
import { Edit, GitCommit, MoreHorizontal, Trash } from "lucide-react";
import Link from "next/link";
import { useRouter } from "next/navigation";
import { useState } from "react";
@ -48,13 +49,13 @@ export const CellAction: React.FC<CellActionProps> = ({ data }) => {
<DropdownMenuContent align="end">
<DropdownMenuLabel>Actions</DropdownMenuLabel>
<DropdownMenuItem
className="cursor-pointer"
// onClick={() =>
// router.push(`#`)
// }
>
<Edit className="mr-2 h-4 w-4" /> Edit
<DropdownMenuItem className="cursor-pointer p-0">
<Link
href={`/dashboard/criteria/edit/${data.id}`}
className="flex items-center gap-2 px-2 py-1.5 w-full"
>
<Edit className="h-4 w-4" /> Edit
</Link>
</DropdownMenuItem>
<DropdownMenuItem
className="cursor-pointer"

View File

@ -27,6 +27,7 @@ import {
import { cn } from "@/lib/utils";
import { CommandList } from "cmdk";
import { useState } from "react";
import { Evaluation } from "@/types/evaluation";
const statuses = [
"uploading",
@ -43,8 +44,8 @@ const statuses = [
"evaluation_failed",
] as const;
const uploaders = ["hello@skilld.team", "johndoe@gmail.com"] as const;
const developers = ["hello@skilld.team", "johndoe@gmail.com"] as const;
const uploaders = ["johndoe@gmail.com", "danabramov@gmail.com"] as const;
const developers = ["danabramov@gmail.com", "johndoe@gmail.com"] as const;
const displayFormSchema = z.object({
status: z.string().trim().min(1, "Status is required"),
@ -65,22 +66,38 @@ const displayFormSchema = z.object({
type DisplayFormValues = z.infer<typeof displayFormSchema>;
// This can come from your database or API.
const defaultValues: Partial<DisplayFormValues> = {
status: "",
uploadTime: "",
uploaderAccount: "",
developerUser: "",
// const defaultValues: Partial<DisplayFormValues> = {
// status: "",
// uploadTime: "",
// uploaderAccount: "",
// developerUser: "",
// };
type Props = {
evaluation?: Evaluation;
onSubmit: () => void;
btn1_content: string;
btn2_content: string;
};
export default function AddEvaluationForm() {
export default function EvaluationForm({
evaluation,
onSubmit: onFormSubmit,
btn1_content,
btn2_content,
}: Props) {
const [isStatusPopoverOpen, setIsStatusPopoverOpen] = useState(false);
const [isUploaderPopoverOpen, setIsUploaderPopoverOpen] = useState(false);
const [isDeveloperPopoverOpen, setIsDeveloperPopoverOpen] = useState(false);
const form = useForm<DisplayFormValues>({
resolver: zodResolver(displayFormSchema),
defaultValues,
defaultValues: {
status: evaluation?.status || "",
uploadTime: evaluation?.uploadTime || "",
uploaderAccount: evaluation?.uploaderAccount || "",
developerUser: evaluation?.developerUser || "",
},
});
function onSubmit(data: DisplayFormValues) {
@ -92,6 +109,8 @@ export default function AddEvaluationForm() {
</pre>
),
});
onFormSubmit();
}
return (
@ -312,10 +331,10 @@ export default function AddEvaluationForm() {
<div className="flex items-center gap-4 flex-col sm:flex-row">
<Button className="w-full" size="lg">
Create
{btn1_content}
</Button>
<Button variant="secondary" className="w-full" size="lg">
Create and add another
{btn2_content}
</Button>
</div>
</form>

View File

@ -15,6 +15,7 @@ import { EvaluationStart } from "@/types/evaluation-start";
import { Skill } from "@/types/skill";
import { Edit, GitCommit, MoreHorizontal, Trash } from "lucide-react";
import Link from "next/link";
import { useRouter } from "next/navigation";
import { useState } from "react";
@ -50,13 +51,13 @@ export const CellAction: React.FC<CellActionProps> = ({ data }) => {
<DropdownMenuContent align="end">
<DropdownMenuLabel>Actions</DropdownMenuLabel>
<DropdownMenuItem
className="cursor-pointer"
// onClick={() =>
// router.push(`#`)
// }
>
<Edit className="mr-2 h-4 w-4" /> Edit
<DropdownMenuItem className="cursor-pointer p-0">
<Link
href={`/dashboard/evaluations/edit/${data.id}`}
className="flex items-center gap-2 px-2 py-1.5 w-full"
>
<Edit className="h-4 w-4" /> Edit
</Link>
</DropdownMenuItem>
<DropdownMenuItem
className="cursor-pointer"

View File

@ -15,6 +15,7 @@ import {
} from "@/components/ui/form";
import { toast } from "@/components/ui/use-toast";
import { Input } from "./ui/input";
import { Organization } from "@/types/organization";
const displayFormSchema = z.object({
name: z.string().trim().min(1, "Name is required."),
@ -27,10 +28,23 @@ const defaultValues: Partial<DisplayFormValues> = {
name: "",
};
export default function AddSkillForm() {
type Props = {
organization?: Organization;
onSubmit: () => void;
btn1_content: string;
btn2_content: string;
};
export default function OrganizationForm({
organization,
onSubmit: onFormSubmit,
btn1_content,
btn2_content,
}: Props) {
const form = useForm<DisplayFormValues>({
resolver: zodResolver(displayFormSchema),
defaultValues,
defaultValues: {
name: organization?.name || "",
},
});
function onSubmit(data: DisplayFormValues) {
@ -42,6 +56,8 @@ export default function AddSkillForm() {
</pre>
),
});
onFormSubmit();
}
return (
@ -63,10 +79,10 @@ export default function AddSkillForm() {
<div className="flex items-center gap-4 flex-col sm:flex-row">
<Button className="w-full" size="lg">
Create
{btn1_content}
</Button>
<Button variant="secondary" className="w-full" size="lg">
Create and add another
{btn2_content}
</Button>
</div>
</form>

View File

@ -13,6 +13,7 @@ import { Organization } from "@/types/organization";
import { User } from "@/types/user";
import { BookCheck, Edit, MoreHorizontal, Trash } from "lucide-react";
import Link from "next/link";
import { useRouter } from "next/navigation";
import { useState } from "react";
@ -48,13 +49,13 @@ export const CellAction: React.FC<CellActionProps> = ({ data }) => {
<DropdownMenuContent align="end">
<DropdownMenuLabel>Actions</DropdownMenuLabel>
<DropdownMenuItem
className="cursor-pointer"
// onClick={() =>
// router.push(`#`)
// }
>
<Edit className="mr-2 h-4 w-4" /> Update
<DropdownMenuItem className="cursor-pointer p-0">
<Link
href={`/dashboard/organizations/edit/${data.id}`}
className="flex items-center gap-2 px-2 py-1.5 w-full"
>
<Edit className="h-4 w-4" /> Edit
</Link>
</DropdownMenuItem>
<DropdownMenuItem
className="cursor-pointer"

View File

@ -15,6 +15,7 @@ import {
} from "@/components/ui/form";
import { toast } from "@/components/ui/use-toast";
import { Input } from "./ui/input";
import { Skill } from "@/types/skill";
const displayFormSchema = z.object({
name: z.string().trim().min(1, "Name is required."),
@ -22,15 +23,28 @@ const displayFormSchema = z.object({
type DisplayFormValues = z.infer<typeof displayFormSchema>;
// This can come from your database or API.
const defaultValues: Partial<DisplayFormValues> = {
name: "",
// const defaultValues: Partial<DisplayFormValues> = {
// name: "",
// };
type Props = {
skill?: Skill;
onSubmit: () => void;
btn1_content: string;
btn2_content: string;
};
export default function AddOrganizationForm() {
export default function SkillForm({
skill,
onSubmit: onFormSubmit,
btn1_content,
btn2_content,
}: Props) {
const form = useForm<DisplayFormValues>({
resolver: zodResolver(displayFormSchema),
defaultValues,
defaultValues: {
name: skill?.name || "",
},
});
function onSubmit(data: DisplayFormValues) {
@ -63,10 +77,10 @@ export default function AddOrganizationForm() {
<div className="flex items-center gap-4 flex-col sm:flex-row">
<Button className="w-full" size="lg">
Create
{btn1_content}
</Button>
<Button variant="secondary" className="w-full" size="lg">
Create and add another
{btn2_content}
</Button>
</div>
</form>

View File

@ -14,6 +14,7 @@ import { EvaluationStart } from "@/types/evaluation-start";
import { Skill } from "@/types/skill";
import { Edit, GitCommit, MoreHorizontal, Trash } from "lucide-react";
import Link from "next/link";
import { useRouter } from "next/navigation";
import { useState } from "react";
@ -49,13 +50,13 @@ export const CellAction: React.FC<CellActionProps> = ({ data }) => {
<DropdownMenuContent align="end">
<DropdownMenuLabel>Actions</DropdownMenuLabel>
<DropdownMenuItem
className="cursor-pointer"
// onClick={() =>
// router.push(`#`)
// }
>
<Edit className="mr-2 h-4 w-4" /> Edit
<DropdownMenuItem className="cursor-pointer p-0">
<Link
href={`/dashboard/skills/edit/${data.id}`}
className="flex items-center gap-2 px-2 py-1.5 w-full"
>
<Edit className="h-4 w-4" /> Edit
</Link>
</DropdownMenuItem>
<DropdownMenuItem
className="cursor-pointer"

View File

@ -17,6 +17,7 @@ import {
} from "@/components/ui/form";
import { toast } from "@/components/ui/use-toast";
import { Input } from "./ui/input";
import { User } from "@/types/user";
const roles = [
{
@ -61,17 +62,26 @@ const displayFormSchema = z.object({
type DisplayFormValues = z.infer<typeof displayFormSchema>;
// This can come from your database or API.
const defaultValues: Partial<DisplayFormValues> = {
fullName: "",
email: "",
roles: ["ROLE_USER"],
type Props = {
user?: User;
onSubmit: () => void;
btn1_content: string;
btn2_content: string;
};
export default function AddUserForm() {
export default function UserForm({
user,
onSubmit: onFormSubmit,
btn1_content,
btn2_content,
}: Props) {
const form = useForm<DisplayFormValues>({
resolver: zodResolver(displayFormSchema),
defaultValues,
defaultValues: {
fullName: user?.fullName || "",
email: user?.email || "",
roles: [user?.role || "ROLE_USER"],
},
});
function onSubmit(data: DisplayFormValues) {
@ -91,6 +101,8 @@ export default function AddUserForm() {
</pre>
),
});
onFormSubmit();
}
return (
@ -211,10 +223,10 @@ export default function AddUserForm() {
/>
<div className="flex items-center gap-4 flex-col sm:flex-row">
<Button className="w-full" size="lg">
Create
{btn1_content}
</Button>
<Button variant="secondary" className="w-full" size="lg">
Create and add another
{btn2_content}
</Button>
</div>
</form>

View File

@ -11,7 +11,8 @@ import {
import { useToast } from "@/components/ui/use-toast";
import { User } from "@/types/user";
import { BookCheck, Edit, MoreHorizontal, Trash } from "lucide-react";
import { Edit, MoreHorizontal, Trash, UserCheck } from "lucide-react";
import Link from "next/link";
import { useRouter } from "next/navigation";
import { useState } from "react";
@ -27,7 +28,8 @@ export const CellAction: React.FC<CellActionProps> = ({ data }) => {
const onDeleteConfirm = async () => {};
const handleUpdateStatus = async () => {};
console.log(data)
return (
<>
@ -47,13 +49,17 @@ export const CellAction: React.FC<CellActionProps> = ({ data }) => {
<DropdownMenuContent align="end">
<DropdownMenuLabel>Actions</DropdownMenuLabel>
<DropdownMenuItem
className="cursor-pointer"
// onClick={() =>
// router.push(`#`)
// }
>
<Edit className="mr-2 h-4 w-4" /> Update
<DropdownMenuItem className="cursor-pointer">
<UserCheck className="mr-2 h-4 w-4" /> Approve User
</DropdownMenuItem>
<DropdownMenuItem className="cursor-pointer p-0">
<Link
href={`/dashboard/users/edit/${data.id}`}
className="flex items-center gap-2 px-2 py-1.5 w-full"
>
<Edit className="h-4 w-4" /> Edit
</Link>
</DropdownMenuItem>
<DropdownMenuItem
className="cursor-pointer"

View File

@ -9,28 +9,27 @@ import { Organization } from "@/types/organization";
import { Skill } from "@/types/skill";
import { User } from "@/types/user";
import { UserRound, UserRoundCheck } from "lucide-react";
import { number } from "zod";
export const dummyUsers: User[] = [
{
id: 1,
email: "john@gmail.com",
fullName: "John Doe",
role: "ADMIN",
role: "ROLE_ADMIN",
created_at: new Date().toISOString(),
},
{
id: 2,
email: "linustorvalds@gmail.com",
fullName: "Linus Torvalds",
role: "USER",
role: "ROLE_USER",
created_at: new Date().toISOString(),
},
{
id: 3,
email: "ryandahl@gmail.com",
fullName: "Ryan Dahl",
role: "ADMIN",
role: "ROLE_ADMIN",
created_at: new Date().toISOString(),
},
];
@ -90,7 +89,7 @@ export const dummyAccounts: Account[] = [
{
id: 2,
email: "sarah@example.com",
balance: 0,
balance: 2000,
organization: "ABC Solutions",
accountHistory: "None",
created_at: new Date().toISOString(),
@ -109,31 +108,31 @@ export const dummyConfigurations: Configuration[] = [
{
id: 1,
name: "process_limit",
value: 20,
value: "20",
created_at: new Date().toISOString(),
},
{
id: 2,
name: "process_timeout",
value: 600,
value: "600",
created_at: new Date().toISOString(),
},
{
id: 3,
name: "number_of_courses_to_create",
value: 5,
value: "5",
created_at: new Date().toISOString(),
},
{
id: 4,
name: "max_retries",
value: 2,
value: "2",
created_at: new Date().toISOString(),
},
{
id: 5,
name: "max_token_per_evaluation",
value: 1000000,
value: "1000000",
created_at: new Date().toISOString(),
},
];
@ -165,7 +164,7 @@ export const dummyApiCommunications: ApiCommunication[] = [
status: "course_creation_success",
type: "course_creation",
evaluation:
" Uploaded at: 2023-09-20 00:00:00 - Uploader: jschultz@php.net - Developer: fabien@potencier.org - Status: finished",
"Uploaded at: 2023-09-20 00:00:00 - Uploader: jschultz@php.net - Developer: fabien@potencier.org - Status: finished",
created_at: new Date().toISOString(),
},
];
@ -300,10 +299,10 @@ export const dummyEvaluations: Evaluation[] = [
export const dummyCommits: Commit[] = [
{
id: 1,
id: "1",
hash: "9998211595b05c7f8555e4a129d7792bce7a8dd6_1",
status: "skills_extracted",
retryCount: 0,
retryCount: "0",
type: "code",
evaluation:
"Uploaded at: 2023-09-20 00:00:00 - Uploader: jschultz@php.net - Developer: fabien@potencier.org - Status: finished",

View File

@ -1,8 +1,8 @@
export interface Commit {
id: number;
id: string;
hash: string;
status: string;
retryCount: number;
retryCount: string;
type: string;
evaluation: string;
commitDate: string;

View File

@ -1,6 +1,6 @@
export interface Configuration {
id: number;
name: string;
value: number;
value: string;
created_at: string;
}