Skip to content

Commit 7f70eb9

Browse files
Merge branch 'main' into feat/PR-advance-analysis
2 parents 2b02d49 + d473c36 commit 7f70eb9

11 files changed

Lines changed: 995 additions & 72 deletions

src/components/AnalysisBanner.jsx

Lines changed: 221 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,221 @@
1+
import React, { useState } from 'react'
2+
import { FiLock, FiLoader, FiInfo, } from 'react-icons/fi'
3+
import { IoMdAnalytics } from "react-icons/io";
4+
import { useApp } from '../context/AppContext'
5+
import PATModal from './PATModal'
6+
import LearnMoreModal from './LearnModeModal'
7+
8+
9+
export default function AnalysisBanner({ page, description, onRun, loading = false, analysisStatus = 'sample', }) {
10+
const { pat } = useApp()
11+
const [open, setOpen] = useState(false)
12+
const [patModalOpen, setPatModalOpen] = useState(false)
13+
14+
if (analysisStatus === 'complete') return null
15+
16+
return (
17+
<>
18+
<div
19+
style={{
20+
marginBottom: 24,
21+
22+
background: 'var(--surface)',
23+
border: '1px solid var(--accent-border)',
24+
borderRadius: 'var(--radius)',
25+
boxShadow: 'var(--shadow-sm)',
26+
27+
padding: '20px 22px',
28+
29+
display: 'flex',
30+
justifyContent: 'space-between',
31+
alignItems: 'center',
32+
gap: 24,
33+
34+
transition: 'var(--transition)',
35+
}}
36+
>
37+
{/* Left */}
38+
39+
<div
40+
style={{
41+
display: 'flex',
42+
alignItems: 'center',
43+
gap: 18,
44+
flex: 1,
45+
}}
46+
>
47+
<div
48+
style={{
49+
width: 48,
50+
height: 48,
51+
borderRadius: 'var(--radius-sm)',
52+
53+
display: 'flex',
54+
alignItems: 'center',
55+
justifyContent: 'center',
56+
57+
background: 'var(--accent-soft)',
58+
border: '1px solid var(--accent-border)',
59+
60+
color: 'var(--accent)',
61+
flexShrink: 0,
62+
}}
63+
>
64+
<IoMdAnalytics size={20} />
65+
66+
</div>
67+
68+
<div>
69+
<div
70+
style={{
71+
display: 'flex',
72+
alignItems: 'center',
73+
gap: 8,
74+
marginBottom: 8,
75+
}}
76+
>
77+
78+
<span
79+
style={{
80+
fontSize: 15,
81+
fontWeight: 700,
82+
color: 'var(--text)',
83+
}}
84+
>
85+
You are viewing <span style={{ color: 'var(--accent)' }}>Standard Analysis</span>
86+
</span>
87+
</div>
88+
89+
<div
90+
style={{
91+
fontSize: 13,
92+
color: 'var(--text2)',
93+
lineHeight: 1.65,
94+
maxWidth: 680,
95+
}}
96+
>
97+
{description}
98+
</div>
99+
</div>
100+
</div>
101+
102+
{/* Right */}
103+
104+
<div
105+
style={{
106+
display: 'flex',
107+
alignItems: 'center',
108+
gap: 10,
109+
flexShrink: 0,
110+
}}
111+
>
112+
<button
113+
type="button"
114+
onClick={() => setOpen(true)}
115+
style={{
116+
padding: '10px 18px',
117+
118+
borderRadius: 'var(--radius-sm)',
119+
120+
background: 'transparent',
121+
122+
border: '1px solid var(--border)',
123+
124+
color: 'var(--text)',
125+
126+
display: 'flex',
127+
alignItems: 'center',
128+
gap: 8,
129+
130+
fontSize: 13,
131+
fontWeight: 500,
132+
133+
transition: 'var(--transition)',
134+
}}
135+
onMouseEnter={e => {
136+
e.currentTarget.style.background = 'var(--surface2)'
137+
e.currentTarget.style.borderColor = 'var(--accent-border)'
138+
}}
139+
onMouseLeave={e => {
140+
e.currentTarget.style.background = 'transparent'
141+
e.currentTarget.style.borderColor = 'var(--border)'
142+
}}
143+
>
144+
<FiInfo size={15} />
145+
Learn More
146+
</button>
147+
148+
<button
149+
type="button"
150+
disabled={loading}
151+
onClick={() => {
152+
if (!pat) {
153+
setPatModalOpen(true)
154+
return
155+
}
156+
157+
onRun()
158+
}}
159+
style={{
160+
padding: '10px 18px',
161+
162+
borderRadius: 'var(--radius-sm)',
163+
164+
border: 'none',
165+
166+
background: 'var(--accent)',
167+
color: '#111',
168+
169+
display: 'flex',
170+
alignItems: 'center',
171+
gap: 8,
172+
173+
fontWeight: 600,
174+
fontSize: 13,
175+
176+
cursor: loading ? 'not-allowed' : 'pointer',
177+
178+
opacity: loading ? 0.65 : 1,
179+
180+
boxShadow: '0 4px 14px rgba(245,197,24,.18)',
181+
182+
transition: 'var(--transition)',
183+
}}
184+
onMouseEnter={e => {
185+
if (!loading) {
186+
e.currentTarget.style.transform = 'translateY(-1px)'
187+
e.currentTarget.style.boxShadow =
188+
'0 8px 22px rgba(245,197,24,.25)'
189+
}
190+
}}
191+
onMouseLeave={e => {
192+
e.currentTarget.style.transform = 'translateY(0)'
193+
e.currentTarget.style.boxShadow =
194+
'0 4px 14px rgba(245,197,24,.18)'
195+
}}
196+
>
197+
{loading ? (
198+
<>
199+
<FiLoader className="spin" size={15} />
200+
Running...
201+
</>
202+
) : (
203+
<>
204+
<FiLock size={14} />
205+
{pat ? 'Run Complete Analysis' : 'Connect PAT & Run'}
206+
</>
207+
)}
208+
</button>
209+
</div>
210+
</div>
211+
<PATModal
212+
open={patModalOpen}
213+
onClose={() => setPatModalOpen(false)}
214+
/>
215+
<LearnMoreModal
216+
open={open}
217+
onClose={() => setOpen(false)}
218+
/>
219+
</>
220+
)
221+
}

0 commit comments

Comments
 (0)