Skip to content

Commit f443f6d

Browse files
authored
Merge pull request #156 from ModusCreateOrg/ADE-200-Adam
[ADE-200] UI fixes
2 parents 5012094 + b22b0e0 commit f443f6d

19 files changed

+58
-21
lines changed
Lines changed: 13 additions & 0 deletions
Loading

frontend/src/common/components/Router/TabNavigation.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import DiagnosticsPage from 'pages/Account/components/Diagnostics/DiagnosticsPag
1818
import ChatPage from 'pages/Chat/ChatPage';
1919
import UploadPage from 'pages/Upload/UploadPage';
2020
import ReportsListPage from 'pages/Reports/ReportsListPage';
21-
import ReportDetailPage from 'pages/Reports/ReportDetailPage';
21+
import ReportDetailPage from 'pages/ReportDetail/ReportDetailPage';
2222
import ProcessingPage from 'pages/Processing/ProcessingPage';
2323

2424
// Import SVG icons

frontend/src/common/components/Router/__tests__/TabNavigation.test.tsx

Lines changed: 41 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,38 @@ import { render as defaultRender, screen } from '@testing-library/react';
33
import TabNavigation from '../TabNavigation';
44
import '@testing-library/jest-dom';
55

6-
// Create a mock i18n instance - MOVED UP before any uses
7-
const mockI18n = {
8-
t: (key: string, options?: Record<string, unknown>) => options?.defaultValue || key,
9-
language: 'en',
10-
languages: ['en'],
11-
use: () => mockI18n, // Return itself for chaining
12-
init: () => mockI18n, // Return itself for chaining
13-
changeLanguage: vi.fn(),
14-
exists: vi.fn(() => true),
15-
addResourceBundle: vi.fn(),
16-
};
6+
// vi.mock calls must come before any variable they reference
7+
// All mocks are hoisted to the top, so we need to define them before they're used
178

189
// Mock i18next
19-
vi.mock('i18next', () => ({
20-
default: mockI18n,
21-
}));
10+
vi.mock('i18next', () => {
11+
return {
12+
default: {
13+
t: (key: string, options?: Record<string, unknown>) => options?.defaultValue || key,
14+
language: 'en',
15+
languages: ['en'],
16+
use: () => ({
17+
t: (key: string, options?: Record<string, unknown>) => options?.defaultValue || key,
18+
language: 'en',
19+
languages: ['en'],
20+
changeLanguage: vi.fn(),
21+
exists: vi.fn(() => true),
22+
addResourceBundle: vi.fn(),
23+
}),
24+
init: () => ({
25+
t: (key: string, options?: Record<string, unknown>) => options?.defaultValue || key,
26+
language: 'en',
27+
languages: ['en'],
28+
changeLanguage: vi.fn(),
29+
exists: vi.fn(() => true),
30+
addResourceBundle: vi.fn(),
31+
}),
32+
changeLanguage: vi.fn(),
33+
exists: vi.fn(() => true),
34+
addResourceBundle: vi.fn(),
35+
},
36+
};
37+
});
2238

2339
// Mock i18next-browser-languagedetector
2440
vi.mock('i18next-browser-languagedetector', () => ({
@@ -36,9 +52,18 @@ vi.mock('react-i18next', () => ({
3652
I18nextProvider: ({ children }: { children: React.ReactNode }) => <>{children}</>,
3753
}));
3854

39-
// Mock common/utils/i18n
55+
// Mock common/utils/i18n using factory function that doesn't depend on mockI18n
4056
vi.mock('common/utils/i18n', () => ({
41-
default: mockI18n,
57+
default: {
58+
t: (key: string, options?: Record<string, unknown>) => options?.defaultValue || key,
59+
language: 'en',
60+
languages: ['en'],
61+
use: vi.fn().mockReturnThis(),
62+
init: vi.fn().mockReturnThis(),
63+
changeLanguage: vi.fn(),
64+
exists: vi.fn(() => true),
65+
addResourceBundle: vi.fn(),
66+
},
4267
}));
4368

4469
// Mock the window object for Ionic

frontend/src/pages/Reports/ReportDetailPage.scss renamed to frontend/src/pages/ReportDetail/ReportDetailPage.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
&__header {
99
padding: 20px var(--padding-horizontal) 16px;
1010
position: relative;
11+
background-image: url('../../assets/img/report-header-bg.svg');
1112
}
1213

1314
&__title-container {

frontend/src/pages/Reports/components/AiAnalysisTab.tsx renamed to frontend/src/pages/ReportDetail/components/AiAnalysisTab.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ const AiAnalysisTab: React.FC<AiAnalysisTabProps> = ({
2727
const flaggedValues: LabValue[] = reportData.labValues.filter(
2828
(value) => value.status !== 'normal',
2929
);
30-
const normalValues: LabValue[] = reportData.labValues.filter(
31-
(value) => value.status === 'normal',
32-
);
30+
const normalValues: LabValue[] = [];
3331

3432
// Format confidence score for display
3533
const confidenceScore = reportData.confidence;

frontend/src/pages/Reports/components/InfoCard.scss renamed to frontend/src/pages/ReportDetail/components/InfoCard.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
}
2828

2929
// Media Queries for larger screens
30-
@media (min-width: 768px) {
30+
@media (width >= 768px) {
3131
.info-card {
3232
max-width: 600px;
3333
margin-left: auto;

0 commit comments

Comments
 (0)