Skip to content

Commit 8843195

Browse files
author
Mansi2007275
committed
Address review feedback: add test runner, restore FAQ data, fix duplicate code, update env vars, fix proxy config, update docs
Signed-off-by: Mansi2007275 <mansi@example.com>
1 parent 1cf7452 commit 8843195

9 files changed

Lines changed: 4339 additions & 16986 deletions

File tree

.gitignore

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
1-
*.pyc
2-
.env
3-
src/config/supported_distros.py
1+
@"
42
node_modules/
5-
react-frontend/node_modules/
6-
backend/node_modules/
7-
react-frontend/build/
8-
log/
93
venv/
10-
node_modules/
11-
backend/node_modules/
4+
.env
5+
build/
6+
dist/
7+
"@ | Out-File -FilePath .gitignore -Encoding utf8

docs/Installation.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ npm install
134134
```bash
135135
cp .env.example .env
136136
```
137-
Ensure `REACT_APP_API_URL` points to your backend URL (e.g., `http://localhost:5000`).
138-
137+
<!-- Ensure `REACT_APP_API_URL` points to your backend URL (e.g., `http://localhost:5000`). -->
138+
Ensure `VITE_REACT_APP_API_URL` points to your backend URL (e.g., `http://localhost:5000`).
139139
#### Start the react frontend application
140140
```bash
141141
npm start

react-frontend/.env.example

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
REACT_APP_API_URL=http://localhost:5000
1+
# // REACT_APP_API_URL=http://localhost:5000
2+
VITE_REACT_APP_API_URL=http://localhost:5000

react-frontend/package-lock.json

Lines changed: 3992 additions & 16949 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

react-frontend/package.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,13 @@
2323
"vite": "^8.0.14",
2424
"web-vitals": "^2.1.4"
2525
},
26+
2627
"scripts": {
2728
"dev": "vite",
29+
"start": "vite",
2830
"build": "vite build",
2931
"preview": "vite preview",
30-
"eject": "react-scripts eject"
32+
"test": "vitest"
3133
},
3234
"eslintConfig": {
3335
"extends": [
@@ -48,10 +50,9 @@
4850
]
4951
},
5052
"devDependencies": {
51-
52-
"autoprefixer": "^10.5.0",
5353
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
54-
55-
"tailwindcss": "^3.4.4"
54+
"autoprefixer": "^10.5.0",
55+
"tailwindcss": "^3.4.4",
56+
"vitest": "^4.1.9"
5657
}
5758
}

react-frontend/src/components/SearchBar.jsx

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,16 @@ function SearchBar({ onSearchPerformed }) {
3232
const [searchError, setSearchError] = useState("");
3333
const [lastSearchParams, setLastSearchParams] = useState(null);
3434

35-
const BASE_URL = useMemo(
36-
() => normalizeApiBaseUrl(process.env.REACT_APP_API_URL),
35+
// // const BASE_URL = useMemo(
36+
// () => normalizeApiBaseUrl(process.env.REACT_APP_API_URL),
37+
// []
38+
// );
39+
40+
const BASE_URL = useMemo(
41+
() => normalizeApiBaseUrl(import.meta.env.VITE_REACT_APP_API_URL),
3742
[]
3843
);
39-
44+
4045
const fetchOSList = useCallback(() => {
4146
fetch(`${BASE_URL}/getSupportedDistros`)
4247
.then((response) => response.json())
@@ -71,15 +76,15 @@ function SearchBar({ onSearchPerformed }) {
7176
}, [selectedOS, searchPerformed]);
7277

7378

74-
const fetchOSList = () => {
75-
console.log(`${import.meta.env.VITE_REACT_APP_API_URL}/getSupportedDistros`)
76-
fetch(`${import.meta.env.VITE_REACT_APP_API_URL}/getSupportedDistros`)
77-
.then((response) => response.json())
78-
.then((data) => {
79-
console.log(data);
80-
setOsList(data);
81-
});
82-
};
79+
// const fetchOSList = () => {
80+
// console.log(`${import.meta.env.VITE_REACT_APP_API_URL}/getSupportedDistros`)
81+
// fetch(`${import.meta.env.VITE_REACT_APP_API_URL}/getSupportedDistros`)
82+
// .then((response) => response.json())
83+
// .then((data) => {
84+
// console.log(data);
85+
// setOsList(data);
86+
// });
87+
// };
8388

8489

8590

@@ -103,9 +108,11 @@ function SearchBar({ onSearchPerformed }) {
103108
const searchTerm = params ? params.value : value;
104109

105110

106-
const apiUrl = `${import.meta.env.VITE_REACT_APP_API_URL}/searchPackages?search_term=${value}&exact_match=${exact}&search_bit_flag=${searchBitFlag}${osFilters}`;
111+
// const apiUrl = `${import.meta.env.VITE_REACT_APP_API_URL}/searchPackages?search_term=${value}&exact_match=${exact}&search_bit_flag=${searchBitFlag}${osFilters}`;
112+
113+
// console.log("Fetch URL:", apiUrl);
114+
107115

108-
console.log("Fetch URL:", apiUrl);
109116

110117
const encodedSearchTerm = encodeURIComponent(searchTerm);
111118
const apiUrl = `${BASE_URL}/searchPackages?search_term=${encodedSearchTerm}&exact_match=${isExact}&search_bit_flag=${searchBitFlag}&page_number=${page}&search_description=${isSearchDescription}&limit=${limit}`;

react-frontend/src/screens/Faq/faq_data.js

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

0 commit comments

Comments
 (0)