diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 87fb989..23690d9 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -5,7 +5,7 @@ mod data; use std::fs::read_dir; use std::path::PathBuf; use fs::encryption::aes_decrypt; -use tauri::Runtime; +use tauri::{Manager, Runtime}; use crate::data::json::{init_user_data, user_get, create_value, user_make, system_get, system_make}; use dirs::data_dir; use base64::{decode_config, encode_config, URL_SAFE}; @@ -53,10 +53,12 @@ async fn first_init(app: tauri::AppHandle, window: tauri::Window< #[tauri::command] async fn console(value: String) {println!("{}", value)} +#[tauri::command] +async fn close_app(window: tauri::Window) -> tauri::Result<()> {window.close()} fn main() { tauri::Builder::default().invoke_handler(tauri::generate_handler![ first_init, console, user_get, authenticate_user, save_user, user_exists, load_user, ls, pwd, cd, create_user, - create_value, mkdir, system_get, system_make, user_make, + create_value, mkdir, system_get, system_make, user_make, close_app, ]).run(tauri::generate_context!()).expect("failed to run the code"); } diff --git a/src/pages/main_page/internal_apps/App.css b/src/pages/main_page/internal_apps/App.css index 17c6bbc..98d443c 100644 --- a/src/pages/main_page/internal_apps/App.css +++ b/src/pages/main_page/internal_apps/App.css @@ -24,8 +24,10 @@ } .ApplicationDirectory { - position: absolute; + position:relative; display: block; + margin-bottom: 1px; + height: 10svh; border-top: 2px #0202022f; border-left: 2px #0202022f; border-top-right-radius: 20px; @@ -87,7 +89,6 @@ border-radius: 20px; font-size: 1.5em; text-align: left; font-weight: lighter; - color: rgb(189, 184, 184); font-style: italic; diff --git a/src/pages/main_page/internal_apps/apps/file_system.tsx b/src/pages/main_page/internal_apps/apps/file_system.tsx index 49c4662..3e57776 100644 --- a/src/pages/main_page/internal_apps/apps/file_system.tsx +++ b/src/pages/main_page/internal_apps/apps/file_system.tsx @@ -1,14 +1,11 @@ import App from '../App'; import { invoke } from '@tauri-apps/api'; import { useState, useEffect } from 'react'; - -async function create_file(){ - console.log(await invoke('system_get', {key: 'name'})); -} +import img from '../../assets/terminal.png'; function file_system() : [JSX.Element, React.Dispatch>, JSX.Element]{ const [location, set_location] = useState("Home"); - const [files, set_files] = useState([]); + const [files, set_files] = useState([]); //@ts-expect-error invoke("ls", {}).then(result => set_files(result)).catch(console.log); //@ts-expect-error @@ -20,27 +17,40 @@ function file_system() : [JSX.Element, React.Dispatch set_ctx_display('none')); return () => document.removeEventListener("click", () => set_ctx_display('none')); }, []) - const right_click = (ev: React.MouseEvent) => { ev.preventDefault(); - console.log("right clicked"); set_ctx_display('inherit'); set_positions({dx: ev.clientX, dy: ev.clientY}); } + const make_files = () => { + const NewFile = () =>{ + const [editing, set_editing] = useState(true); + const [text, set_text] = useState(''); + const done_editing = () => {set_editing(false);} + return
+
+ {editing ? set_text(e.target.value)} + onBlur={done_editing} onKeyDownCapture={e => {if (e.key == 'Enter'){done_editing()}}} autoFocus> + :

{text}

} +
+ } + set_files([...files, ]); + } let context_menu =
; + >; let Application =

/{location}/

- <>{files}
let app_html =
- {Application} + {Application} + <>{files}
; const [display, set_display] = useState('none'); let app = ; diff --git a/src/pages/main_page/main_page.tsx b/src/pages/main_page/main_page.tsx index 2752eeb..843833e 100644 --- a/src/pages/main_page/main_page.tsx +++ b/src/pages/main_page/main_page.tsx @@ -15,7 +15,6 @@ import daddy from './assets/daddyishome.png'; import { invoke } from '@tauri-apps/api'; - export default function MainPage() { const navigate = useNavigate(); const [app, fs_display, ctx_menu] = file_system(); @@ -43,7 +42,7 @@ export default function MainPage() { leaveicon

Logout​

-

Exit 😭​