diff --git a/src-tauri/src/data/auth.rs b/src-tauri/src/data/auth.rs index 2f50711..be61efb 100644 --- a/src-tauri/src/data/auth.rs +++ b/src-tauri/src/data/auth.rs @@ -106,8 +106,8 @@ pub fn save_user(name: &str, password: &str){ fn test_authentication(){ init_user_data(); init_dir().expect("failed to create the main directory"); - let name = "Nigger"; - let password = "Nigger"; + let name = "non existed user"; + let password = "non existed user"; save_user(name, password); authenticate_user(name, password); load_user(name, password) diff --git a/src/pages/main_page/internal_apps/App.tsx b/src/pages/main_page/internal_apps/App.tsx index 468fa4c..2b69d14 100644 --- a/src/pages/main_page/internal_apps/App.tsx +++ b/src/pages/main_page/internal_apps/App.tsx @@ -13,12 +13,14 @@ enum State { interface AppProps { element: React.ReactElement; name: string; + id: string; } -function App({ element, name }: AppProps) { +function App({ element, name, id }: AppProps) { let [ref, dx, dy] = useDraggable({ gridSize: 10 }); + const [visibility, set_visibility] = useState('inherit'); - //@ts-expect-error + //@ts-expect-error const [appState, setAppState] = useState(State.Normal); return ( @@ -26,9 +28,9 @@ function App({ element, name }: AppProps) { className="frame" style={{ transform: `translate3d(${dx}px, ${dy}px, 0)`, - + display: `${visibility}`, }} - + id={id} //@ts-expect-error ref={ref} key={name} @@ -37,7 +39,7 @@ function App({ element, name }: AppProps) {

{name}

- +
{element} diff --git a/src/pages/main_page/internal_apps/file_system.tsx b/src/pages/main_page/internal_apps/file_system.tsx index cc00c2a..a6bc399 100644 --- a/src/pages/main_page/internal_apps/file_system.tsx +++ b/src/pages/main_page/internal_apps/file_system.tsx @@ -2,6 +2,13 @@ import App from './App'; import { invoke } from '@tauri-apps/api'; import { useState } from 'react'; +function ContextMenu(){ + + return
+ text here +
+} + function file_system(set_fs_html: React.Dispatch>){ const [location, set_location] = useState("Home"); const [files, set_files] = useState([]); @@ -9,7 +16,17 @@ function file_system(set_fs_html: React.Dispatch set_files(result)).catch(console.log); //@ts-expect-error invoke("pwd", {}).then(result => set_location(result)).catch(console.log); - console.log(files, ", ", location); + + const [menu_open, set_menu] = useState(false); + const right_click = (ev: MouseEvent) => { + //set_context({x: ev.clientX, y: ev.clientY}); + console.log("right clicked"); + //set_menu(true); + + } + let internal_id = 0; + function id(){return (internal_id + 1).toString();} + document.addEventListener('contextmenu', right_click); return () => { let Application =

/{location}/

@@ -18,9 +35,14 @@ function file_system(set_fs_html: React.Dispatch {Application} + let app_html =
+
+

/{location}/

+
+ {menu_open && }
; - let app = ; + let app = ; set_fs_html(app); }; }