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

Commit

Permalink
fixed a couple issues i didnt like
Browse files Browse the repository at this point in the history
raisfeld-ori committed Mar 14, 2024
1 parent 0eecc8f commit 55bc94e
Showing 4 changed files with 29 additions and 32 deletions.
11 changes: 8 additions & 3 deletions src/pages/main_page/internal_apps/App.css
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@
display: block;
border: 2px #0202022f;
border-style: solid;
z-index: 99;
padding-left: 373px;
cursor: move;
font-size: 0.5em;
@@ -16,6 +17,11 @@

}

.frame{
z-index: 9;
position:sticky;
}

.ApplicationDirectory {
position: absolute;
display: block;
@@ -31,7 +37,6 @@
width: 873px;
max-width: 100%;
display: flex;
z-index: 99;
align-items: flex-start;
background-color: #2f2f2f;
height: 3.8svh;
@@ -45,10 +50,10 @@
border-style: solid;
cursor: move;
font-size: 1em;
color: white ;
color: white;
width: 873px;
max-width: 100%;

z-index: 99;
display: flex;
align-items: flex-start;
background-color: #333333df;
19 changes: 8 additions & 11 deletions src/pages/main_page/internal_apps/App.tsx
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ import React, { useState, RefObject } from "react";
import { useDraggable } from '../Grid';
import './App.css';

enum State {
export enum State {
Normal,
Minimized,
FullScreen,
@@ -14,20 +14,18 @@ enum State {
interface AppProps {
element: React.ReactElement;
name: string;
display: string,
set_display: React.Dispatch<React.SetStateAction<string>>,
}

function App({ element, name }: AppProps) {
function App({ element, name, display, set_display }: AppProps) {
let [ref, dx, dy] = useDraggable({ gridSize: 10 });

//@ts-expect-error
const [appState, set_state] = useState(State.Normal);
const [visibility, set_visibility] = useState('inherit');
return (
return [
<div
className="frame"
style={{
transform: `translate3d(${dx}px, ${dy}px, 0)`,
display: `${visibility}`,
display: `${display}`,
}}
//@ts-expect-error
ref={ref}
@@ -37,13 +35,12 @@ function App({ element, name }: AppProps) {
<h1 className="sexy">{name}</h1>
<div className="frame-buttons">
<button className="minimize-btn">-</button>
<button className="close-btn" onClick={()=>{set_visibility('none');set_state(State.Closed);}}>x</button>
<button className="close-btn" onClick={()=>{set_display('none');}}>x</button>
</div>
</div>
{element}
</div>

);
];
}

export default App;
22 changes: 9 additions & 13 deletions src/pages/main_page/internal_apps/file_system.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import App from './App';
import App, {State} from './App';

Check failure on line 1 in src/pages/main_page/internal_apps/file_system.tsx

GitHub Actions / build (windows-latest)

'State' is declared but its value is never read.
import { invoke } from '@tauri-apps/api';
import { useState } from 'react';

function file_system(set_fs_html: React.Dispatch<React.SetStateAction<JSX.Element>>){
function file_system() : [JSX.Element, React.Dispatch<React.SetStateAction<string>>]{
const [location, set_location] = useState("Home");
const [files, set_files] = useState([]);

Check failure on line 7 in src/pages/main_page/internal_apps/file_system.tsx

GitHub Actions / build (windows-latest)

'files' is declared but its value is never read.
//@ts-expect-error
@@ -18,19 +18,15 @@ function file_system(set_fs_html: React.Dispatch<React.SetStateAction<JSX.Elemen

}
document.addEventListener('contextmenu', right_click);
return () => {
let Application = <div className='ApplicationDirectory'>
<h1 className='filesystemtxt2'>/{location}/</h1>
</div>

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


{Application}
</div>;
let app = <App element={app_html} name='feet pics'/>;
set_fs_html(app);
};
const [display, set_display] = useState('none');
let app = <App element={app_html} display={display} set_display={set_display} name='feet pics'/>;
return [app, set_display];
}

export default file_system;
9 changes: 4 additions & 5 deletions src/pages/main_page/main_page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

import React, { useState } from 'react';

Check failure on line 2 in src/pages/main_page/main_page.tsx

GitHub Actions / build (windows-latest)

All imports in import declaration are unused.
import './main_page.css';

import { State } from './internal_apps/App';

Check failure on line 4 in src/pages/main_page/main_page.tsx

GitHub Actions / build (windows-latest)

'State' is declared but its value is never read.
import Grid from './Grid';
import folder from './assets/folder.png';
import menu_icon from './assets/computer-laptop-color-icon.webp';
@@ -13,15 +13,14 @@ import { desktop_app } from './Grid';


export default function MainPage() {
const [fs, set_fs] = useState(<></>);
const example_app = desktop_app("Dolphin", folder, file_system(set_fs));
const [app, fs_display] = file_system();
const example_app = desktop_app("Dolphin", folder, () => {fs_display('inherit')});
const not_example_app = desktop_app("Search", search, () => { console.log("test"); });
const terminal = desktop_app("Terminal", terminald, () => {});

return (
<div id='background'>

{fs}
{app}
<Grid apps={[example_app, not_example_app, terminal]} gridSize={50} margin={120} />
<nav className='navbar'>
<img className='homeimg' src={menu_icon} alt="" />

0 comments on commit 55bc94e

Please sign in to comment.