Skip to content

Commit 63ff219

Browse files
Merge pull request #33 from akirachix/feature/ci-cd
Feature/ci cd
2 parents 9d10171 + d4616bb commit 63ff219

File tree

7 files changed

+54
-33
lines changed

7 files changed

+54
-33
lines changed

tesfa/src/app/dashboard/components/ChatBot/index.test.tsx

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -20,42 +20,41 @@ describe('ChatWidget', () => {
2020
});
2121
});
2222

23-
test('should send a message and display bot response', async () => {
24-
submitQueryMock.mockResolvedValueOnce({ response: 'Bot response' });
23+
test('should send a message and display bot response', async () => {
24+
submitQueryMock.mockResolvedValueOnce({ response: 'Bot response' });
2525

26-
render(<ChatWidget />);
27-
fireEvent.click(screen.getByLabelText(/open chat/i));
26+
render(<ChatWidget />);
2827

29-
const input = screen.getByLabelText(/chat input/i);
30-
const sendButton = screen.getByLabelText(/send message/i);
28+
const input = screen.getByLabelText(/chat input/i);
29+
const sendButton = screen.getByLabelText(/send message/i);
3130

32-
fireEvent.change(input, { target: { value: 'Hello' } });
33-
expect(sendButton).not.toBeDisabled();
31+
fireEvent.change(input, { target: { value: 'Hello' } });
32+
expect(sendButton).not.toBeDisabled();
3433

35-
fireEvent.click(sendButton);
34+
fireEvent.click(sendButton);
3635

37-
const dots = await screen.findAllByText('.', { selector: '.dot' });
38-
expect(dots.length).toBeGreaterThan(0);
39-
const responseText = await screen.findByText('Bot response');
40-
expect(responseText).toBeInTheDocument();
41-
});
36+
const dots = await screen.findAllByText('.', { selector: '.dot' });
37+
expect(dots.length).toBeGreaterThan(0);
4238

43-
test('should handle submitQuery failure gracefully', async () => {
44-
submitQueryMock.mockRejectedValueOnce(new Error('Failed to load response'));
39+
const responseText = await screen.findByText('Bot response');
40+
expect(responseText).toBeInTheDocument();
41+
});
4542

46-
render(<ChatWidget />);
47-
fireEvent.click(screen.getByLabelText(/open chat/i));
43+
test('should handle submitQuery failure gracefully', async () => {
44+
submitQueryMock.mockRejectedValueOnce(new Error('Failed to load response'));
4845

49-
const input = screen.getByLabelText(/chat input/i);
50-
const sendButton = screen.getByLabelText(/send message/i);
46+
render(<ChatWidget />);
5147

52-
fireEvent.change(input, { target: { value: 'Hi' } });
53-
fireEvent.click(sendButton);
48+
const input = screen.getByLabelText(/chat input/i);
49+
const sendButton = screen.getByLabelText(/send message/i);
5450

55-
const dots = await screen.findAllByText('.', { selector: '.dot' });
56-
expect(dots.length).toBeGreaterThan(0);
51+
fireEvent.change(input, { target: { value: 'Hi' } });
52+
fireEvent.click(sendButton);
5753

58-
const errorText = await screen.findByText('Failed to load response');
59-
expect(errorText).toBeInTheDocument();
60-
});
54+
const dots = await screen.findAllByText('.', { selector: '.dot' });
55+
expect(dots.length).toBeGreaterThan(0);
56+
57+
const errorText = await screen.findByText('Failed to load response');
58+
expect(errorText).toBeInTheDocument();
59+
});
6160
});

tesfa/src/app/dashboard/components/ChatBot/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ function BouncingDots() {
4545
export default function ChatWidget() {
4646
const { submitQuery } = useQueryLog();
4747
const [input, setInput] = useState<string>("");
48-
const [open, setOpen] = useState<boolean>(false);
48+
const [open, setOpen] = useState<boolean>(true);
4949
const [sending, setSending] = useState<boolean>(false);
5050
const [localLogs, setLocalLogs] = useState<Message[]>([]);
5151
const [greeted, setGreeted] = useState<boolean>(false);

tesfa/src/app/dashboard/components/Map/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ const MapClient = () => {
9494
type: 'FeatureCollection',
9595
features: valid.map(country => ({
9696
type: 'Feature',
97-
properties: { ...country, color: country.is_affected ? '#BA6D58' : '#164E63' },
97+
properties: { ...country, color: country.is_affected ? '#BA6D58' : '#386c80ff' },
9898
geometry: country.geometry!,
9999
})),
100100
};
@@ -134,7 +134,7 @@ const MapClient = () => {
134134
type: 'FeatureCollection',
135135
features: valid.map(region=> ({
136136
type: 'Feature',
137-
properties: { ...region, color: region.is_affected ? '#0E0202' : '#164E63' },
137+
properties: { ...region, color: region.is_affected ? '#0E0202' : '#386c80ff' },
138138
geometry: region.geometry!,
139139
})),
140140
};
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
export default function MapLegend() {
2+
const items = [
3+
{ color: "bg-[#BA6D58]", label: "Post war Areas" },
4+
{ color: "bg-[#386c80ff]", label: "No war Areas" },
5+
{ color: "bg-[#00353D]", label: "Not covered yet" },
6+
];
7+
return (
8+
<div className="absolute z-[1150] bottom-6 left-6 p-4 rounded-2xl backdrop-blur-md shadow-lg w-52 ">
9+
<h3 className="font-semibold mb-3">Key</h3>
10+
<div className="space-y-3">
11+
{items.map((item, i) => (
12+
<div key={i} className="flex items-center gap-3">
13+
<span className={`w-6 h-6 rounded-md ${item.color}`}></span>
14+
<p>{item.label}</p>
15+
</div>
16+
))}
17+
</div>
18+
</div>
19+
);
20+
}

tesfa/src/app/dashboard/page.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import dynamic from 'next/dynamic';
55
import Layout from '../sharedComponents/Layout';
66
import ChatWidget from './components/ChatBot';
77
import ProtectedRoute from '../sharedComponents/ProtectedRoot';
8+
import MapLegend from './components/legend';
89
const MapClient = dynamic(() => import('./components/Map'), {
910
ssr: false,
1011
loading: () => <div className="p-4">Loading map...</div>,
@@ -47,6 +48,7 @@ const DashboardPage = () => {
4748
<main className="flex-1 relative">
4849
<MapClient />
4950
<ChatWidget />
51+
<MapLegend/>
5052
</main>
5153
</div>
5254
</Layout>

tesfa/src/app/onboarding/register/components/RegisterForm/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,10 +249,10 @@ export default function RegisterForm({
249249
id="terms"
250250
checked={termsAccepted}
251251
onChange={(e) => setTermsAccepted(e.target.checked)}
252-
className="mt-1 h-5 w-5 text-[#CDA12B] rounded focus:ring-[#CDA12B]"
252+
className="mt-1 h-5 w-5 text-[#CDA12B] cursor-pointer rounded focus:ring-[#CDA12B]"
253253
required
254254
/>
255-
<label htmlFor="terms" className="ml-2 text-[#00353D] text-lg">
255+
<label htmlFor="terms" className="ml-2 cursor-pointer text-[#00353D] text-lg">
256256
I agree to the{" "}
257257
<Link href="/onboarding/terms" className="text-[#CDA12B] hover:underline">
258258
Terms and Conditions.

tesfa/src/app/onboarding/splash/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export default function SplashScreen() {
1919
<div className="flex flex-col items-center justify-center h-screen bg-[#fdf6f6] text-center px-4 py-8">
2020

2121
<Image
22-
src="/Images/Group 166.png"
22+
src="/Images/Group66.png"
2323
alt="Logo"
2424
width={400}
2525
height={200}

0 commit comments

Comments
 (0)