File size: 10,826 Bytes
61d29fc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
import React from 'react';
import { ExternalLink, Users, DollarSign, Heart, Mail, Phone, Globe } from 'lucide-react';

/**
 * SplitScreenView Component
 * Shows government decisions on the left, community nonprofits on the right
 * Demonstrates the accountability gap and community response
 */
export default function SplitScreenView({ decision, nonprofits = [] }) {
  // Find nonprofits matching this decision's NTEE code
  const matchingNonprofits = nonprofits.filter(np => 
    np.ntee_code === decision.ntee_code ||
    (decision.ntee_code && np.ntee_code?.startsWith(decision.ntee_code[0])) // Match category
  );
  
  const hasGap = decision.community_gap?.nonprofit_filling_gap;
  
  return (
    <div style={{
      display: 'grid',
      gridTemplateColumns: '1fr 1fr',
      gap: 24,
      marginTop: 20
    }}>
      {/* LEFT RAIL: The Public Sector (Government Decision) */}
      <div style={{
        background: 'white',
        border: '1px solid #eee',
        borderRadius: 12,
        padding: 24
      }}>
        <div style={{
          fontSize: 12,
          fontWeight: 600,
          color: '#666',
          textTransform: 'uppercase',
          letterSpacing: '0.05em',
          marginBottom: 16
        }}>
          🏛️ Public Sector Decision
        </div>
        
        <h3 style={{
          fontSize: 18,
          fontWeight: 600,
          color: '#111',
          marginBottom: 12,
          lineHeight: 1.4
        }}>
          {decision.decision_summary}
        </h3>
        
        <div style={{
          background: '#f9f9f7',
          borderRadius: 8,
          padding: 16,
          marginBottom: 16
        }}>
          <div style={{
            fontSize: 13,
            fontWeight: 500,
            color: '#BA7517',
            marginBottom: 8
          }}>
            Official Rationale:
          </div>
          <div style={{
            fontSize: 15,
            color: '#444',
            lineHeight: 1.5
          }}>
            "{decision.primary_rationale}"
          </div>
        </div>
        
        {hasGap && (
          <div style={{
            background: '#FFF5F0',
            border: '1px solid #D85A30',
            borderRadius: 8,
            padding: 16,
            marginBottom: 16
          }}>
            <div style={{
              fontSize: 14,
              fontWeight: 500,
              color: '#D85A30',
              marginBottom: 6,
              display: 'flex',
              alignItems: 'center',
              gap: 6
            }}>
              ⚠️ The Accountability Gap
            </div>
            <div style={{
              fontSize: 14,
              color: '#666',
              lineHeight: 1.5
            }}>
              {decision.community_gap.description}
            </div>
          </div>
        )}
        
        <div style={{
          fontSize: 13,
          color: '#888',
          paddingTop: 12,
          borderTop: '1px solid #eee'
        }}>
          <div>Outcome: <strong>{decision.outcome}</strong></div>
          <div>Vote: {decision.vote_result}</div>
          <div>Date: {new Date(decision.meeting_date).toLocaleDateString()}</div>
        </div>
      </div>
      
      {/* RIGHT RAIL: The Community Sector (Nonprofits) */}
      <div style={{
        background: 'linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%)',
        border: '1px solid #10b981',
        borderRadius: 12,
        padding: 24
      }}>
        <div style={{
          fontSize: 12,
          fontWeight: 600,
          color: '#059669',
          textTransform: 'uppercase',
          letterSpacing: '0.05em',
          marginBottom: 16
        }}>
          🤝 Community Sector Response
        </div>
        
        {matchingNonprofits.length === 0 ? (
          <div style={{
            textAlign: 'center',
            padding: '2rem',
            color: '#666'
          }}>
            <p style={{ fontSize: 15, marginBottom: 12 }}>
              No nonprofits found filling this gap yet.
            </p>
            <p style={{ fontSize: 13, color: '#888' }}>
              NTEE Code: {decision.ntee_code || 'Not classified'}
            </p>
          </div>
        ) : (
          <>
            <div style={{
              fontSize: 15,
              fontWeight: 500,
              color: '#059669',
              marginBottom: 16
            }}>
              {matchingNonprofits.length} organization{matchingNonprofits.length !== 1 ? 's' : ''} filling this gap:
            </div>
            
            <div style={{ display: 'flex', flexDirection: 'column', gap: 16 }}>
              {matchingNonprofits.map((nonprofit, i) => (
                <NonprofitCard key={i} nonprofit={nonprofit} />
              ))}
            </div>
            
            <div style={{
              marginTop: 20,
              padding: 16,
              background: 'white',
              borderRadius: 8,
              fontSize: 13,
              color: '#666'
            }}>
              <div style={{ fontWeight: 500, color: '#059669', marginBottom: 8 }}>
                💡 Bridge the Gap
              </div>
              <ul style={{ margin: 0, paddingLeft: 20, lineHeight: 1.6 }}>
                <li>Support these organizations with donations or volunteering</li>
                <li>Join their boards to influence systemic change</li>
                <li>Cite their work in public meetings to show solutions exist</li>
              </ul>
            </div>
          </>
        )}
      </div>
    </div>
  );
}

function NonprofitCard({ nonprofit }) {
  return (
    <div style={{
      background: 'white',
      borderRadius: 8,
      padding: 16,
      border: '1px solid #10b981'
    }}>
      <div style={{ marginBottom: 12 }}>
        <h4 style={{
          fontSize: 16,
          fontWeight: 600,
          color: '#111',
          marginBottom: 4
        }}>
          {nonprofit.name}
        </h4>
        <div style={{
          fontSize: 12,
          color: '#666',
          marginBottom: 8
        }}>
          NTEE {nonprofit.ntee_code}: {nonprofit.ntee_description}
        </div>
        <div style={{
          fontSize: 14,
          color: '#444',
          lineHeight: 1.5,
          marginBottom: 12
        }}>
          {nonprofit.mission}
        </div>
      </div>
      
      {/* Services */}
      <div style={{ marginBottom: 12 }}>
        <div style={{
          fontSize: 12,
          fontWeight: 500,
          color: '#059669',
          marginBottom: 6
        }}>
          Services Provided:
        </div>
        <ul style={{
          margin: 0,
          paddingLeft: 20,
          fontSize: 13,
          color: '#666',
          lineHeight: 1.6
        }}>
          {nonprofit.services.slice(0, 3).map((service, i) => (
            <li key={i}>{service}</li>
          ))}
        </ul>
      </div>
      
      {/* Impact */}
      <div style={{
        display: 'grid',
        gridTemplateColumns: '1fr 1fr',
        gap: 12,
        marginBottom: 12,
        padding: 12,
        background: '#f0fdf4',
        borderRadius: 6
      }}>
        {nonprofit.students_served && (
          <div>
            <div style={{ fontSize: 11, color: '#666' }}>Impact</div>
            <div style={{ fontSize: 15, fontWeight: 600, color: '#059669' }}>
              <Users size={14} style={{ display: 'inline', marginRight: 4 }} />
              {nonprofit.students_served.toLocaleString()} students
            </div>
          </div>
        )}
        {nonprofit.families_served && (
          <div>
            <div style={{ fontSize: 11, color: '#666' }}>Impact</div>
            <div style={{ fontSize: 15, fontWeight: 600, color: '#059669' }}>
              <Heart size={14} style={{ display: 'inline', marginRight: 4 }} />
              {nonprofit.families_served.toLocaleString()} families
            </div>
          </div>
        )}
        {nonprofit.youth_served && (
          <div>
            <div style={{ fontSize: 11, color: '#666' }}>Impact</div>
            <div style={{ fontSize: 15, fontWeight: 600, color: '#059669' }}>
              <Users size={14} style={{ display: 'inline', marginRight: 4 }} />
              {nonprofit.youth_served.toLocaleString()} youth
            </div>
          </div>
        )}
        <div>
          <div style={{ fontSize: 11, color: '#666' }}>Annual Budget</div>
          <div style={{ fontSize: 15, fontWeight: 600, color: '#059669' }}>
            <DollarSign size={14} style={{ display: 'inline', marginRight: 2 }} />
            {(nonprofit.annual_budget / 1000).toFixed(0)}K
          </div>
        </div>
      </div>
      
      {/* Contact & Actions */}
      <div style={{
        display: 'flex',
        flexWrap: 'wrap',
        gap: 8,
        marginBottom: 12
      }}>
        {nonprofit.contact.website && (
          <a
            href={nonprofit.contact.website}
            target="_blank"
            rel="noopener noreferrer"
            style={{
              fontSize: 12,
              padding: '6px 12px',
              background: '#059669',
              color: 'white',
              borderRadius: 6,
              textDecoration: 'none',
              display: 'flex',
              alignItems: 'center',
              gap: 4
            }}
          >
            <Globe size={12} />
            Website
          </a>
        )}
        {nonprofit.contact.email && (
          <a
            href={`mailto:${nonprofit.contact.email}`}
            style={{
              fontSize: 12,
              padding: '6px 12px',
              background: 'white',
              color: '#059669',
              border: '1px solid #059669',
              borderRadius: 6,
              textDecoration: 'none',
              display: 'flex',
              alignItems: 'center',
              gap: 4
            }}
          >
            <Mail size={12} />
            Email
          </a>
        )}
      </div>
      
      {/* Opportunities */}
      <div style={{
        display: 'flex',
        gap: 8,
        flexWrap: 'wrap'
      }}>
        {nonprofit.volunteer_opportunities && (
          <span style={{
            fontSize: 11,
            padding: '4px 8px',
            background: '#dcfce7',
            color: '#059669',
            borderRadius: 4,
            fontWeight: 500
          }}>
            ✓ Accepting Volunteers
          </span>
        )}
        {nonprofit.accepting_board_members && (
          <span style={{
            fontSize: 11,
            padding: '4px 8px',
            background: '#fef3c7',
            color: '#d97706',
            borderRadius: 4,
            fontWeight: 500
          }}>
            ⭐ Board Seats Available
          </span>
        )}
      </div>
    </div>
  );
}