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

Commit

Permalink
fixed ctx menu bug
Browse files Browse the repository at this point in the history
  • Loading branch information
raisfeld-ori committed Mar 22, 2024
1 parent 0051d14 commit d24b8bd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 1 addition & 3 deletions src/pages/main_page/internal_apps/apps/file_system.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { invoke } from '@tauri-apps/api';
import { useState, useEffect } from 'react';

async function create_file(){
console.log(await invoke('system_get', {key: 'name'}));
// console.log(await invoke('system_get', {key: 'name'}));
}

function file_system() : [JSX.Element, React.Dispatch<React.SetStateAction<string>>, JSX.Element]{
Expand All @@ -22,10 +22,8 @@ function file_system() : [JSX.Element, React.Dispatch<React.SetStateAction<strin
}, [])

const right_click = (ev: React.MouseEvent) => {
//set_context({x: ev.clientX, y: ev.clientY});
ev.preventDefault();
console.log("right clicked");
//set_menu(true);
set_ctx_display('inherit');
set_positions({dx: ev.clientX, dy: ev.clientY});
}
Expand Down
3 changes: 2 additions & 1 deletion src/pages/main_page/main_page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@ import { invoke } from '@tauri-apps/api';

export default function MainPage() {
const navigate = useNavigate();
const [app, fs_display] = file_system();
const [app, fs_display, ctx_menu] = file_system();
const example_app = desktop_app("Files", folder, () => {fs_display('inherit')});
const not_example_app = desktop_app("Search", search, async () => { console.log(await invoke('system_get', {key: 'name'})); });
const terminal = desktop_app("Terminal", terminald, () => {});
const [menu, set_menu] = useState(false);
return (
<div id='background' onContextMenu={e => {e.preventDefault();}}>
{ctx_menu}
{app}
<Grid apps={[example_app, not_example_app, terminal]} gridSize={50} margin={120} />
<nav className='navbar' onContextMenu={e => e.preventDefault()}>
Expand Down

0 comments on commit d24b8bd

Please sign in to comment.