Skip to content
This repository was archived by the owner on Oct 1, 2026. It is now read-only.

Commit 3e49dc7

Browse files
codybmenefeeclaude
andauthored
Fix subscriptionTier schema mismatch (#5)
* Add rotation frequency setting for paddock grazing duration - Add rotationFrequency field to FarmSettings (default: 1 day) - Add slider in Threshold Settings (range 1-10 days) - Show warning when value exceeds 5 days for parasite control - Update schema, mappers, and defaults across frontend/backend Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Fix farm selector displaying wrong name when Clerk org name differs from Convex The trigger was showing the Convex farm name while dropdown items used Clerk org names, causing a mismatch when they diverged. Now consistently uses Clerk org name (source of truth) for both. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Simplify daily brief modal with farmer-focused design Replace technical metrics (NDVI, confidence scores) with plain-language information. New 3-tier layout: stats row with map thumbnail and grass quality badge, expandable reasoning section, and binary approve/reject actions. - Add grassQuality utility for NDVI to quality mapping (prime/ready/recovering/resting) - Add GrassQualityBadge, DaysRemainingIndicator, ExpandableReasoning components - Simplify BriefCard and ApprovedState to match new design - Remove debug reset button Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Remove farm size question from onboarding and auto-set area unit Simplify onboarding by removing the "Total Area" field from the Farm Setup step. Users will draw their paddocks on the map anyway, making this input redundant. Auto-set areaUnit to 'acres' during onboarding since geocoding is US-only. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Add bug reporting feature with GitHub issue integration Users can now report bugs via a modal accessible from the header. Reports are stored in Convex and automatically create GitHub issues with appropriate labels for category and severity. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Add user-based subscription paywall for early access - Add subscription fields to users table (subscriptionStatus, subscriptionId, etc.) - Add getUserSubscription query and syncUserSubscription mutation - Update webhook handler to support user-based billing events (B2C) - Create /subscribe route with Clerk PricingTable component - Add paywall check in _app.tsx before onboarding - Add VITE_PAYWALL_ENABLED env var to toggle paywall (disabled by default) Clerk's has() function doesn't reliably detect free plans, so paywall can be disabled in dev. In production with paid plans, enable via env var. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Fix demo settings redirect and remove free account references Make sidebar settings link context-aware so demo users go to /demo/settings instead of /settings. Remove all "free account" messaging since free access is only available in dev mode. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Remove demo banner and replace profile dropdown with sign-up CTA Simplifies the demo header by removing the demo banner and replacing the profile avatar dropdown with a direct green "Sign Up" button. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Add demo history and analytics pages with sample data Make sidebar navigation demo-aware so History and Analytics buttons route to /demo/history and /demo/analytics when in demo mode. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Add localStorage layer for demo mode with backdate sections tool Implement a localStorage layer for public demo users that intercepts all writes. When VITE_DEV_AUTH=true, writes go to Convex (for developers setting up demo data). When not set, writes go to localStorage (for public demo users), with edits surviving page refresh. New files: - lib/demo/isDemoDevMode.ts - Check for dev auth mode - lib/demo/demoLocalStorage.ts - localStorage CRUD helpers - lib/demo/DemoGeometryProvider.tsx - Intercepts geometry writes - lib/demo/useDemoFarmSettings.ts - Demo-aware settings hook - lib/demo/useDemoObservations.ts - Demo-aware observations hooks - components/demo/DemoDevToolsDropdown.tsx - Dev tools for demo mode Also adds "Backdate Sections (-1 day)" tool to dev tools dropdowns for simulating passage of time when testing demo scenarios. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Enhance demo mode with section staging and professional tier access Demo improvements: - Add historical grazing sections for East Ridge paddock to demonstrate progressive strip grazing pattern (2 executed sections) - Grant professional tier access to demo farms for full feature showcase - Add updateSectionDate mutation for dev tools - Remove demo settings banner (settings now persist via localStorage) Map centering fix: - Compute initial map center from paddock bounds instead of farm geometry - More reliable when farm boundary is out of sync with paddock locations Refactoring: - Switch useFarmSettings to use useFarmContext instead of useFarm - Add updateSectionMetadata to geometry context types Migrations: - Add deleteBadFarmSettings migration - Add updateDemoGeometries migration Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Add section date editing UI in dev mode Enable editing individual section dates through the SectionEditDrawer when in dev mode (VITE_DEV_AUTH=true). This allows testing historical grazing patterns without using the bulk backdate sections tool. - Add date picker to SectionEditDrawer (visible in edit mode for dev) - Wire up handleSectionMetadataChange in DemoGeometryProvider - Implement updateSectionMetadata in GeometryContext Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Force tutorial to open on every demo page visit Add forceStart prop to TutorialProvider that starts the tutorial regardless of completion status. Use a ref to track if we've already force-started so the tutorial closes properly when completed. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Enforce adjacency as primary constraint for section placement Update agent prompts to prioritize adjacency over NDVI targeting. The system prompt now uses numbered priorities with "ADJACENCY FIRST" and "NDVI SECOND", and the drawing instructions use emphatic language ("CRITICAL", "MUST share an edge") to prevent the agent from placing non-adjacent sections. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Fix map focus resetting during vertex editing Prevent the map from resetting its view during geometry editing by: - Removing paddocks and farmGeometry from map init effect dependencies - Caching initial map center in a ref to maintain referential stability - Removing initialSectionFeature from focus effect dependencies so it only triggers on section ID change, not geometry updates - Adding safety guards for map operations during component unmounting Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Fix demo dev mode to use farm-1 directly for mutations and queries In dev mode (VITE_DEV_AUTH=true), the demo page was experiencing a farm ID mismatch where mutations targeted farm-1 but queries used demo-farm-{SESSION}. This caused "Regenerate Demo History" to update the wrong farm's data. Changes: - DemoAuthProvider: Return organizationId='farm-1' in dev mode (no demo session) - DemoFarmProvider: Query farm-1 directly in dev mode - demo.tsx: Handle dev mode where demoSessionId is null - useDemoSeeding: Skip seeding in dev mode, query farm-1 directly - convex/demo.ts: Add historical rotation simulation for realistic demo data Production demo mode is unchanged - visitors still get isolated demo farm copies. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Fix subscriptionTier schema mismatch in demo seeding Changed 'professional' to 'premium' to match the farmSettings schema which only allows 'free' or 'premium' values. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent b7340a5 commit 3e49dc7

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎app/convex/demo.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ async function copyFarmBaseData(
567567
if (sourceSettings) {
568568
await ctx.db.insert('farmSettings', {
569569
farmExternalId: demoFarmId,
570-
subscriptionTier: 'professional', // Demo users get professional features
570+
subscriptionTier: 'premium', // Demo users get premium features
571571
minNDVIThreshold: sourceSettings.minNDVIThreshold,
572572
minRestPeriod: sourceSettings.minRestPeriod,
573573
cloudCoverTolerance: sourceSettings.cloudCoverTolerance,

0 commit comments

Comments
 (0)