chore: running format

This commit is contained in:
2025-02-26 21:27:43 +00:00
parent 06df315ed0
commit 3bd3b420c9
15 changed files with 362 additions and 364 deletions

Binary file not shown.

View File

@ -22,7 +22,8 @@
"@tauri-apps/plugin-opener": "^2",
"clsx": "^2.1.1",
"solid-js": "^1.9.3",
"tailwind-scrollbar-hide": "^2.0.0"
"tailwind-scrollbar-hide": "^2.0.0",
"valibot": "^1.0.0-rc.2"
},
"devDependencies": {
"@biomejs/biome": "^1.9.4",

View File

@ -1,14 +1,13 @@
use std::path::PathBuf;
use base64::{engine::general_purpose::STANDARD as BASE64, Engine as _};
use notify::{Config, RecommendedWatcher, RecursiveMode, Watcher};
use tauri::Emitter;
use std::sync::mpsc::channel;
use std::fs;
use base64::{Engine as _, engine::general_purpose::STANDARD as BASE64};
use std::sync::Mutex;
use std::path::PathBuf;
use std::sync::mpsc::channel;
use std::sync::Arc;
use std::sync::Mutex;
use tauri::AppHandle;
use tauri::{TitleBarStyle, WebviewUrl, WebviewWindowBuilder};
use tauri::Emitter;
use tauri::{WebviewUrl, WebviewWindowBuilder};
struct WatcherState {
watcher: Option<RecommendedWatcher>,
@ -25,8 +24,7 @@ fn process_png_file(path: &PathBuf, app: AppHandle) -> Result<(), String> {
println!("Processing PNG file: {}", path.display());
// Read the file
let contents = fs::read(path)
.map_err(|e| format!("Failed to read file: {}", e))?;
let contents = fs::read(path).map_err(|e| format!("Failed to read file: {}", e))?;
// Convert to base64
let base64_string = BASE64.encode(&contents);
@ -53,20 +51,21 @@ async fn handle_selected_folder(
}
// Stop existing watcher if any
let mut state = state.lock().map_err(|_| "Failed to lock state".to_string())?;
let mut state = state
.lock()
.map_err(|_| "Failed to lock state".to_string())?;
state.watcher = None;
// Create a channel to receive file system events
let (tx, rx) = channel();
// Create a new watcher
let mut watcher = RecommendedWatcher::new(
tx,
Config::default(),
).map_err(|e| format!("Failed to create watcher: {}", e))?;
let mut watcher = RecommendedWatcher::new(tx, Config::default())
.map_err(|e| format!("Failed to create watcher: {}", e))?;
// Start watching the directory
watcher.watch(path_buf.as_ref(), RecursiveMode::Recursive)
watcher
.watch(path_buf.as_ref(), RecursiveMode::Recursive)
.map_err(|e| format!("Failed to watch directory: {}", e))?;
// Store the watcher in state
@ -114,9 +113,7 @@ pub fn run() {
.manage(watcher_state)
.invoke_handler(tauri::generate_handler![handle_selected_folder])
.setup(|app| {
let win_builder =
WebviewWindowBuilder::new(app, "main", WebviewUrl::default())
.hidden_title(true)
let win_builder = WebviewWindowBuilder::new(app, "main", WebviewUrl::default())
.inner_size(480.0, 360.0)
.resizable(false);
// set transparent title bar only when building for macOS

View File

@ -22,7 +22,7 @@ function App() {
const queryEmojiData = (query: string) => {
return emojiData.filter((emoji) =>
emoji.name.toLowerCase().includes(query.toLowerCase())
emoji.name.toLowerCase().includes(query.toLowerCase()),
);
};
@ -42,7 +42,7 @@ function App() {
item={props.item}
class={clsx(
"text-2xl leading-none text-gray-900 rounded-md p-2 select-none outline-none grid justify-items-center w-[calc(20%-5px)] box-border",
"hover:bg-gray-100 ui-highlighted:bg-gray-100 ui-highlighted:shadow-[inset_0_0_0_2px_rgb(2,132,199)] ui-disabled:text-gray-400 ui-disabled:opacity-50 ui-disabled:pointer-events-none"
"hover:bg-gray-100 ui-highlighted:bg-gray-100 ui-highlighted:shadow-[inset_0_0_0_2px_rgb(2,132,199)] ui-disabled:text-gray-400 ui-disabled:opacity-50 ui-disabled:pointer-events-none",
)}
>
<Search.ItemLabel class="mx-[-100px]">