Skip to content

Commit

Permalink
changed function name in export.rs and added and deleted a few commen…
Browse files Browse the repository at this point in the history
…ts in TasksView.js
  • Loading branch information
Piyuuussshhh committed Sep 17, 2024
1 parent 0cca2a3 commit ac3c6d8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 17 deletions.
6 changes: 3 additions & 3 deletions src-tauri/src/export.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use crate::db::{
},
};

fn get_python_input(conn: &Connection, todos: &[Todo]) -> Vec<(String, String)> {
fn get_parent_group_and_todo(conn: &Connection, todos: &[Todo]) -> Vec<(String, String)> {
let mut res: Vec<(String, String)> = Vec::new();
for todo in todos.iter() {
if todo.id == 0 {
Expand Down Expand Up @@ -75,8 +75,8 @@ fn generate_ordered_list(map: HashMap<String, Vec<String>>, is_completed: bool)
}

fn generate_html(conn: &Connection, active_tasks: Vec<Todo>, completed_tasks: Vec<Todo>) -> String {
let active_tasks_inp: Vec<(String, String)> = get_python_input(conn, &active_tasks);
let completed_tasks_inp: Vec<(String, String)> = get_python_input(conn, &completed_tasks);
let active_tasks_inp: Vec<(String, String)> = get_parent_group_and_todo(conn, &active_tasks);
let completed_tasks_inp: Vec<(String, String)> = get_parent_group_and_todo(conn, &completed_tasks);

let pdf_css = format!(
"
Expand Down
15 changes: 1 addition & 14 deletions src/views/TasksView/TasksView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,6 @@ import { addItem } from "../../utility/AddRemoveUpdateItems";
import { updateFrontend } from "../../utility/UpdateFrontend";
import CompletedTasksModal from "../../components/CompletedTasksModal";

/*
TODO -> ERROR HANDLING.
We don't handle errors when the input string in
Parent Name in the add item model is not an actual
valid parent group.
Arnav's idea: Instead of a textbox, use a dropdown menu
to display the available parent groups.
*/

const NOT_FOUND = -1;

const TasksView = ({ isSidebarOpen, mainAreaRef }) => {
Expand All @@ -39,10 +29,6 @@ const TasksView = ({ isSidebarOpen, mainAreaRef }) => {
const [showCompleted, setCompletedTasksVisibility] = useState(false);
const [preselectGroup, setPreselectGroup] = useState(ROOT);

/*
Probably should not do this, and just add the task to
the JSON object in sessionStorage. SEE TOP TODO.
*/
useEffect(() => {
async function fetchTasks() {
const storedView = sessionStorage.getItem(TASKS_VIEW);
Expand Down Expand Up @@ -156,6 +142,7 @@ const TasksView = ({ isSidebarOpen, mainAreaRef }) => {
try {
await invoke(TAURI_EXPORT_TO_PDF);
} catch (e) {
// Error handling required.
console.log(e);
}
};
Expand Down

0 comments on commit ac3c6d8

Please sign in to comment.