hritikm15 commited on
Commit
a78582d
·
verified ·
1 Parent(s): 16ed560

Pest: require district selection + restore B2B auth gate

Browse files
frontend/src/components/PestAlert.jsx CHANGED
@@ -122,11 +122,18 @@ export default function PestAlert({ state, crop, district, block }) {
122
  </div>
123
  </div>
124
 
125
- <button onClick={fetchPest} disabled={loading || !state}
126
- style={{ background: !state ? "#9ca3af" : "#16a34a", color:"#fff", border:"none", borderRadius:"10px", padding:"10px 24px", fontWeight:600, cursor: (!state || loading) ? "not-allowed" : "pointer", opacity: loading ? 0.7 : 1, fontSize:"14px" }}>
127
  {loading ? "Analyzing..." : "Get Pest Risk Forecast"}
128
  </button>
129
 
 
 
 
 
 
 
 
130
  {/* Data level disclaimer */}
131
  <div style={{ marginTop:"12px", padding:"10px 14px", background:"#fffbeb", borderLeft:"4px solid #f59e0b", borderRadius:"0 8px 8px 0", fontSize:"11px", color:"#78350f", lineHeight:1.5 }}>
132
  <strong>Note:</strong> Predictions are at <strong>district level</strong> and largely weather-driven —
 
122
  </div>
123
  </div>
124
 
125
+ <button onClick={fetchPest} disabled={loading || !state || !district}
126
+ style={{ background: (!state || !district) ? "#9ca3af" : "#16a34a", color:"#fff", border:"none", borderRadius:"10px", padding:"10px 24px", fontWeight:600, cursor: (!state || !district || loading) ? "not-allowed" : "pointer", opacity: loading ? 0.7 : 1, fontSize:"14px" }}>
127
  {loading ? "Analyzing..." : "Get Pest Risk Forecast"}
128
  </button>
129
 
130
+ {/* District required prompt */}
131
+ {state && !district && (
132
+ <div style={{ marginTop:"12px", padding:"10px 14px", background:"#fef2f2", borderLeft:"4px solid #dc2626", borderRadius:"0 8px 8px 0", fontSize:"12px", color:"#991b1b", lineHeight:1.5 }}>
133
+ <strong>Please select a district</strong> — pest risk is driven by local weather conditions.
134
+ </div>
135
+ )}
136
+
137
  {/* Data level disclaimer */}
138
  <div style={{ marginTop:"12px", padding:"10px 14px", background:"#fffbeb", borderLeft:"4px solid #f59e0b", borderRadius:"0 8px 8px 0", fontSize:"11px", color:"#78350f", lineHeight:1.5 }}>
139
  <strong>Note:</strong> Predictions are at <strong>district level</strong> and largely weather-driven —