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

Commit

Permalink
fixed loading iasues
Browse files Browse the repository at this point in the history
  • Loading branch information
raisfeld-ori committed Mar 23, 2024
1 parent 0ec19b3 commit b704c21
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/pages/main_page/internal_apps/apps/file_system.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ import img from '../../assets/terminal.png';
function file_system() : [JSX.Element, React.Dispatch<React.SetStateAction<string>>, JSX.Element]{
const [location, set_location] = useState("Home");
const [files, set_files] = useState<React.JSX.Element[]>([]);
//@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);
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);
})

const [{dx, dy}, set_positions] = useState({dx: 0, dy: 0});
const [ctx_display, set_ctx_display] = useState('none');
Expand All @@ -26,7 +28,12 @@ function file_system() : [JSX.Element, React.Dispatch<React.SetStateAction<strin
const NewFile = () =>{
const [editing, set_editing] = useState(true);
const [text, set_text] = useState('');
const done_editing = () => {set_editing(false);}
const done_editing = async () => {
set_editing(false);
let name: string = await invoke('system_get', {key: 'name'});
let password: string = await invoke('system_get', {key: 'password'});
console.log(name, ", ", password)
}

return <div className='file'>
<img src={img} className='file_img'/><br />
Expand All @@ -35,7 +42,7 @@ function file_system() : [JSX.Element, React.Dispatch<React.SetStateAction<strin
: <p className='file_name'>{text}</p>}
</div>
}
set_files([...files, <NewFile/>]);
set_files([...files, <NewFile key={files.length + 1}/>]);
}
let context_menu = <div className='ContextMenu'
style={{
Expand Down

0 comments on commit b704c21

Please sign in to comment.