Skip to content

Commit

Permalink
updated packages and fixed parse csv bug with additional white spaces.
Browse files Browse the repository at this point in the history
  • Loading branch information
suous committed Sep 27, 2024
1 parent b7de0e3 commit 38013b9
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 52 deletions.
Binary file modified bun.lockb
Binary file not shown.
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "waview",
"private": true,
"version": "0.1.1",
"version": "0.1.2",
"type": "module",
"scripts": {
"dev": "vite",
Expand All @@ -14,8 +14,8 @@
"dependencies": {
"@emotion/react": "^11.13.3",
"@emotion/styled": "^11.13.0",
"@mui/icons-material": "^6.1.0",
"@mui/material": "^6.1.0",
"@mui/icons-material": "^6.1.1",
"@mui/material": "^6.1.1",
"@tauri-apps/api": "^1.6.0",
"chart.js": "^4.4.4",
"chartjs-plugin-zoom": "^2.0.1",
Expand All @@ -27,22 +27,22 @@
"react-i18next": "^15.0.2"
},
"devDependencies": {
"@eslint/js": "^9.10.0",
"@eslint/js": "^9.11.1",
"@tauri-apps/cli": "^1.6.2",
"@types/react": "^18.3.7",
"@types/react": "^18.3.9",
"@types/react-color": "^3.0.12",
"@types/react-dom": "^18.3.0",
"@vitejs/plugin-react": "^4.3.1",
"eslint": "^9.10.0",
"eslint": "^9.11.1",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-react": "^7.36.1",
"eslint-plugin-react": "^7.37.0",
"globals": "^15.9.0",
"husky": "^9.1.6",
"lint-staged": "^15.2.10",
"prettier": "3.3.3",
"typescript": "^5.6.2",
"typescript-eslint": "^8.6.0",
"vite": "^5.4.6"
"typescript-eslint": "^8.7.0",
"vite": "^5.4.8"
}
}
70 changes: 35 additions & 35 deletions src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "waview"
version = "0.1.1"
version = "0.1.2"
description = "🌊 WaView - Simple and tiny CSV waveform viewer"
authors = ["suous"]
edition = "2021"
Expand Down
11 changes: 8 additions & 3 deletions src-tauri/src/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,20 @@ pub fn read_csv_to_waveform(path: &str) -> Result<Waveform, Box<dyn Error>> {
.flexible(true)
.from_reader(csv_data.as_slice());

let headers = reader.headers()?.clone();
let headers: Vec<String> = reader.headers()?
.iter()
.map(str::trim)
.map(String::from)
.collect();

let mut waveform: Waveform = headers.iter()
.map(|header| (header.to_string(), Vec::new()))
.map(|header| (header.clone(), Vec::new()))
.collect();

for result in reader.records() {
let record = result?;
for (header, field) in headers.iter().zip(record.iter()) {
if let Ok(value) = field.parse::<f64>() {
if let Ok(value) = field.trim().parse::<f64>() {
waveform.get_mut(header).unwrap().push(value);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"package": {
"productName": "waview",
"version": "0.1.1"
"version": "0.1.2"
},
"tauri": {
"allowlist": {
Expand Down
4 changes: 1 addition & 3 deletions src/pages/components/Drawer/FileItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ export default function FileItem({ file, underAnalysis }: Props): JSX.Element {
`${t('Will delete the file from the imported files list, ')}${t('You cannot undo this action.')}`,
t('Delete the file form the imported file list?')
)
.then(res => {
if (res) deleteFile(file);
})
.then(res => res && deleteFile(file))
.catch(console.error);

return (
Expand Down

0 comments on commit 38013b9

Please sign in to comment.