diff --git a/firebase-ai-friendly-meals/web/.gitignore b/firebase-ai-friendly-meals/web/.gitignore deleted file mode 100644 index 0c66f42c..00000000 --- a/firebase-ai-friendly-meals/web/.gitignore +++ /dev/null @@ -1,29 +0,0 @@ -# Logs -logs -*.log -npm-debug.log* -yarn-debug.log* -yarn-error.log* -pnpm-debug.log* -lerna-debug.log* - -node_modules -dist -dist-ssr -*.local - -# Editor directories and files -.vscode/* -!.vscode/extensions.json -.idea -.DS_Store -*.suo -*.ntvs* -*.njsproj -*.sln -*.sw? - -.firebaserc -.firebase/* - -build/* \ No newline at end of file diff --git a/firebase-ai-friendly-meals/web/.react-router/types/+future.ts b/firebase-ai-friendly-meals/web/.react-router/types/+future.ts deleted file mode 100644 index 7f4533cc..00000000 --- a/firebase-ai-friendly-meals/web/.react-router/types/+future.ts +++ /dev/null @@ -1,9 +0,0 @@ -// Generated by React Router - -import "react-router"; - -declare module "react-router" { - interface Future { - v8_middleware: false - } -} \ No newline at end of file diff --git a/firebase-ai-friendly-meals/web/.react-router/types/+routes.ts b/firebase-ai-friendly-meals/web/.react-router/types/+routes.ts deleted file mode 100644 index 73e2e83f..00000000 --- a/firebase-ai-friendly-meals/web/.react-router/types/+routes.ts +++ /dev/null @@ -1,80 +0,0 @@ -// Generated by React Router - -import "react-router" - -declare module "react-router" { - interface Register { - pages: Pages - routeFiles: RouteFiles - routeModules: RouteModules - } -} - -type Pages = { - "/": { - params: {}; - }; - "/chat": { - params: {}; - }; - "/generate": { - params: {}; - }; - "/image": { - params: {}; - }; - "/recipes": { - params: {}; - }; - "/recipes/:recipeId": { - params: { - "recipeId": string; - }; - }; -}; - -type RouteFiles = { - "root.tsx": { - id: "root"; - page: "/" | "/chat" | "/generate" | "/image" | "/recipes" | "/recipes/:recipeId"; - }; - "routes/home.tsx": { - id: "routes/home"; - page: "/"; - }; - "components/Layout.tsx": { - id: "components/Layout"; - page: "/chat" | "/generate" | "/image" | "/recipes" | "/recipes/:recipeId"; - }; - "routes/chat.tsx": { - id: "routes/chat"; - page: "/chat"; - }; - "routes/generate.tsx": { - id: "routes/generate"; - page: "/generate"; - }; - "routes/image.tsx": { - id: "routes/image"; - page: "/image"; - }; - "routes/recipes.tsx": { - id: "routes/recipes"; - page: "/recipes"; - }; - "routes/recipe.$recipeId.tsx": { - id: "routes/recipe.$recipeId"; - page: "/recipes/:recipeId"; - }; -}; - -type RouteModules = { - "root": typeof import("./app/root.tsx"); - "routes/home": typeof import("./app/routes/home.tsx"); - "components/Layout": typeof import("./app/components/Layout.tsx"); - "routes/chat": typeof import("./app/routes/chat.tsx"); - "routes/generate": typeof import("./app/routes/generate.tsx"); - "routes/image": typeof import("./app/routes/image.tsx"); - "routes/recipes": typeof import("./app/routes/recipes.tsx"); - "routes/recipe.$recipeId": typeof import("./app/routes/recipe.$recipeId.tsx"); -}; \ No newline at end of file diff --git a/firebase-ai-friendly-meals/web/.react-router/types/+server-build.d.ts b/firebase-ai-friendly-meals/web/.react-router/types/+server-build.d.ts deleted file mode 100644 index 13792c13..00000000 --- a/firebase-ai-friendly-meals/web/.react-router/types/+server-build.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -// Generated by React Router - -declare module "virtual:react-router/server-build" { - import { ServerBuild } from "react-router"; - export const assets: ServerBuild["assets"]; - export const assetsBuildDirectory: ServerBuild["assetsBuildDirectory"]; - export const basename: ServerBuild["basename"]; - export const entry: ServerBuild["entry"]; - export const future: ServerBuild["future"]; - export const isSpaMode: ServerBuild["isSpaMode"]; - export const prerender: ServerBuild["prerender"]; - export const publicPath: ServerBuild["publicPath"]; - export const routeDiscovery: ServerBuild["routeDiscovery"]; - export const routes: ServerBuild["routes"]; - export const ssr: ServerBuild["ssr"]; - export const allowedActionOrigins: ServerBuild["allowedActionOrigins"]; - export const unstable_getCriticalCss: ServerBuild["unstable_getCriticalCss"]; -} \ No newline at end of file diff --git a/firebase-ai-friendly-meals/web/.react-router/types/app/+types/root.ts b/firebase-ai-friendly-meals/web/.react-router/types/app/+types/root.ts deleted file mode 100644 index 5bd414e1..00000000 --- a/firebase-ai-friendly-meals/web/.react-router/types/app/+types/root.ts +++ /dev/null @@ -1,59 +0,0 @@ -// Generated by React Router - -import type { GetInfo, GetAnnotations } from "react-router/internal"; - -type Module = typeof import("../root.js") - -type Info = GetInfo<{ - file: "root.tsx", - module: Module -}> - -type Matches = [{ - id: "root"; - module: typeof import("../root.js"); -}]; - -type Annotations = GetAnnotations; - -export namespace Route { - // links - export type LinkDescriptors = Annotations["LinkDescriptors"]; - export type LinksFunction = Annotations["LinksFunction"]; - - // meta - export type MetaArgs = Annotations["MetaArgs"]; - export type MetaDescriptors = Annotations["MetaDescriptors"]; - export type MetaFunction = Annotations["MetaFunction"]; - - // headers - export type HeadersArgs = Annotations["HeadersArgs"]; - export type HeadersFunction = Annotations["HeadersFunction"]; - - // middleware - export type MiddlewareFunction = Annotations["MiddlewareFunction"]; - - // clientMiddleware - export type ClientMiddlewareFunction = Annotations["ClientMiddlewareFunction"]; - - // loader - export type LoaderArgs = Annotations["LoaderArgs"]; - - // clientLoader - export type ClientLoaderArgs = Annotations["ClientLoaderArgs"]; - - // action - export type ActionArgs = Annotations["ActionArgs"]; - - // clientAction - export type ClientActionArgs = Annotations["ClientActionArgs"]; - - // HydrateFallback - export type HydrateFallbackProps = Annotations["HydrateFallbackProps"]; - - // Component - export type ComponentProps = Annotations["ComponentProps"]; - - // ErrorBoundary - export type ErrorBoundaryProps = Annotations["ErrorBoundaryProps"]; -} \ No newline at end of file diff --git a/firebase-ai-friendly-meals/web/.react-router/types/app/components/+types/Layout.ts b/firebase-ai-friendly-meals/web/.react-router/types/app/components/+types/Layout.ts deleted file mode 100644 index 8303ea97..00000000 --- a/firebase-ai-friendly-meals/web/.react-router/types/app/components/+types/Layout.ts +++ /dev/null @@ -1,62 +0,0 @@ -// Generated by React Router - -import type { GetInfo, GetAnnotations } from "react-router/internal"; - -type Module = typeof import("../Layout.js") - -type Info = GetInfo<{ - file: "components/Layout.tsx", - module: Module -}> - -type Matches = [{ - id: "root"; - module: typeof import("../../root.js"); -}, { - id: "components/Layout"; - module: typeof import("../Layout.js"); -}]; - -type Annotations = GetAnnotations; - -export namespace Route { - // links - export type LinkDescriptors = Annotations["LinkDescriptors"]; - export type LinksFunction = Annotations["LinksFunction"]; - - // meta - export type MetaArgs = Annotations["MetaArgs"]; - export type MetaDescriptors = Annotations["MetaDescriptors"]; - export type MetaFunction = Annotations["MetaFunction"]; - - // headers - export type HeadersArgs = Annotations["HeadersArgs"]; - export type HeadersFunction = Annotations["HeadersFunction"]; - - // middleware - export type MiddlewareFunction = Annotations["MiddlewareFunction"]; - - // clientMiddleware - export type ClientMiddlewareFunction = Annotations["ClientMiddlewareFunction"]; - - // loader - export type LoaderArgs = Annotations["LoaderArgs"]; - - // clientLoader - export type ClientLoaderArgs = Annotations["ClientLoaderArgs"]; - - // action - export type ActionArgs = Annotations["ActionArgs"]; - - // clientAction - export type ClientActionArgs = Annotations["ClientActionArgs"]; - - // HydrateFallback - export type HydrateFallbackProps = Annotations["HydrateFallbackProps"]; - - // Component - export type ComponentProps = Annotations["ComponentProps"]; - - // ErrorBoundary - export type ErrorBoundaryProps = Annotations["ErrorBoundaryProps"]; -} \ No newline at end of file diff --git a/firebase-ai-friendly-meals/web/.react-router/types/app/routes/+types/chat.ts b/firebase-ai-friendly-meals/web/.react-router/types/app/routes/+types/chat.ts deleted file mode 100644 index 12b82f44..00000000 --- a/firebase-ai-friendly-meals/web/.react-router/types/app/routes/+types/chat.ts +++ /dev/null @@ -1,65 +0,0 @@ -// Generated by React Router - -import type { GetInfo, GetAnnotations } from "react-router/internal"; - -type Module = typeof import("../chat.js") - -type Info = GetInfo<{ - file: "routes/chat.tsx", - module: Module -}> - -type Matches = [{ - id: "root"; - module: typeof import("../../root.js"); -}, { - id: "components/Layout"; - module: typeof import("../../components/Layout.js"); -}, { - id: "routes/chat"; - module: typeof import("../chat.js"); -}]; - -type Annotations = GetAnnotations; - -export namespace Route { - // links - export type LinkDescriptors = Annotations["LinkDescriptors"]; - export type LinksFunction = Annotations["LinksFunction"]; - - // meta - export type MetaArgs = Annotations["MetaArgs"]; - export type MetaDescriptors = Annotations["MetaDescriptors"]; - export type MetaFunction = Annotations["MetaFunction"]; - - // headers - export type HeadersArgs = Annotations["HeadersArgs"]; - export type HeadersFunction = Annotations["HeadersFunction"]; - - // middleware - export type MiddlewareFunction = Annotations["MiddlewareFunction"]; - - // clientMiddleware - export type ClientMiddlewareFunction = Annotations["ClientMiddlewareFunction"]; - - // loader - export type LoaderArgs = Annotations["LoaderArgs"]; - - // clientLoader - export type ClientLoaderArgs = Annotations["ClientLoaderArgs"]; - - // action - export type ActionArgs = Annotations["ActionArgs"]; - - // clientAction - export type ClientActionArgs = Annotations["ClientActionArgs"]; - - // HydrateFallback - export type HydrateFallbackProps = Annotations["HydrateFallbackProps"]; - - // Component - export type ComponentProps = Annotations["ComponentProps"]; - - // ErrorBoundary - export type ErrorBoundaryProps = Annotations["ErrorBoundaryProps"]; -} \ No newline at end of file diff --git a/firebase-ai-friendly-meals/web/.react-router/types/app/routes/+types/generate.ts b/firebase-ai-friendly-meals/web/.react-router/types/app/routes/+types/generate.ts deleted file mode 100644 index f22a7f2c..00000000 --- a/firebase-ai-friendly-meals/web/.react-router/types/app/routes/+types/generate.ts +++ /dev/null @@ -1,65 +0,0 @@ -// Generated by React Router - -import type { GetInfo, GetAnnotations } from "react-router/internal"; - -type Module = typeof import("../generate.js") - -type Info = GetInfo<{ - file: "routes/generate.tsx", - module: Module -}> - -type Matches = [{ - id: "root"; - module: typeof import("../../root.js"); -}, { - id: "components/Layout"; - module: typeof import("../../components/Layout.js"); -}, { - id: "routes/generate"; - module: typeof import("../generate.js"); -}]; - -type Annotations = GetAnnotations; - -export namespace Route { - // links - export type LinkDescriptors = Annotations["LinkDescriptors"]; - export type LinksFunction = Annotations["LinksFunction"]; - - // meta - export type MetaArgs = Annotations["MetaArgs"]; - export type MetaDescriptors = Annotations["MetaDescriptors"]; - export type MetaFunction = Annotations["MetaFunction"]; - - // headers - export type HeadersArgs = Annotations["HeadersArgs"]; - export type HeadersFunction = Annotations["HeadersFunction"]; - - // middleware - export type MiddlewareFunction = Annotations["MiddlewareFunction"]; - - // clientMiddleware - export type ClientMiddlewareFunction = Annotations["ClientMiddlewareFunction"]; - - // loader - export type LoaderArgs = Annotations["LoaderArgs"]; - - // clientLoader - export type ClientLoaderArgs = Annotations["ClientLoaderArgs"]; - - // action - export type ActionArgs = Annotations["ActionArgs"]; - - // clientAction - export type ClientActionArgs = Annotations["ClientActionArgs"]; - - // HydrateFallback - export type HydrateFallbackProps = Annotations["HydrateFallbackProps"]; - - // Component - export type ComponentProps = Annotations["ComponentProps"]; - - // ErrorBoundary - export type ErrorBoundaryProps = Annotations["ErrorBoundaryProps"]; -} \ No newline at end of file diff --git a/firebase-ai-friendly-meals/web/.react-router/types/app/routes/+types/home.ts b/firebase-ai-friendly-meals/web/.react-router/types/app/routes/+types/home.ts deleted file mode 100644 index e49d62af..00000000 --- a/firebase-ai-friendly-meals/web/.react-router/types/app/routes/+types/home.ts +++ /dev/null @@ -1,62 +0,0 @@ -// Generated by React Router - -import type { GetInfo, GetAnnotations } from "react-router/internal"; - -type Module = typeof import("../home.js") - -type Info = GetInfo<{ - file: "routes/home.tsx", - module: Module -}> - -type Matches = [{ - id: "root"; - module: typeof import("../../root.js"); -}, { - id: "routes/home"; - module: typeof import("../home.js"); -}]; - -type Annotations = GetAnnotations; - -export namespace Route { - // links - export type LinkDescriptors = Annotations["LinkDescriptors"]; - export type LinksFunction = Annotations["LinksFunction"]; - - // meta - export type MetaArgs = Annotations["MetaArgs"]; - export type MetaDescriptors = Annotations["MetaDescriptors"]; - export type MetaFunction = Annotations["MetaFunction"]; - - // headers - export type HeadersArgs = Annotations["HeadersArgs"]; - export type HeadersFunction = Annotations["HeadersFunction"]; - - // middleware - export type MiddlewareFunction = Annotations["MiddlewareFunction"]; - - // clientMiddleware - export type ClientMiddlewareFunction = Annotations["ClientMiddlewareFunction"]; - - // loader - export type LoaderArgs = Annotations["LoaderArgs"]; - - // clientLoader - export type ClientLoaderArgs = Annotations["ClientLoaderArgs"]; - - // action - export type ActionArgs = Annotations["ActionArgs"]; - - // clientAction - export type ClientActionArgs = Annotations["ClientActionArgs"]; - - // HydrateFallback - export type HydrateFallbackProps = Annotations["HydrateFallbackProps"]; - - // Component - export type ComponentProps = Annotations["ComponentProps"]; - - // ErrorBoundary - export type ErrorBoundaryProps = Annotations["ErrorBoundaryProps"]; -} \ No newline at end of file diff --git a/firebase-ai-friendly-meals/web/.react-router/types/app/routes/+types/image.ts b/firebase-ai-friendly-meals/web/.react-router/types/app/routes/+types/image.ts deleted file mode 100644 index 552e3e10..00000000 --- a/firebase-ai-friendly-meals/web/.react-router/types/app/routes/+types/image.ts +++ /dev/null @@ -1,65 +0,0 @@ -// Generated by React Router - -import type { GetInfo, GetAnnotations } from "react-router/internal"; - -type Module = typeof import("../image.js") - -type Info = GetInfo<{ - file: "routes/image.tsx", - module: Module -}> - -type Matches = [{ - id: "root"; - module: typeof import("../../root.js"); -}, { - id: "components/Layout"; - module: typeof import("../../components/Layout.js"); -}, { - id: "routes/image"; - module: typeof import("../image.js"); -}]; - -type Annotations = GetAnnotations; - -export namespace Route { - // links - export type LinkDescriptors = Annotations["LinkDescriptors"]; - export type LinksFunction = Annotations["LinksFunction"]; - - // meta - export type MetaArgs = Annotations["MetaArgs"]; - export type MetaDescriptors = Annotations["MetaDescriptors"]; - export type MetaFunction = Annotations["MetaFunction"]; - - // headers - export type HeadersArgs = Annotations["HeadersArgs"]; - export type HeadersFunction = Annotations["HeadersFunction"]; - - // middleware - export type MiddlewareFunction = Annotations["MiddlewareFunction"]; - - // clientMiddleware - export type ClientMiddlewareFunction = Annotations["ClientMiddlewareFunction"]; - - // loader - export type LoaderArgs = Annotations["LoaderArgs"]; - - // clientLoader - export type ClientLoaderArgs = Annotations["ClientLoaderArgs"]; - - // action - export type ActionArgs = Annotations["ActionArgs"]; - - // clientAction - export type ClientActionArgs = Annotations["ClientActionArgs"]; - - // HydrateFallback - export type HydrateFallbackProps = Annotations["HydrateFallbackProps"]; - - // Component - export type ComponentProps = Annotations["ComponentProps"]; - - // ErrorBoundary - export type ErrorBoundaryProps = Annotations["ErrorBoundaryProps"]; -} \ No newline at end of file diff --git a/firebase-ai-friendly-meals/web/.react-router/types/app/routes/+types/recipe.$recipeId.ts b/firebase-ai-friendly-meals/web/.react-router/types/app/routes/+types/recipe.$recipeId.ts deleted file mode 100644 index 662c267a..00000000 --- a/firebase-ai-friendly-meals/web/.react-router/types/app/routes/+types/recipe.$recipeId.ts +++ /dev/null @@ -1,65 +0,0 @@ -// Generated by React Router - -import type { GetInfo, GetAnnotations } from "react-router/internal"; - -type Module = typeof import("../recipe.$recipeId.js") - -type Info = GetInfo<{ - file: "routes/recipe.$recipeId.tsx", - module: Module -}> - -type Matches = [{ - id: "root"; - module: typeof import("../../root.js"); -}, { - id: "components/Layout"; - module: typeof import("../../components/Layout.js"); -}, { - id: "routes/recipe.$recipeId"; - module: typeof import("../recipe.$recipeId.js"); -}]; - -type Annotations = GetAnnotations; - -export namespace Route { - // links - export type LinkDescriptors = Annotations["LinkDescriptors"]; - export type LinksFunction = Annotations["LinksFunction"]; - - // meta - export type MetaArgs = Annotations["MetaArgs"]; - export type MetaDescriptors = Annotations["MetaDescriptors"]; - export type MetaFunction = Annotations["MetaFunction"]; - - // headers - export type HeadersArgs = Annotations["HeadersArgs"]; - export type HeadersFunction = Annotations["HeadersFunction"]; - - // middleware - export type MiddlewareFunction = Annotations["MiddlewareFunction"]; - - // clientMiddleware - export type ClientMiddlewareFunction = Annotations["ClientMiddlewareFunction"]; - - // loader - export type LoaderArgs = Annotations["LoaderArgs"]; - - // clientLoader - export type ClientLoaderArgs = Annotations["ClientLoaderArgs"]; - - // action - export type ActionArgs = Annotations["ActionArgs"]; - - // clientAction - export type ClientActionArgs = Annotations["ClientActionArgs"]; - - // HydrateFallback - export type HydrateFallbackProps = Annotations["HydrateFallbackProps"]; - - // Component - export type ComponentProps = Annotations["ComponentProps"]; - - // ErrorBoundary - export type ErrorBoundaryProps = Annotations["ErrorBoundaryProps"]; -} \ No newline at end of file diff --git a/firebase-ai-friendly-meals/web/.react-router/types/app/routes/+types/recipes.ts b/firebase-ai-friendly-meals/web/.react-router/types/app/routes/+types/recipes.ts deleted file mode 100644 index bb01a2fa..00000000 --- a/firebase-ai-friendly-meals/web/.react-router/types/app/routes/+types/recipes.ts +++ /dev/null @@ -1,65 +0,0 @@ -// Generated by React Router - -import type { GetInfo, GetAnnotations } from "react-router/internal"; - -type Module = typeof import("../recipes.js") - -type Info = GetInfo<{ - file: "routes/recipes.tsx", - module: Module -}> - -type Matches = [{ - id: "root"; - module: typeof import("../../root.js"); -}, { - id: "components/Layout"; - module: typeof import("../../components/Layout.js"); -}, { - id: "routes/recipes"; - module: typeof import("../recipes.js"); -}]; - -type Annotations = GetAnnotations; - -export namespace Route { - // links - export type LinkDescriptors = Annotations["LinkDescriptors"]; - export type LinksFunction = Annotations["LinksFunction"]; - - // meta - export type MetaArgs = Annotations["MetaArgs"]; - export type MetaDescriptors = Annotations["MetaDescriptors"]; - export type MetaFunction = Annotations["MetaFunction"]; - - // headers - export type HeadersArgs = Annotations["HeadersArgs"]; - export type HeadersFunction = Annotations["HeadersFunction"]; - - // middleware - export type MiddlewareFunction = Annotations["MiddlewareFunction"]; - - // clientMiddleware - export type ClientMiddlewareFunction = Annotations["ClientMiddlewareFunction"]; - - // loader - export type LoaderArgs = Annotations["LoaderArgs"]; - - // clientLoader - export type ClientLoaderArgs = Annotations["ClientLoaderArgs"]; - - // action - export type ActionArgs = Annotations["ActionArgs"]; - - // clientAction - export type ClientActionArgs = Annotations["ClientActionArgs"]; - - // HydrateFallback - export type HydrateFallbackProps = Annotations["HydrateFallbackProps"]; - - // Component - export type ComponentProps = Annotations["ComponentProps"]; - - // ErrorBoundary - export type ErrorBoundaryProps = Annotations["ErrorBoundaryProps"]; -} \ No newline at end of file diff --git a/firebase-ai-friendly-meals/web/README.md b/firebase-ai-friendly-meals/web/README.md index ca253564..0d97cb05 100644 --- a/firebase-ai-friendly-meals/web/README.md +++ b/firebase-ai-friendly-meals/web/README.md @@ -1,7 +1,3 @@ -# friendly-meals-web +# FriendlyMeals – Firebase Web Samples -To start the development server, run the following command: - -```bash -npm run dev -``` \ No newline at end of file +This sample app has moved! You can find the codebase and setup instructions at the [new repository](https://github.com/FirebaseExtended/FriendlyMeals-web). diff --git a/firebase-ai-friendly-meals/web/app/components/ChatMessage.tsx b/firebase-ai-friendly-meals/web/app/components/ChatMessage.tsx deleted file mode 100644 index e7706bbb..00000000 --- a/firebase-ai-friendly-meals/web/app/components/ChatMessage.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import React from "react"; -import Markdown from "react-markdown"; - -const ChatMessage: React.FC<{ role: "user" | "model"; message: string }> = ({ - role, - message, -}) => { - return ( -
-
-
- {message} -
-
-
- ); -}; - -export default ChatMessage; diff --git a/firebase-ai-friendly-meals/web/app/components/ImageLayout.tsx b/firebase-ai-friendly-meals/web/app/components/ImageLayout.tsx deleted file mode 100644 index 955a3d82..00000000 --- a/firebase-ai-friendly-meals/web/app/components/ImageLayout.tsx +++ /dev/null @@ -1,123 +0,0 @@ -import React, { useState } from "react"; -import { generateRecipeFromImage } from "../firebase/firebaseAILogic"; -import { Button } from "@/components/ui/button"; -import { Input } from "@/components/ui/input"; -import { Select } from "@/components/ui/select"; -import { Field, FieldLabel } from "@/components/ui/field"; -import { Spinner } from "@/components/ui/spinner"; -import type { Recipe } from "../firebase/data"; -import { publishRecipe } from "../firebase/data"; -import RecipeDetail from "./Recipe"; -import { ChevronDown, ChevronUp, Sparkles } from "lucide-react"; -import { getUser } from "../firebase/auth"; -import { useNavigate } from "react-router"; - -const Layout: React.FC = () => { - const [cuisineType, setCuisineType] = useState(""); - const [image, setImage] = useState(new File([], '', { type: "image", })); - const [isLoading, setIsLoading] = useState(false); - const [generatedRecipe, setGeneratedRecipe] = useState(null); - const [isInputExpanded, setIsInputExpanded] = useState(true); - const navigate = useNavigate(); - - const generateRecipeFromImageHandler = async ( - image: File, - cuisineType: string - ) => { - setIsLoading(true); - try { - const recipe = await generateRecipeFromImage(image, cuisineType); - setGeneratedRecipe(recipe); - setIsInputExpanded(false); - } catch (error) { - console.error("Error generating text recipe:", error); - // Handle error - } finally { - setIsLoading(false); - } - } - - const handleSave = async () => { - if (!generatedRecipe) return; - const user = await getUser(); - if (user) { - const recipeToSave = { - ...generatedRecipe, - authorId: user.uid, - averageRating: 0, - saves: 0, - tags: generatedRecipe.tags || [] - }; - const savedRecipeId = await publishRecipe(user.uid, recipeToSave); - navigate(`/recipes/${savedRecipeId}`); - } - }; - - return ( -
- {/* Input Section */} -
- - - {isInputExpanded && ( -
- - Image - setImage(e.currentTarget.files ? e.currentTarget.files[0] : image)} - /> - - - Cuisine - - - -
- )} -
- - {/* Result Section */} - {generatedRecipe && ( -
- - -
- -
-
- )} -
- ); -}; - -export default Layout; \ No newline at end of file diff --git a/firebase-ai-friendly-meals/web/app/components/IngredientInput.tsx b/firebase-ai-friendly-meals/web/app/components/IngredientInput.tsx deleted file mode 100644 index 8dac3cee..00000000 --- a/firebase-ai-friendly-meals/web/app/components/IngredientInput.tsx +++ /dev/null @@ -1,54 +0,0 @@ -import React, { useState } from "react"; -import { Button } from "@/components/ui/button"; -import { Field, FieldLabel } from "@/components/ui/field"; -import { Textarea } from "@/components/ui/textarea"; -import { Select } from "@/components/ui/select"; -import { Spinner } from "@/components/ui/spinner"; - -interface IngredientInputProps { - handleSubmit: (ingredients: string, cuisineType: string) => Promise; - isLoading: boolean | string; -} - -export const IngredientInput: React.FC = ({ handleSubmit, isLoading }) => { - const [ingredients, setIngredients] = useState(""); - const [cuisineType, setCuisineType] = useState(""); - - return ( -
{ - e.preventDefault(); - handleSubmit(ingredients, cuisineType) - }} className="space-y-4"> - - Ingredients -