All files / src/components/admin/pro-form-sections BasicInformationSection.tsx

100% Statements 5/5
100% Branches 4/4
100% Functions 5/5
100% Lines 5/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90                            117x                             4x                           4x                                           3x                             3x                  
import { AdminBand } from "../AdminPageHead";
import { Input } from "../../ui/input";
import type { ProFormSectionProps } from "./types";
import { Select } from "../../ui/select";
import { Textarea } from "../../ui/textarea";
 
/**
 * BasicInformationSection component displays the core pro information fields.
 * Includes business name, status, WhatsApp, description, and services.
 */
export function BasicInformationSection({
	pro,
	onUpdateField,
}: ProFormSectionProps) {
	return (
		<section className="space-y-3">
			<AdminBand title="Basic Information" />
			<div className="space-y-4">
				<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
					<div>
						<label
							htmlFor="pro-business-name"
							className="mb-1 block text-xs font-semibold uppercase tracking-wider text-foreground-muted"
						>
							Business Name
						</label>
						<Input
							id="pro-business-name"
							value={pro.businessName}
							onChange={(e) => onUpdateField("businessName", e.target.value)}
						/>
					</div>
					<div>
						<label
							htmlFor="pro-status"
							className="mb-1 block text-xs font-semibold uppercase tracking-wider text-foreground-muted"
						>
							Status
						</label>
						<Select
							id="pro-status"
							value={pro.status}
							onChange={(e) =>
								onUpdateField(
									"status",
									e.target.value as "draft" | "published" | "archived",
								)
							}
							className="w-full"
						>
							<option value="draft">Draft</option>
							<option value="published">Published</option>
							<option value="archived">Archived</option>
						</Select>
					</div>
					<div>
						<label
							htmlFor="pro-whatsapp"
							className="mb-1 block text-xs font-semibold uppercase tracking-wider text-foreground-muted"
						>
							WhatsApp
						</label>
						<Input
							id="pro-whatsapp"
							value={pro.whatsapp || ""}
							onChange={(e) => onUpdateField("whatsapp", e.target.value)}
							placeholder="91XXXXXXXXXX"
						/>
					</div>
				</div>
				<div>
					<label
						htmlFor="pro-description"
						className="mb-1 block text-xs font-semibold uppercase tracking-wider text-foreground-muted"
					>
						Description
					</label>
					<Textarea
						id="pro-description"
						value={pro.description || ""}
						onChange={(e) => onUpdateField("description", e.target.value)}
						rows={4}
						className="w-full"
					/>
				</div>
			</div>
		</section>
	);
}