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 Breadcrumb from "@/components/breadcrumb";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area"; import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area";
@ -10,7 +12,7 @@ const breadcrumbItems = [
{ title: "Add" }, { title: "Add" },
]; ];
export default function SettingsDisplayPage() { export default function Page() {
return ( return (
<ScrollArea className="h-[calc(100vh-53px)]"> <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">
@ -25,7 +27,11 @@ export default function SettingsDisplayPage() {
</CardHeader> </CardHeader>
<CardContent> <CardContent>
<AddAccountForm /> <AccountForm
onSubmit={() => {}}
btn1_content="Create"
btn2_content="Create and add another"
/>
</CardContent> </CardContent>
</Card> </Card>
</div> </div>

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 Breadcrumb from "@/components/breadcrumb";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area"; import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area";
@ -10,7 +12,7 @@ const breadcrumbItems = [
{ title: "Add" }, { title: "Add" },
]; ];
export default function SettingsDisplayPage() { export default function Page() {
return ( return (
<ScrollArea className="h-[calc(100vh-53px)]"> <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">
@ -25,7 +27,11 @@ export default function SettingsDisplayPage() {
</CardHeader> </CardHeader>
<CardContent> <CardContent>
<AddAPICommunicationForm /> <AddAPICommunicationForm
onSubmit={() => {}}
btn1_content="Create"
btn2_content="Create and add another"
/>
</CardContent> </CardContent>
</Card> </Card>
</div> </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 { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area"; import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area";
import { Separator } from "@/components/ui/separator"; import { Separator } from "@/components/ui/separator";
@ -10,7 +12,7 @@ const breadcrumbItems = [
{ title: "Create Commit" }, { title: "Create Commit" },
]; ];
export default function SettingsDisplayPage() { export default function Page() {
return ( return (
<ScrollArea className="h-[calc(100vh-53px)]"> <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">
@ -25,7 +27,11 @@ export default function SettingsDisplayPage() {
</CardHeader> </CardHeader>
<CardContent> <CardContent>
<CommitForm /> <CommitForm
onSubmit={() => {}}
btn1_content="Create"
btn2_content="Create and add another"
/>
</CardContent> </CardContent>
</Card> </Card>
</div> </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 { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area"; import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area";
import { Separator } from "@/components/ui/separator"; import { Separator } from "@/components/ui/separator";
import AddConfigurationForm from "@/components/add-configuration-form"; import ConfigurationForm from "@/components/configuration-form";
import Breadcrumb from "@/components/breadcrumb"; import Breadcrumb from "@/components/breadcrumb";
const breadcrumbItems = [ const breadcrumbItems = [
@ -10,7 +12,7 @@ const breadcrumbItems = [
{ title: "Add" }, { title: "Add" },
]; ];
export default function SettingsDisplayPage() { export default function Page() {
return ( return (
<ScrollArea className="h-[calc(100vh-53px)]"> <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">
@ -25,7 +27,11 @@ export default function SettingsDisplayPage() {
</CardHeader> </CardHeader>
<CardContent> <CardContent>
<AddConfigurationForm /> <ConfigurationForm
onSubmit={() => {}}
btn1_content="Create"
btn2_content="Create and add another"
/>
</CardContent> </CardContent>
</Card> </Card>
</div> </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 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 { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area"; import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area";
import { Separator } from "@/components/ui/separator"; 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 ( return (
<ScrollArea className="h-[calc(100vh-53px)]"> <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"> <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> </CardHeader>
<CardContent> <CardContent>
<AddCriteriaForm /> <AddCriteriaForm
onSubmit={() => {}}
btn1_content="Save and continue editing"
btn2_content="Save changes"
/>
</CardContent> </CardContent>
</Card> </Card>
</div> </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 { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area"; import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area";
import { Separator } from "@/components/ui/separator"; import { Separator } from "@/components/ui/separator";
import Breadcrumb from "@/components/breadcrumb"; import Breadcrumb from "@/components/breadcrumb";
import AddEvaluationForm from "@/components/evaluation-form"; import EvaluationForm from "@/components/evaluation-form";
const breadcrumbItems = [ const breadcrumbItems = [
{ title: "Dashboard", link: "/dashboard" }, { title: "Dashboard", link: "/dashboard" },
@ -10,7 +12,7 @@ const breadcrumbItems = [
{ title: "Add" }, { title: "Add" },
]; ];
export default function SettingsDisplayPage() { export default function Page() {
return ( return (
<ScrollArea className="h-[calc(100vh-53px)]"> <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">
@ -25,7 +27,11 @@ export default function SettingsDisplayPage() {
</CardHeader> </CardHeader>
<CardContent> <CardContent>
<AddEvaluationForm/> <EvaluationForm
onSubmit={() => {}}
btn1_content="Create"
btn2_content="Create and add another"
/>
</CardContent> </CardContent>
</Card> </Card>
</div> </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 { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area"; import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area";
import { Separator } from "@/components/ui/separator"; import { Separator } from "@/components/ui/separator";
import AddOrganizationForm from "@/components/add-organization-form"; import OrganizationForm from "@/components/organization-form";
import Breadcrumb from "@/components/breadcrumb"; import Breadcrumb from "@/components/breadcrumb";
const breadcrumbItems = [ const breadcrumbItems = [
@ -10,7 +12,7 @@ const breadcrumbItems = [
{ title: "Add" }, { title: "Add" },
]; ];
export default function SettingsDisplayPage() { export default function Page() {
return ( return (
<ScrollArea className="h-[calc(100vh-53px)]"> <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">
@ -25,7 +27,11 @@ export default function SettingsDisplayPage() {
</CardHeader> </CardHeader>
<CardContent> <CardContent>
<AddOrganizationForm /> <OrganizationForm
onSubmit={() => {}}
btn1_content="Create"
btn2_content="Create and add another"
/>
</CardContent> </CardContent>
</Card> </Card>
</div> </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 { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area"; import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area";
import { Separator } from "@/components/ui/separator"; import { Separator } from "@/components/ui/separator";
import AddSkillForm from "@/components/add-skill-form"; import SkillForm from "@/components/skill-form";
import Breadcrumb from "@/components/breadcrumb"; import Breadcrumb from "@/components/breadcrumb";
const breadcrumbItems = [ const breadcrumbItems = [
@ -10,7 +12,7 @@ const breadcrumbItems = [
{ title: "Add" }, { title: "Add" },
]; ];
export default function SettingsDisplayPage() { export default function Page() {
return ( return (
<ScrollArea className="h-[calc(100vh-53px)]"> <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">
@ -25,7 +27,11 @@ export default function SettingsDisplayPage() {
</CardHeader> </CardHeader>
<CardContent> <CardContent>
<AddSkillForm /> <SkillForm
onSubmit={() => {}}
btn1_content="Create"
btn2_content="Create and add another"
/>
</CardContent> </CardContent>
</Card> </Card>
</div> </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 Breadcrumb from "@/components/breadcrumb";
import { Button } from "@/components/ui/button"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import {
Card,
CardContent,
CardFooter,
CardHeader,
CardTitle,
} from "@/components/ui/card";
import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area"; import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area";
import { Separator } from "@/components/ui/separator"; import { Separator } from "@/components/ui/separator";
@ -17,7 +12,7 @@ const breadcrumbItems = [
{ title: "Add" }, { title: "Add" },
]; ];
export default function SettingsDisplayPage() { export default function Page() {
return ( return (
<ScrollArea className="h-[calc(100vh-53px)]"> <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">
@ -32,7 +27,11 @@ export default function SettingsDisplayPage() {
</CardHeader> </CardHeader>
<CardContent> <CardContent>
<AddUserForm /> <UserForm
onSubmit={() => {}}
btn1_content="Create"
btn2_content="Create and add another"
/>
</CardContent> </CardContent>
</Card> </Card>
</div> </div>

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -11,7 +11,8 @@ import {
import { useToast } from "@/components/ui/use-toast"; import { useToast } from "@/components/ui/use-toast";
import { User } from "@/types/user"; 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 { useRouter } from "next/navigation";
import { useState } from "react"; import { useState } from "react";
@ -27,7 +28,8 @@ export const CellAction: React.FC<CellActionProps> = ({ data }) => {
const onDeleteConfirm = async () => {}; const onDeleteConfirm = async () => {};
const handleUpdateStatus = async () => {};
console.log(data)
return ( return (
<> <>
@ -47,13 +49,17 @@ export const CellAction: React.FC<CellActionProps> = ({ data }) => {
<DropdownMenuContent align="end"> <DropdownMenuContent align="end">
<DropdownMenuLabel>Actions</DropdownMenuLabel> <DropdownMenuLabel>Actions</DropdownMenuLabel>
<DropdownMenuItem <DropdownMenuItem className="cursor-pointer">
className="cursor-pointer" <UserCheck className="mr-2 h-4 w-4" /> Approve User
// onClick={() => </DropdownMenuItem>
// router.push(`#`)
// } <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="mr-2 h-4 w-4" /> Update <Edit className="h-4 w-4" /> Edit
</Link>
</DropdownMenuItem> </DropdownMenuItem>
<DropdownMenuItem <DropdownMenuItem
className="cursor-pointer" className="cursor-pointer"

View File

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

View File

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

View File

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