Changed application names
This commit is contained in:
parent
d0f6da3135
commit
7df82a7ae5
4 changed files with 20 additions and 17 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { useState } from "react";
|
||||
import { useEffect, useState } from "react";
|
||||
import styles from "./Terminal.module.css";
|
||||
import { useVirtualRoot } from "../../../hooks/virtual-drive/VirtualRootContext.js";
|
||||
import { Command } from "../../../features/applications/terminal/commands.js";
|
||||
|
|
@ -43,14 +43,16 @@ function InputLine({ value, prefix, onChange, onKeyUp, onKeyDown }) {
|
|||
);
|
||||
}
|
||||
|
||||
export function Terminal() {
|
||||
export function Terminal({ setTitle }) {
|
||||
const [inputKey, setInputKey] = useState(0);
|
||||
const [inputValue, setInputValue] = useState("");
|
||||
const [history, setHistory] = useState([]);
|
||||
const virtualRoot = useVirtualRoot();
|
||||
const [currentDirectory, setCurrentDirectory] = useState(virtualRoot.navigate("~"));
|
||||
|
||||
// console.log(currentDirectory);
|
||||
useEffect(() => {
|
||||
setTitle(`${USERNAME}@${HOSTNAME}: ${currentDirectory.root ? "/" : currentDirectory.path}`);
|
||||
}, [currentDirectory.path, currentDirectory.root, setTitle]);
|
||||
|
||||
const prefix = `${USERNAME}@${HOSTNAME}:${currentDirectory.root ? "/" : currentDirectory.path}$ `;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
import React, { useEffect, useState } from "react";
|
||||
|
||||
import { VirtualFile } from "../../../features/virtual-drive/virtual-file.js";
|
||||
import styles from "./TextEditor.module.css";
|
||||
import { HeaderMenu } from "../.common/HeaderMenu.jsx";
|
||||
import Markdown from "markdown-to-jsx";
|
||||
import Application from "../../../features/applications/application.js";
|
||||
|
||||
const defaultZoom = 16;
|
||||
const zoomSpeed = 4;
|
||||
const DEFAULT_ZOOM = 16;
|
||||
const ZOOM_FACTOR = 4;
|
||||
|
||||
/**
|
||||
* @param {object} props
|
||||
|
|
@ -14,13 +14,14 @@ const zoomSpeed = 4;
|
|||
* @param {Function} props.setTitle
|
||||
* @param {Function} props.close
|
||||
* @param {string} props.mode
|
||||
* @param {Application} props.app
|
||||
*/
|
||||
export function TextEditor({ file, setTitle, close, mode }) {
|
||||
export function TextEditor({ file, setTitle, close, mode, app }) {
|
||||
const [currentFile, setCurrentFile] = useState(file);
|
||||
const [currentMode, setCurrentMode] = useState(mode);
|
||||
const [content, setContent] = useState(file?.content ?? "");
|
||||
const [unsavedChanges, setUnsavedChanges] = useState(file == null);
|
||||
const [zoom, setZoom] = useState(defaultZoom);
|
||||
const [zoom, setZoom] = useState(DEFAULT_ZOOM);
|
||||
|
||||
useEffect(() => {
|
||||
(async () => {
|
||||
|
|
@ -51,8 +52,8 @@ export function TextEditor({ file, setTitle, close, mode }) {
|
|||
if (currentMode === "view")
|
||||
label += " (preview)";
|
||||
|
||||
setTitle(`${label} - Text Editor`);
|
||||
}, [currentFile, setTitle, unsavedChanges, currentMode]);
|
||||
setTitle(`${label} - ${app.name}`);
|
||||
}, [currentFile, setTitle, unsavedChanges, currentMode, app.name]);
|
||||
|
||||
const newText = () => {
|
||||
setCurrentFile(null);
|
||||
|
|
@ -101,13 +102,13 @@ export function TextEditor({ file, setTitle, close, mode }) {
|
|||
setCurrentMode(currentMode === "view" ? "edit" : "view");
|
||||
},
|
||||
"Zoom In": () => {
|
||||
setZoom(zoom + zoomSpeed);
|
||||
setZoom(zoom + ZOOM_FACTOR);
|
||||
},
|
||||
"Zoom Out": () => {
|
||||
setZoom(zoom - zoomSpeed);
|
||||
setZoom(zoom - ZOOM_FACTOR);
|
||||
},
|
||||
"Reset Zoom": () => {
|
||||
setZoom(defaultZoom);
|
||||
setZoom(DEFAULT_ZOOM);
|
||||
}
|
||||
}
|
||||
}}
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ export const Window = memo(function Window({ id, app, size, position, focused =
|
|||
</button>
|
||||
</div>
|
||||
<div className={styles["Window-content"]} onClick={(event) => { console.log(event); }}>
|
||||
<app.WindowContent {...options} setTitle={setTitle} close={close} focus={focus}/>
|
||||
<app.WindowContent {...options} app={app} setTitle={setTitle} close={close} focus={focus}/>
|
||||
</div>
|
||||
</div>
|
||||
</Draggable>
|
||||
|
|
|
|||
|
|
@ -14,10 +14,10 @@ export default class ApplicationsManager {
|
|||
new Application("Settings", "settings", Settings),
|
||||
// new Application("Browser", "browser"),
|
||||
// new Application("Calculator", "calculator", Calculator, { size: new Vector2(400, 600) }),
|
||||
new Application("Text Editor", "text-editor", TextEditor),
|
||||
new Application("Notes", "text-editor", TextEditor),
|
||||
// new Application("Code Editor", "code-editor"),
|
||||
new Application("File Explorer", "file-explorer", FileExplorer),
|
||||
new Application("Media Viewer", "media-viewer", MediaViewer),
|
||||
new Application("Files", "file-explorer", FileExplorer),
|
||||
new Application("Photos", "media-viewer", MediaViewer),
|
||||
new Application("Wordle", "wordle", WebView, {
|
||||
source: "https://prozilla.dev/wordle",
|
||||
size: new Vector2(400, 650)
|
||||
|
|
|
|||
Loading…
Reference in a new issue