-
{token}
+
+ Your Sites
+
+ {sites.map((site) => (
+
+
{site.name}
+
Template: {site.template}
+
+ Open Builder
+
- ) : (
-
Fetching token...
- )}
-
-
+ ))}
- >
+
);
}
diff --git a/app/globals.css b/app/globals.css
index a2dc41e..f1d8c73 100644
--- a/app/globals.css
+++ b/app/globals.css
@@ -1,26 +1 @@
@import "tailwindcss";
-
-:root {
- --background: #ffffff;
- --foreground: #171717;
-}
-
-@theme inline {
- --color-background: var(--background);
- --color-foreground: var(--foreground);
- --font-sans: var(--font-geist-sans);
- --font-mono: var(--font-geist-mono);
-}
-
-@media (prefers-color-scheme: dark) {
- :root {
- --background: #0a0a0a;
- --foreground: #ededed;
- }
-}
-
-body {
- background: var(--background);
- color: var(--foreground);
- font-family: Arial, Helvetica, sans-serif;
-}
diff --git a/app/signup/page.tsx b/app/signup/page.tsx
new file mode 100644
index 0000000..826cd13
--- /dev/null
+++ b/app/signup/page.tsx
@@ -0,0 +1,51 @@
+"use client";
+import { useState } from "react";
+import { useRouter } from "next/navigation";
+import { createUser } from "@/lib/users";
+
+export default function Signup() {
+ const router = useRouter();
+ const [form, setForm] = useState({ name: "", email: "", businessName: "" });
+
+ const handleSubmit = (e: React.FormEvent) => {
+ e.preventDefault();
+ const user = createUser(form);
+ localStorage.setItem("userId", user.id.toString());
+ router.push("/template-select");
+ };
+
+ return (
+
+ Sign Up
+
+
+ );
+}
diff --git a/app/template-select/page.tsx b/app/template-select/page.tsx
new file mode 100644
index 0000000..22d4069
--- /dev/null
+++ b/app/template-select/page.tsx
@@ -0,0 +1,49 @@
+"use client";
+import { useRouter } from "next/navigation";
+import { createSite, Site } from "@/lib/sites";
+import { useState } from "react";
+
+export default function TemplateSelect() {
+ const router = useRouter();
+ const userId = parseInt(localStorage.getItem("userId") || "0");
+ const templates = ["template1"];
+ const [selectedTemplate, setSelectedTemplate] = useState
(null);
+
+ const handleSelect = () => {
+ if (!selectedTemplate) return;
+ const site = createSite({
+ userId,
+ businessName: "My Business",
+ template: selectedTemplate,
+ });
+ router.push(`/dashboard`);
+ };
+
+ return (
+
+ Select a Template
+
+ {templates.map((t) => (
+
setSelectedTemplate(t)}
+ className={`border p-4 rounded shadow cursor-pointer hover:shadow-lg transition ${
+ selectedTemplate === t ? "border-blue-600" : ""
+ }`}
+ >
+
{t}
+
+ Preview
+
+
+ ))}
+
+
+
+ );
+}
diff --git a/components/templates/template1/layout/footer.tsx b/components/templates/template1/layout/footer.tsx
new file mode 100644
index 0000000..d8f7d41
--- /dev/null
+++ b/components/templates/template1/layout/footer.tsx
@@ -0,0 +1,9 @@
+export default function Footer() {
+ return (
+
+ );
+}
diff --git a/components/templates/template1/layout/header.tsx b/components/templates/template1/layout/header.tsx
new file mode 100644
index 0000000..f83bb50
--- /dev/null
+++ b/components/templates/template1/layout/header.tsx
@@ -0,0 +1,27 @@
+"use client";
+
+import React from "react";
+import Link from "next/link";
+
+const Header: React.FC = () => {
+ return (
+
+ );
+};
+
+export default Header;
diff --git a/components/templates/template1/pages/cart.tsx b/components/templates/template1/pages/cart.tsx
new file mode 100644
index 0000000..2c58263
--- /dev/null
+++ b/components/templates/template1/pages/cart.tsx
@@ -0,0 +1,8 @@
+export default function Cart() {
+ return (
+
+ Your Cart
+ No items in cart yet.
+
+ );
+}
diff --git a/components/templates/template1/pages/checkout.tsx b/components/templates/template1/pages/checkout.tsx
new file mode 100644
index 0000000..563a89a
--- /dev/null
+++ b/components/templates/template1/pages/checkout.tsx
@@ -0,0 +1,10 @@
+export default function Checkout() {
+ return (
+
+ Checkout
+
+ Checkout functionality will be implemented here.
+
+
+ );
+}
diff --git a/components/templates/template1/pages/home.tsx b/components/templates/template1/pages/home.tsx
new file mode 100644
index 0000000..33c16aa
--- /dev/null
+++ b/components/templates/template1/pages/home.tsx
@@ -0,0 +1,14 @@
+interface HomeProps {
+ siteData: { heroTitle: string; heroSubtitle: string };
+}
+
+export default function Home({ siteData }: HomeProps) {
+ return (
+
+
+ {siteData.heroTitle}
+ {siteData.heroSubtitle}
+
+
+ );
+}
diff --git a/components/templates/template1/pages/index.ts b/components/templates/template1/pages/index.ts
new file mode 100644
index 0000000..dc07d83
--- /dev/null
+++ b/components/templates/template1/pages/index.ts
@@ -0,0 +1,6 @@
+// components/templates/template1/pages/index.ts
+export { default as Home } from "./home";
+export { default as Shop } from "./shop";
+export { default as Product } from "./product";
+export { default as Cart } from "./cart";
+export { default as Checkout } from "./checkout";
diff --git a/components/templates/template1/pages/product.tsx b/components/templates/template1/pages/product.tsx
new file mode 100644
index 0000000..c8fd93f
--- /dev/null
+++ b/components/templates/template1/pages/product.tsx
@@ -0,0 +1,32 @@
+interface Product {
+ id: number;
+ name: string;
+ price: number;
+}
+
+const products: Product[] = [
+ { id: 1, name: "Product 1", price: 50 },
+ { id: 2, name: "Product 2", price: 30 },
+ { id: 3, name: "Product 3", price: 20 },
+];
+
+interface ProductProps {
+ params: { id: string };
+}
+
+export default function Product({ params }: ProductProps) {
+ const product = products.find((p) => p.id === parseInt(params.id));
+ if (!product) return Product not found
;
+
+ return (
+
+
+
{product.name}
+
Price: ${product.price}
+
+
+
+ );
+}
diff --git a/components/templates/template1/pages/shop.tsx b/components/templates/template1/pages/shop.tsx
new file mode 100644
index 0000000..8d65bf1
--- /dev/null
+++ b/components/templates/template1/pages/shop.tsx
@@ -0,0 +1,38 @@
+import Link from "next/link";
+
+interface Product {
+ id: number;
+ name: string;
+ price: number;
+}
+
+const products: Product[] = [
+ { id: 1, name: "Product 1", price: 50 },
+ { id: 2, name: "Product 2", price: 30 },
+ { id: 3, name: "Product 3", price: 20 },
+];
+
+export default function Shop() {
+ return (
+
+ Shop
+
+ {products.map((p) => (
+
+
{p.name}
+
${p.price}
+
+ View Product
+
+
+ ))}
+
+
+ );
+}
diff --git a/lib/sites.ts b/lib/sites.ts
new file mode 100644
index 0000000..5f342ab
--- /dev/null
+++ b/lib/sites.ts
@@ -0,0 +1,53 @@
+export interface SiteData {
+ heroTitle: string;
+ heroSubtitle: string;
+}
+
+export interface Site {
+ id: number;
+ userId: number;
+ slug: string;
+ name: string;
+ template: string;
+ data: SiteData;
+}
+
+// Get sites from localStorage
+export function getUserSites(): Site[] {
+ if (typeof window === "undefined") return []; // SSR safe
+ const data = localStorage.getItem("userSites");
+ return data ? JSON.parse(data) : [];
+}
+
+// Save sites to localStorage
+export function saveUserSites(sites: Site[]) {
+ localStorage.setItem("userSites", JSON.stringify(sites));
+}
+
+export function createSite({
+ userId,
+ businessName,
+ template,
+}: {
+ userId: number;
+ businessName: string;
+ template: string;
+}): Site {
+ const sites = getUserSites();
+ const id = sites.length + 1;
+ const slug = `site-${id}`;
+ const newSite: Site = {
+ id,
+ userId,
+ slug,
+ name: businessName,
+ template,
+ data: {
+ heroTitle: `Welcome to ${businessName}`,
+ heroSubtitle: "Best products ever",
+ },
+ };
+ sites.push(newSite);
+ saveUserSites(sites);
+ return newSite;
+}
diff --git a/lib/template.ts b/lib/template.ts
new file mode 100644
index 0000000..8d6ef50
--- /dev/null
+++ b/lib/template.ts
@@ -0,0 +1,17 @@
+import T1Header from "@/components/templates/template1/layout/header";
+import T1Footer from "@/components/templates/template1/layout/footer";
+import * as T1Pages from "@/components//templates/template1/pages";
+
+export interface Template {
+ Header: React.ComponentType;
+ Footer: React.ComponentType;
+ pages: typeof T1Pages;
+}
+
+export const templates: Record = {
+ template1: {
+ Header: T1Header,
+ Footer: T1Footer,
+ pages: T1Pages,
+ },
+};
diff --git a/lib/users.ts b/lib/users.ts
new file mode 100644
index 0000000..479e9cf
--- /dev/null
+++ b/lib/users.ts
@@ -0,0 +1,15 @@
+export interface User {
+ id: number;
+ name: string;
+ email: string;
+ businessName: string;
+}
+
+export const users: User[] = [];
+
+export function createUser(data: Omit): User {
+ const id = users.length + 1;
+ const newUser: User = { id, ...data };
+ users.push(newUser);
+ return newUser;
+}
diff --git a/tsconfig.json b/tsconfig.json
index d8b9323..96daa6a 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -22,6 +22,12 @@
"@/*": ["./*"]
}
},
- "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
+ "include": [
+ "next-env.d.ts",
+ "**/*.ts",
+ "**/*.tsx",
+ ".next/types/**/*.ts",
+ "components/**/*"
+ ],
"exclude": ["node_modules"]
}