mirror of
https://github.com/ForFarmTeam/ForFarm.git
synced 2025-12-19 14:04:08 +01:00
refac: move map to each dialoge
This commit is contained in:
parent
0c16743230
commit
8f5459acf9
@ -1,12 +1,14 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { Dialog, DialogContent } from "@/components/ui/dialog";
|
import { Dialog, DialogContent, DialogTitle } from "@/components/ui/dialog";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { Card } from "@/components/ui/card";
|
import { Card } from "@/components/ui/card";
|
||||||
import { Check, MapPin } from "lucide-react";
|
import { Check, MapPin } from "lucide-react";
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
import type { Crop } from "@/types";
|
import type { Crop } from "@/types";
|
||||||
|
import { VisuallyHidden } from "@radix-ui/react-visually-hidden";
|
||||||
|
import GoogleMapWithDrawing from "@/components/google-map-with-drawing";
|
||||||
|
|
||||||
interface Plant {
|
interface Plant {
|
||||||
id: string;
|
id: string;
|
||||||
@ -61,6 +63,9 @@ export function CropDialog({ open, onOpenChange, onSubmit }: CropDialogProps) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog open={open} onOpenChange={onOpenChange}>
|
<Dialog open={open} onOpenChange={onOpenChange}>
|
||||||
|
<VisuallyHidden>
|
||||||
|
<DialogTitle></DialogTitle>
|
||||||
|
</VisuallyHidden>
|
||||||
<DialogContent className="sm:max-w-[900px] p-0">
|
<DialogContent className="sm:max-w-[900px] p-0">
|
||||||
<div className="grid md:grid-cols-2 h-[600px]">
|
<div className="grid md:grid-cols-2 h-[600px]">
|
||||||
{/* Left side - Plant Selection */}
|
{/* Left side - Plant Selection */}
|
||||||
@ -97,9 +102,9 @@ export function CropDialog({ open, onOpenChange, onSubmit }: CropDialogProps) {
|
|||||||
{/* Right side - Map */}
|
{/* Right side - Map */}
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
<div className="absolute inset-0 bg-muted/10">
|
<div className="absolute inset-0 bg-muted/10">
|
||||||
{/* Placeholder map - Replace with your map component */}
|
|
||||||
<div className="h-full w-full bg-muted/20 flex items-center justify-center">
|
<div className="h-full w-full bg-muted/20 flex items-center justify-center">
|
||||||
<div className="text-center space-y-2">
|
<GoogleMapWithDrawing />
|
||||||
|
{/* <div className="text-center space-y-2">
|
||||||
<MapPin className="h-8 w-8 mx-auto text-muted-foreground" />
|
<MapPin className="h-8 w-8 mx-auto text-muted-foreground" />
|
||||||
<p className="text-sm text-muted-foreground">
|
<p className="text-sm text-muted-foreground">
|
||||||
Map placeholder
|
Map placeholder
|
||||||
@ -108,7 +113,7 @@ export function CropDialog({ open, onOpenChange, onSubmit }: CropDialogProps) {
|
|||||||
<br />
|
<br />
|
||||||
Lng: {location.lng.toFixed(4)}
|
Lng: {location.lng.toFixed(4)}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div> */}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -25,6 +25,7 @@ import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
|||||||
import { ChatbotDialog } from "./chatbot-dialog";
|
import { ChatbotDialog } from "./chatbot-dialog";
|
||||||
import { AnalyticsDialog } from "./analytics-dialog";
|
import { AnalyticsDialog } from "./analytics-dialog";
|
||||||
import type { Crop, CropAnalytics } from "@/types";
|
import type { Crop, CropAnalytics } from "@/types";
|
||||||
|
import GoogleMapWithDrawing from "@/components/google-map-with-drawing";
|
||||||
|
|
||||||
const getCropById = (id: string): Crop => {
|
const getCropById = (id: string): Crop => {
|
||||||
return {
|
return {
|
||||||
@ -204,17 +205,18 @@ export default function CropDetailPage({ params }: { params: Promise<{ farmId: s
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="space-y-6">
|
<div className="space-y-6">
|
||||||
<Card className="h-[400px]">
|
<Card className="h-[400px] mb-32">
|
||||||
<CardContent className="p-0 h-full">
|
<CardContent className="p-0 h-full">
|
||||||
|
<GoogleMapWithDrawing />
|
||||||
<div className="h-full w-full bg-muted/20 flex items-center justify-center">
|
<div className="h-full w-full bg-muted/20 flex items-center justify-center">
|
||||||
<div className="text-center space-y-2">
|
{/* <div className="text-center space-y-2">
|
||||||
<MapPin className="h-8 w-8 mx-auto text-muted-foreground" />
|
<MapPin className="h-8 w-8 mx-auto text-muted-foreground" />
|
||||||
<p className="text-sm text-muted-foreground">
|
<p className="text-sm text-muted-foreground">
|
||||||
Map placeholder
|
Map placeholder
|
||||||
<br />
|
<br />
|
||||||
Click to view full map
|
Click to view full map
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div> */}
|
||||||
</div>
|
</div>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import PlantingDetailsForm from "./planting-detail-form";
|
import PlantingDetailsForm from "./planting-detail-form";
|
||||||
import HarvestDetailsForm from "./harvest-detail-form";
|
import HarvestDetailsForm from "./harvest-detail-form";
|
||||||
import { Separator } from "@/components/ui/separator";
|
import { Separator } from "@/components/ui/separator";
|
||||||
import GoogleMapWithDrawing from "./google-map-with-drawing";
|
import GoogleMapWithDrawing from "@/components/google-map-with-drawing";
|
||||||
|
|
||||||
export default function SetupPage() {
|
export default function SetupPage() {
|
||||||
return (
|
return (
|
||||||
|
|||||||
71
to_insert.sql
Normal file
71
to_insert.sql
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
INSERT INTO light_profiles (name)
|
||||||
|
VALUES
|
||||||
|
('Full Sun'),
|
||||||
|
('Partial Shade'),
|
||||||
|
('Full Shade');
|
||||||
|
|
||||||
|
INSERT INTO soil_conditions (name)
|
||||||
|
VALUES
|
||||||
|
('Loamy'),
|
||||||
|
('Sandy'),
|
||||||
|
('Clay'),
|
||||||
|
('Silty');
|
||||||
|
|
||||||
|
INSERT INTO harvest_units (name)
|
||||||
|
VALUES
|
||||||
|
('Kilograms'),
|
||||||
|
('Pounds'),
|
||||||
|
('Bushels'),
|
||||||
|
('Tons');
|
||||||
|
|
||||||
|
INSERT INTO plants (
|
||||||
|
uuid, name, variety, row_spacing, optimal_temp, planting_depth, average_height,
|
||||||
|
light_profile_id, soil_condition_id, planting_detail, is_perennial, days_to_emerge,
|
||||||
|
days_to_flower, days_to_maturity, harvest_window, ph_value, estimate_loss_rate,
|
||||||
|
estimate_revenue_per_hu, harvest_unit_id, water_needs
|
||||||
|
)
|
||||||
|
VALUES
|
||||||
|
(
|
||||||
|
'450e8400-e29b-41d4-a716-446655440000', -- UUID
|
||||||
|
'Tomato', -- Name
|
||||||
|
'Cherry', -- Variety
|
||||||
|
0.5, -- Row Spacing (meters)
|
||||||
|
25.0, -- Optimal Temperature (°C)
|
||||||
|
0.02, -- Planting Depth (meters)
|
||||||
|
1.5, -- Average Height (meters)
|
||||||
|
1, -- Light Profile ID (Full Sun)
|
||||||
|
1, -- Soil Condition ID (Loamy)
|
||||||
|
'Plant in well-drained soil.', -- Planting Detail
|
||||||
|
FALSE, -- Is Perennial
|
||||||
|
7, -- Days to Emerge
|
||||||
|
60, -- Days to Flower
|
||||||
|
90, -- Days to Maturity
|
||||||
|
14, -- Harvest Window (days)
|
||||||
|
6.5, -- pH Value
|
||||||
|
0.1, -- Estimate Loss Rate
|
||||||
|
10.0, -- Estimate Revenue per Harvest Unit
|
||||||
|
1, -- Harvest Unit ID (Kilograms)
|
||||||
|
2.5 -- Water Needs (liters per day)
|
||||||
|
),
|
||||||
|
(
|
||||||
|
'550e8400-e29b-41d4-a716-446655440001', -- UUID
|
||||||
|
'Corn', -- Name
|
||||||
|
'Sweet', -- Variety
|
||||||
|
0.75, -- Row Spacing (meters)
|
||||||
|
30.0, -- Optimal Temperature (°C)
|
||||||
|
0.05, -- Planting Depth (meters)
|
||||||
|
2.0, -- Average Height (meters)
|
||||||
|
1, -- Light Profile ID (Full Sun)
|
||||||
|
2, -- Soil Condition ID (Sandy)
|
||||||
|
'Plant in rows with adequate spacing.', -- Planting Detail
|
||||||
|
FALSE, -- Is Perennial
|
||||||
|
10, -- Days to Emerge
|
||||||
|
70, -- Days to Flower
|
||||||
|
100, -- Days to Maturity
|
||||||
|
21, -- Harvest Window (days)
|
||||||
|
6.0, -- pH Value
|
||||||
|
0.15, -- Estimate Loss Rate
|
||||||
|
8.0, -- Estimate Revenue per Harvest Unit
|
||||||
|
2, -- Harvest Unit ID (Pounds)
|
||||||
|
3.0 -- Water Needs (liters per day)
|
||||||
|
);
|
||||||
Loading…
Reference in New Issue
Block a user