Hello Dev Community! š
Today marks Day 178 of my full-stack journey, and Iām officially kicking off a new major project: An AI-Powered Website Builder.
The goal is to turn simple user natural language prompts into responsive web applications instantly.
š ļø The Tech Stack
- Frontend: React, TypeScript, Tailwind CSS
- Core Feature: AI-driven prompt parsing to UI generation
- UX focus: Minimalist, high-contrast premium UI
š„ļø Implementation Highlights (Home Page)
Today I built the Landing Hero Section. The key focus was ensuring a robust, type-safe submission flow.
Highlights:
-
TypeScript-driven Event Handling: Using
React.FormEventto type the submission handler. - State Orchestration: Managing loading states for the AI request lifecycle.
- Guard Clauses: Ensuring authentication and non-empty inputs before hitting the API.
typescript
const onSubmitHandler = async (e: React.FormEvent) => {
e.preventDefault();
if (!session?.user) return toast.error("Please sign in");
setLoading(true);
// Simulate AI API Call
const { data } = await api.post("/api/user/project", { initial_prompt: input });
navigate(`/projects/${data.projectId}`);
};
Top comments (0)