From 06304dfc7de3dec1096c2fa8e2ae17264bf7ab3c Mon Sep 17 00:00:00 2001 From: Jonas Braus Date: Wed, 4 Nov 2026 23:16:38 +0100 Subject: [PATCH] . --- src-tauri/src/data.rs | 7 ++++++- src-tauri/src/note.rs | 2 +- src-tauri/tauri.conf.json | 2 +- src/index.html | 7 +++++++ src/main.js | 9 +++++++-- src/styles_default.css | 12 +++++++++++- 6 files changed, 33 insertions(+), 6 deletions(-) diff --git a/src-tauri/src/data.rs b/src-tauri/src/data.rs index bb5c279..a059124 100644 --- a/src-tauri/src/data.rs +++ b/src-tauri/src/data.rs @@ -1,4 +1,6 @@ use rusqlite::Connection; +use std::{env, path::PathBuf}; +use std::fs; #[path = "note.rs"] mod note; @@ -6,7 +8,10 @@ use note::Note; #[tauri::command] pub fn get_notes_list(search: &str) -> Vec { - let conn = Connection::open("notes.db").expect("Failed to open database"); + let app_dir = PathBuf::from(env::var("HOME").unwrap_or_else(|_| ".".into())) + .join(".notesapp"); + fs::create_dir_all(&app_dir).expect("Failed to create app dir"); + let conn = Connection::open(app_dir.join("notes.db")).expect("Failed to open database"); conn.execute( "CREATE TABLE IF NOT EXISTS notes diff --git a/src-tauri/src/note.rs b/src-tauri/src/note.rs index 5095b8e..f585a5c 100644 --- a/src-tauri/src/note.rs +++ b/src-tauri/src/note.rs @@ -1,4 +1,4 @@ -#[derive(serde::Serialize)] +#[derive(serde::Serialize)] pub struct Note { pub id: u32, pub title: String, diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 3c7adea..dbed134 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -12,7 +12,7 @@ { "title": "Notes", "transparent": true, - "width": 950, + "width": 1100, "height": 600, "minWidth": 800, "minHeight": 500 diff --git a/src/index.html b/src/index.html index 1cb3757..d1cb497 100644 --- a/src/index.html +++ b/src/index.html @@ -47,6 +47,13 @@
+ +
+ + + + +
\ No newline at end of file diff --git a/src/main.js b/src/main.js index f151d0d..9705c3d 100644 --- a/src/main.js +++ b/src/main.js @@ -44,8 +44,13 @@ async function get_notes_list() { let item = document.createElement("div"); item.innerHTML = ` -
-

${note.title}

+
+
+ + + +

${note.title}

+

${new Date(note.created_at).toDateString()} ${new Date(note.created_at).toLocaleTimeString().split(':')[0]}:${new Date(note.created_at).toLocaleTimeString().split(':')[1]}

diff --git a/src/styles_default.css b/src/styles_default.css index 2c355c3..02e261f 100644 --- a/src/styles_default.css +++ b/src/styles_default.css @@ -6,6 +6,7 @@ --color-text: #aaa; --color-icon: #808080; --color-accent: #1e88e5; + --color-on-accent: #fff; } body { @@ -129,7 +130,7 @@ input:focus { } .notes-list div { - padding: 0 0.8rem; + padding: 0 0.4rem; margin-right: 0.2rem; background-color: var(--color-surface); border-bottom-right-radius: 10px; @@ -165,4 +166,13 @@ input:focus { .notes-list-parent::-webkit-scrollbar-thumb:hover { background-color: var(--color-accent); +} + +.hover-button { + position: absolute; + right: 1rem; + bottom: 1rem; + width: 2rem; + height: 2rem; + background-color: var(--color-accent); } \ No newline at end of file