Skip to content
This repository has been archived by the owner on Jan 14, 2025. It is now read-only.

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
arielldev authored Mar 14, 2024
2 parents f2cc084 + c6c1a86 commit 2c52284
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src-tauri/src/data/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
12 changes: 7 additions & 5 deletions src/pages/main_page/internal_apps/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,24 @@ 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 (
<div
className="frame"
style={{
transform: `translate3d(${dx}px, ${dy}px, 0)`,

display: `${visibility}`,
}}

id={id}
//@ts-expect-error
ref={ref}
key={name}
Expand All @@ -37,7 +39,7 @@ function App({ element, name }: AppProps) {
<h1 className="sexy">{name}</h1>
<div className="frame-buttons">
<button className="minimize-btn">-</button>
<button className="close-btn">x</button>
<button className="close-btn" onClick={()=>document.getElementById(id)?.remove()}>x</button>
</div>
</div>
{element}
Expand Down
26 changes: 24 additions & 2 deletions src/pages/main_page/internal_apps/file_system.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,31 @@ import App from './App';
import { invoke } from '@tauri-apps/api';
import { useState } from 'react';

function ContextMenu(){

return <div>
text here
</div>
}

function file_system(set_fs_html: React.Dispatch<React.SetStateAction<JSX.Element>>){
const [location, set_location] = useState("Home");
const [files, set_files] = useState([]);
//@ts-expect-error
invoke("ls", {}).then(result => 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 = <div className='ApplicationDirectory'>
<h1 className='filesystemtxt2'>/{location}/</h1>
Expand All @@ -18,9 +35,14 @@ function file_system(set_fs_html: React.Dispatch<React.SetStateAction<JSX.Elemen
let app_html = <div className='frametest2'>
{Application}

let app_html = <div className='frametest2'>
<div className='ApplicationDirectory'>
<h1 className='filesystemtxt2'>/{location}/</h1>
</div>

{menu_open && <ContextMenu />}
</div>;
let app = <App element={app_html} name='feet pics'/>;
let app = <App element={app_html} id={id()} name='feet pics'/>;
set_fs_html(app);
};
}
Expand Down

0 comments on commit 2c52284

Please sign in to comment.