Skip to content

Commit 3ce273b

Browse files
committed
fix: address remaining copilot review feedback
Signed-off-by: kartik <kartikrautan0@gmail.com>
1 parent 48bae19 commit 3ce273b

File tree

11 files changed

+145
-128
lines changed

11 files changed

+145
-128
lines changed

dco_log.txt

7.11 KB
Binary file not shown.

dco_log_utf8.txt

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
c10cf29 | kartik <kartikrautan0@gmail.com> | Merge branch 'differentLanguageSupport' of https://github.com/kartikrautan/template-playground into differentLanguageSupport | Signed-off-by: kartik <kartikrautan0@gmail.com>
2+
3+
d6199d2 | kartik <kartikrautan0@gmail.com> | Updation on copilot reviews |
4+
9a71e91 | Kartik Rautan <kartikrautan0@gmail.com> | Merge branch 'main' into differentLanguageSupport |
5+
76717a7 | Harshit Kumar <10harshitkumar@gmail.com> | feat: Implement Error Boundary for better error handling (#734) | * feat: add ErrorBoundary to prevent app crashes
6+
7+
Signed-off-by: Harshit Kumar <10harshitkumar@gmail.com>
8+
9+
* refactor: address code review feedback
10+
11+
- Add type='button' to prevent unintended form submission
12+
- Hide error details in production for security (only show in dev mode)
13+
14+
Signed-off-by: Harshit Kumar <10harshitkumar@gmail.com>
15+
16+
* test(ErrorBoundary): add comprehensive test coverage for error boundary component
17+
18+
Signed-off-by: Harshit Kumar <10harshitkumar@gmail.com>
19+
20+
* feat(ErrorBoundary): add theme-aware colors and component stack to error details
21+
22+
Signed-off-by: Harshit Kumar <10harshitkumar@gmail.com>
23+
24+
* fix(ErrorBoundary): address Copilot review suggestions for test quality
25+
26+
- Add showDevDetails prop for testable dev mode control
27+
28+
- Fix window.location.reload mock to avoid test pollution
29+
30+
- Correct dark mode color to #121212 (matches store)
31+
32+
- Remove import.meta.env.DEV mutations (read-only property)
33+
34+
Signed-off-by: Harshit Kumar <10harshitkumar@gmail.com>
35+
36+
* fix(ErrorBoundary): resolve TypeScript error in test
37+
38+
Signed-off-by: Harshit Kumar <10harshitkumar@gmail.com>
39+
40+
* fix(ErrorBoundary): implement 3 additional Copilot suggestions
41+
42+
- Properly type consoleErrorSpy as MockInstance (no eslint-disable)
43+
44+
- Add async/await for component stack test to handle state update timing
45+
46+
- Capture and restore Zustand state in theme test to prevent order-dependency
47+
48+
Signed-off-by: Harshit Kumar <10harshitkumar@gmail.com>
49+
50+
---------
51+
52+
Signed-off-by: Harshit Kumar <10harshitkumar@gmail.com>
53+
Co-authored-by: Matt Roberts <7544022+mttrbrts@users.noreply.github.com>
54+
7b51f8a | kartik <kartikrautan0@gmail.com> | Merge remote-tracking branch 'upstream/main' into differentLanguageSupport | Signed-off-by: kartik <kartikrautan0@gmail.com>
55+
56+
# Conflicts:
57+
# package-lock.json
58+
59+
b8ead94 | kartik <kartikrautan0@gmail.com> | Different Language Support | Signed-off-by: kartik <kartikrautan0@gmail.com>
60+
61+
cb2e662 | Vaggelis Argyropoulos <69078031+Vaggelis-Arg@users.noreply.github.com> | fix(AIConfigPopup): UX: validate model selection and allow API key visibility (#744) | Signed-off-by: Evangelos Argyropoulos <vag.argyropoulos@gmail.com>
62+
1272f54 | Majoju Vaishnavi <majojuvaishnavi@gmail.com> | feat(playground): improve default agreement sample (#702) | * feat(playground): improve default agreement sample to better reflect legal use case
63+
64+
Signed-off-by: Vaishnavi <majojuvaishnavi@gmail.com>
65+
66+
* Update Service Agreement template
67+
68+
Signed-off-by: Vaishnavi <majojuvaishnavi@gmail.com>
69+
70+
---------
71+
72+
Signed-off-by: Vaishnavi <majojuvaishnavi@gmail.com>
73+
Co-authored-by: Matt Roberts <7544022+mttrbrts@users.noreply.github.com>
74+
ddf33c2 | Kartik Rautan <kartikrautan0@gmail.com> | fix: Replace plaintext API key storage with hardware-backed WebAuthn PRF + AES-GCM encryption (#762) | * Replaced plaintext storage with WebAuthn PRF encryption
75+
76+
Signed-off-by: kartik <kartikrautan0@gmail.com>
77+
78+
* Updation on copilot reviews
79+
80+
Signed-off-by: kartik <kartikrautan0@gmail.com>
81+
82+
---------
83+
84+
Signed-off-by: kartik <kartikrautan0@gmail.com>

pr_diff.txt

1.17 MB
Binary file not shown.

src/components/Navbar.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,8 @@ function Navbar() {
213213
void i18n.changeLanguage(lng);
214214
};
215215

216-
const currentLang = LANGUAGES.find(l => l.code === i18n.language) || LANGUAGES[0];
216+
const currentLanguageCode = i18n.resolvedLanguage || (i18n.language ? i18n.language.split('-')[0] : 'en');
217+
const currentLang = LANGUAGES.find(l => l.code === currentLanguageCode) || LANGUAGES[0];
217218

218219
const props = useSpring({
219220
loop: true,
@@ -231,7 +232,7 @@ function Navbar() {
231232
<MenuItem
232233
key={lang.code}
233234
onClick={() => changeLanguage(lang.code)}
234-
className={i18n.language === lang.code ? 'bg-gray-100 dark:bg-gray-700 font-semibold' : ''}
235+
className={currentLanguageCode === lang.code ? 'bg-gray-100 dark:bg-gray-700 font-semibold' : ''}
235236
>
236237
<span>{lang.flag}</span>
237238
<span>{lang.label}</span>

src/tests/components/Footer.test.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@ import { render } from "@testing-library/react";
22
import { describe, it, expect, vi, beforeAll } from "vitest";
33
import Footer from "../../components/Footer";
44

5-
vi.mock('react-i18next', async () => {
6-
const { reactI18nextMock } = await import("../../utils/testing/i18nMock");
7-
return reactI18nextMock;
8-
});
5+
96

107
vi.mock("../../public/logo.png", () => ({
118
default: "logo.png",

src/tests/components/Navbar.test.tsx

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,9 @@ import { render, screen, fireEvent } from "@testing-library/react";
22
import "@testing-library/jest-dom";
33
import Navbar from "../../components/Navbar";
44
import { MemoryRouter } from "react-router-dom";
5-
import { vi, describe, it, expect, afterEach } from "vitest";
6-
import { mockChangeLanguage } from "../../utils/testing/i18nMock";
7-
8-
vi.mock("react-i18next", async () => {
9-
const { reactI18nextMock } = await import("../../utils/testing/i18nMock");
10-
return {
11-
useTranslation: () => ({
12-
t: (key: string) => {
13-
const map: Record<string, string> = {
14-
"navbar.templatePlayground": "Template Playground",
15-
"navbar.github": "GitHub",
16-
"navbar.help": "Help",
17-
"navbar.learn": "Learn Now",
18-
"navbar.discord": "Discord",
19-
"navbar.about": "About",
20-
"navbar.community": "Community",
21-
"navbar.issues": "Issues",
22-
"navbar.documentation": "Documentation",
23-
"navbar.info": "Info",
24-
"navbar.language": "Language",
25-
};
26-
return map[key] || key;
27-
},
28-
i18n: reactI18nextMock.useTranslation().i18n,
29-
}),
30-
};
31-
});
5+
import { describe, it, expect, afterEach } from "vitest";
6+
7+
import { mockChangeLanguage } from "../../utils/testing/setup";
328

339
const renderNavbar = () => {
3410
render(

src/tests/components/PlaygroundSidebar.test.tsx

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,7 @@ import PlaygroundSidebar from "../../components/PlaygroundSidebar";
44
import { vi } from "vitest";
55

66

7-
vi.mock('react-i18next', async () => {
8-
const { reactI18nextMock } = await import("../../utils/testing/i18nMock");
9-
return {
10-
useTranslation: () => ({
11-
t: (key: string) => {
12-
const map: Record<string, string> = {
13-
'sidebar.editor': 'Editor',
14-
'sidebar.preview': 'Preview',
15-
'sidebar.problems': 'Problems',
16-
'sidebar.aiAssistant': 'AI Assistant',
17-
'sidebar.share': 'Share',
18-
'sidebar.startTour': 'Start Tour',
19-
'sidebar.settings': 'Settings',
20-
'sidebar.fullscreen': 'Fullscreen'
21-
};
22-
return map[key] || key;
23-
},
24-
i18n: reactI18nextMock.useTranslation().i18n,
25-
})
26-
};
27-
});
7+
288

299
// Mock the store
3010
vi.mock("../../store/store", () => ({

src/tests/components/SettingsModal.test.tsx

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,7 @@ import { describe, it, expect, vi, beforeEach } from 'vitest';
22
import { render, screen } from '@testing-library/react';
33
import SettingsModal from '../../components/SettingsModal';
44

5-
vi.mock('react-i18next', async () => {
6-
const { reactI18nextMock } = await import('../../utils/testing/i18nMock');
7-
return {
8-
useTranslation: () => ({
9-
t: (key: string) => {
10-
const map: Record<string, string> = {
11-
'settings.title': 'Settings',
12-
'settings.darkMode': 'Dark Mode',
13-
'settings.darkModeDescription': 'Toggle between light and dark theme',
14-
'settings.showLineNumbers': 'Show Line Numbers',
15-
'settings.lineNumbersDescription': 'Display line numbers in code editors'
16-
};
17-
return map[key] || key;
18-
},
19-
i18n: reactI18nextMock.useTranslation().i18n,
20-
})
21-
};
22-
});
5+
236

247
// Mock the store - use inline functions to avoid hoisting issues
258
vi.mock('../../store/store', () => {

src/tests/components/__snapshots__/Footer.test.tsx.snap

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ exports[`Footer > matches the snapshot 1`] = `
4848
class="ant-typography css-dev-only-do-not-override-17a39f8"
4949
style="color: rgba(255, 255, 255, 0.65);"
5050
>
51-
footer.tagline
51+
The open-source smart legal contract stack
5252
</span>
5353
</div>
5454
<div
@@ -84,7 +84,7 @@ exports[`Footer > matches the snapshot 1`] = `
8484
type="button"
8585
>
8686
<span>
87-
footer.join
87+
Join
8888
</span>
8989
</button>
9090
</a>
@@ -120,7 +120,7 @@ exports[`Footer > matches the snapshot 1`] = `
120120
</svg>
121121
</span>
122122
<span>
123-
footer.otherLinks
123+
Other Links
124124
</span>
125125
</button>
126126
</div>
@@ -136,7 +136,7 @@ exports[`Footer > matches the snapshot 1`] = `
136136
class="ant-typography css-dev-only-do-not-override-17a39f8"
137137
style="color: rgba(255, 255, 255, 0.85);"
138138
>
139-
footer.copyright © 2026 accord project •
139+
copyright © 2026 accord project •
140140
<a
141141
class="ant-typography css-dev-only-do-not-override-17a39f8"
142142
href="https://accordproject.org/privacy"
@@ -145,7 +145,7 @@ exports[`Footer > matches the snapshot 1`] = `
145145
target="_blank"
146146
>
147147
<strong>
148-
footer.trademarkPolicy
148+
trademark policy
149149
</strong>
150150
</a>
151151
@@ -157,7 +157,7 @@ exports[`Footer > matches the snapshot 1`] = `
157157
target="_blank"
158158
>
159159
<strong>
160-
footer.brandAssets
160+
brand assets
161161
</strong>
162162
</a>
163163
</span>

src/utils/testing/i18nMock.ts

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)