Skip to content

Commit

Permalink
Merge pull request #81 from AElfProject/feature/new-templates
Browse files Browse the repository at this point in the history
feat: added new templates
  • Loading branch information
RutvikGhaskataEalf authored Jan 7, 2025
2 parents 67d5b00 + 062c548 commit 984ce96
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 3 deletions.
25 changes: 23 additions & 2 deletions components/new-workspace-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const FormSchema = z.object({

function getLabel(value: string) {
switch (value) {
case "aelf":
case "aelf-hello-world":
return "Hello World";

case "aelf-lottery":
Expand All @@ -57,14 +57,35 @@ function getLabel(value: string) {
case "aelf-simple-dao":
return "Simple DAO";

case "aelf-todo":
return "Todo";

case "aelf-tictactoe":
return "Tic Tac Toe";

case "aelf-expense":
return "Expense Tracker";

case "aelf-staking":
return "Single Pool Staking";

default:
return value;
}
}

export function WorkspaceForm() {
const [searchParams] = useSearchParams();
const templateOptions = ["aelf", "aelf-lottery", "aelf-nft-sale", "aelf-simple-dao"];
const templateOptions = [
"aelf-hello-world",
"aelf-lottery",
"aelf-nft-sale",
"aelf-simple-dao",
"aelf-todo",
"aelf-tictactoe",
"aelf-expense",
"aelf-staking",
];
const form = useForm<z.infer<typeof FormSchema>>({
resolver: zodResolver(FormSchema),
defaultValues: {
Expand Down
30 changes: 29 additions & 1 deletion src/routes/home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ import {
TargetIcon,
TokensIcon,
PersonIcon,
ListBulletIcon,
MixIcon,
IdCardIcon,
StackIcon,
} from "@radix-ui/react-icons";
import { Link } from "react-router-dom";
import { ReactNode } from "react";
Expand Down Expand Up @@ -41,7 +45,7 @@ import {
title: "Hello World",
subtitle: "The basics.",
icon: <GlobeIcon className="h-6 w-6" />,
template: "aelf",
template: "aelf-hello-world",
},
{
title: "Lottery",
Expand All @@ -61,6 +65,30 @@ import {
icon: <PersonIcon className="h-6 w-6" />,
template: "aelf-simple-dao",
},
{
title: "ToDo",
subtitle: "A basic ToDo smart contract",
icon: <ListBulletIcon className="h-6 w-6" />,
template: "aelf-todo",
},
{
title: "Tic Tac Toe",
subtitle: "Decentralised gamify contract",
icon: <MixIcon className="h-6 w-6" />,
template: "aelf-tictactoe",
},
{
title: "Expense Tracker",
subtitle: "Expense organizer",
icon: <IdCardIcon className="h-6 w-6" />,
template: "aelf-expense",
},
{
title: "Single Pool Staking",
subtitle: "Token staking",
icon: <StackIcon className="h-6 w-6" />,
template: "aelf-staking",
},
];

return (
Expand Down

0 comments on commit 984ce96

Please sign in to comment.