Skip to content

Commit 25be032

Browse files
committed
app modified
1 parent 4bece1d commit 25be032

File tree

2 files changed

+13
-16
lines changed

2 files changed

+13
-16
lines changed

app/backend/app.jl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,10 @@ for (endpoint, readability_function) in readability_endpoints
5050
post_request_handler(endpoint, readability_function)
5151
end
5252

53-
Oxygen.serve(host="0.0.0.0", port=5050, middleware=[CorsHandler])
53+
Oxygen.serve(
54+
host="0.0.0.0",
55+
port=5050,
56+
middleware=[CorsHandler],
57+
docs=false,
58+
metrics=false
59+
)

app/frontend/src/routes/index.tsx

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,6 @@ function Metrics() {
7171
setSelectedMetrics(allMetrics);
7272
};
7373

74-
/**
75-
* Closes the dropdown if the click event target does not have a parent
76-
* element with the class "dropdown".
77-
*
78-
* @param {MouseEvent} event - The click event.
79-
*/
8074
const closeDropdownOnOutsideClick = (event: MouseEvent) => {
8175
if (!(event.target as Element).closest(".dropdown")) {
8276
setIsDropdownOpen(false);
@@ -181,13 +175,6 @@ function Metrics() {
181175
"Words": 0,
182176
});
183177

184-
/**
185-
* Sends a POST request to the specified route with the provided text data.
186-
* @param metricType The name of the metric to update in the metricResponses signal.
187-
* @param route The API route to send the request to.
188-
* @returns Promise<void>
189-
* @throws Error if the network response is not ok.
190-
*/
191178
async function postData(metricType: string, route: string): Promise<void> {
192179
const text: string = (document.querySelector("textarea") as HTMLTextAreaElement).value;
193180
const endpoint: string = `https://readability-jl-api.onrender.com/${route}`;
@@ -261,13 +248,17 @@ function Metrics() {
261248
}
262249

263250
function downloadMetrics() {
264-
const data: { [key: string]: number } = metricResponses();
251+
const data = metricResponses();
265252
const csvContent =
266253
"data:text/csv;charset=utf-8," +
267254
"metric,value\n" +
268255
Object.keys(data)
269256
.map((key) => {
270-
return `${key},${data[key]}`;
257+
let formattedValue: string | number = data[key];
258+
if (key === "Average Reading Time" || key === "Average Speaking Time") {
259+
formattedValue = `${formattedValue} seconds`;
260+
}
261+
return `${key},${formattedValue}`;
271262
})
272263
.join("\n");
273264
const encodedUri = encodeURI(csvContent);

0 commit comments

Comments
 (0)