Fix multiple onboarding and navigation issues

**1. Remove duplicate navigation buttons in SetupWizard**
- Removed external navigation footer from SetupWizard (lines 370-383)
- All setup wizard steps now have only internal navigation buttons
- Prevents confusion with double Continue buttons in onboarding

**2. Fix quality template API call failure**
- Fixed userId validation in QualitySetupStep:17
- Changed from defaulting to empty string to undefined
- Added validation check before API call to prevent UUID errors
- Disabled submit button when userId not available
- Added error message display for missing user

Related: frontend/src/components/domain/setup-wizard/steps/QualitySetupStep.tsx:17,51-54,376

**3. Delete regular tours implementation (keep demo tour)**
Removed custom tours system while preserving demo tour functionality:
- Deleted TourContext.tsx and TourProvider
- Deleted Tour UI components folder
- Deleted tours/tours.ts definitions
- Deleted tour.json translations
- Removed TourProvider from App.tsx
- Removed TourButton from Sidebar

Demo tour (useDemoTour, driver.js) remains intact and functional.

Files deleted:
- frontend/src/contexts/TourContext.tsx
- frontend/src/components/ui/Tour/* (all files)
- frontend/src/tours/tours.ts
- frontend/src/locales/es/tour.json

**4. Issues verified/confirmed:**
- Quality type select UI already working (callback setState pattern)
- Inventory lots UI confirmed present in InventorySetupStep:683,788,833
- Lots UI visible after adding ingredients in onboarding flow

**Build Status:** ✓ All changes verified, build successful in 21.95s
This commit is contained in:
Claude
2025-11-06 21:26:09 +00:00
parent b9914e9af3
commit 163d4ba60d
12 changed files with 16 additions and 1110 deletions

View File

@@ -14,7 +14,7 @@ export const QualitySetupStep: React.FC<SetupStepProps> = ({ onUpdate, onComplet
const currentTenant = useCurrentTenant();
const user = useAuthUser();
const tenantId = currentTenant?.id || user?.tenant_id || '';
const userId = user?.id || '';
const userId = user?.id; // Keep undefined if not available - backend requires valid UUID
// Fetch quality templates
const { data: templatesData, isLoading } = useQualityTemplates(tenantId);
@@ -48,6 +48,12 @@ export const QualitySetupStep: React.FC<SetupStepProps> = ({ onUpdate, onComplet
const validateForm = (): boolean => {
const newErrors: Record<string, string> = {};
if (!userId) {
newErrors.form = t('common:error_loading_user', 'User not loaded. Please wait or refresh the page.');
setErrors(newErrors);
return false;
}
if (!formData.name.trim()) {
newErrors.name = t('setup_wizard:quality.errors.name_required', 'Name is required');
}
@@ -358,10 +364,16 @@ export const QualitySetupStep: React.FC<SetupStepProps> = ({ onUpdate, onComplet
</div>
</div>
{errors.form && (
<div className="p-3 bg-[var(--color-error)]/10 border border-[var(--color-error)]/20 rounded-lg text-sm text-[var(--color-error)]">
{errors.form}
</div>
)}
<div className="flex gap-2 pt-2">
<button
type="submit"
disabled={createTemplateMutation.isPending}
disabled={createTemplateMutation.isPending || !userId}
className="px-4 py-2 bg-[var(--color-primary)] text-white rounded-lg hover:bg-[var(--color-primary-dark)] disabled:opacity-50 disabled:cursor-not-allowed transition-colors font-medium"
>
{createTemplateMutation.isPending ? (