Fix QA feedback: type imports, query methods, implicit any, null guards, accessibility
- Import Pet/MedicalAlert/CoatType/AlertSeverity from @groombook/types (workspace dep) - Replace getByPlaceholder with getByPlaceholderText in test file - Add explicit MedicalAlert type to destructured alert param in PetForm - Add null guards for HTMLElement | undefined in test lines 79/111 - Add htmlFor=coat-type label association for accessible combobox Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { useState } from "react";
|
||||
import { X, Save, Plus, Star } from "lucide-react";
|
||||
import type { Pet, MedicalAlert, CoatType, AlertSeverity } from "../../../../packages/types/src/index.js";
|
||||
import type { Pet, MedicalAlert, CoatType, AlertSeverity } from "@groombook/types";
|
||||
|
||||
const COAT_TYPES: CoatType[] = ["double", "single", "wire", "curly", "smooth", "long", "short", "hairless"];
|
||||
const SEVERITY_OPTIONS: AlertSeverity[] = ["low", "medium", "high"];
|
||||
@@ -24,7 +24,7 @@ export function PetForm({ pet, onSave, onCancel }: Props) {
|
||||
const [preferredCuts, setPreferredCuts] = useState<string[]>(pet?.preferredCuts ?? []);
|
||||
const [cutInput, setCutInput] = useState("");
|
||||
const [alerts, setAlerts] = useState<Omit<MedicalAlert, "id">[]>(
|
||||
pet?.medicalAlerts?.map(({ type, description, severity }) => ({ type, description, severity })) ?? []
|
||||
pet?.medicalAlerts?.map((alert: MedicalAlert) => ({ type: alert.type, description: alert.description, severity: alert.severity })) ?? []
|
||||
);
|
||||
const [alertErrors, setAlertErrors] = useState<Record<number, string>>({});
|
||||
|
||||
@@ -145,8 +145,9 @@ export function PetForm({ pet, onSave, onCancel }: Props) {
|
||||
|
||||
{/* Coat Type */}
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-stone-600 mb-1">Coat Type</label>
|
||||
<label htmlFor="coat-type" className="block text-sm font-medium text-stone-600 mb-1">Coat Type</label>
|
||||
<select
|
||||
id="coat-type"
|
||||
value={coatType}
|
||||
onChange={e => setCoatType(e.target.value as CoatType)}
|
||||
className="w-full border border-stone-200 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-(--color-accent) bg-white"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useState, useEffect } from "react";
|
||||
import { PawPrint, Heart, Scissors, Clock, Edit3, Loader2, Star, X } from "lucide-react";
|
||||
import { PetForm } from "./PetForm.js";
|
||||
import type { Pet } from "../../../../packages/types/src/index.js";
|
||||
import type { Pet } from "@groombook/types";
|
||||
|
||||
interface Appointment {
|
||||
id: string;
|
||||
|
||||
Reference in New Issue
Block a user