Minor QOL changes
This commit is contained in:
parent
d2784afba0
commit
f7d5ffef72
6 changed files with 17 additions and 18 deletions
|
|
@ -10,18 +10,12 @@ export function Calculator({ active }) {
|
||||||
const [operation, setOperation] = useState(null);
|
const [operation, setOperation] = useState(null);
|
||||||
const [isIntermediate, setIsIntermediate] = useState(false);
|
const [isIntermediate, setIsIntermediate] = useState(false);
|
||||||
|
|
||||||
const log = useCallback(() => {
|
|
||||||
console.info({ input, firstNumber, secondNumber, operation });
|
|
||||||
}, [firstNumber, input, operation, secondNumber]);
|
|
||||||
|
|
||||||
const reset = useCallback(() => {
|
const reset = useCallback(() => {
|
||||||
setInput("0");
|
setInput("0");
|
||||||
setFirstNumber(null);
|
setFirstNumber(null);
|
||||||
setSecondNumber(null);
|
setSecondNumber(null);
|
||||||
setOperation(null);
|
setOperation(null);
|
||||||
|
}, []);
|
||||||
log();
|
|
||||||
}, [log]);
|
|
||||||
|
|
||||||
const addInput = useCallback((string) => {
|
const addInput = useCallback((string) => {
|
||||||
let hasReset = false;
|
let hasReset = false;
|
||||||
|
|
@ -57,8 +51,7 @@ export function Calculator({ active }) {
|
||||||
setInput(input + string);
|
setInput(input + string);
|
||||||
}
|
}
|
||||||
|
|
||||||
log();
|
}, [input, isIntermediate, reset, secondNumber]);
|
||||||
}, [input, isIntermediate, log, reset, secondNumber]);
|
|
||||||
|
|
||||||
const calculate = useCallback((intermediate = false) => {
|
const calculate = useCallback((intermediate = false) => {
|
||||||
if (firstNumber == null) {
|
if (firstNumber == null) {
|
||||||
|
|
@ -89,9 +82,7 @@ export function Calculator({ active }) {
|
||||||
}
|
}
|
||||||
|
|
||||||
setIsIntermediate(intermediate);
|
setIsIntermediate(intermediate);
|
||||||
|
}, [firstNumber, input, operation]);
|
||||||
log();
|
|
||||||
}, [firstNumber, input, log, operation]);
|
|
||||||
|
|
||||||
const changeOperation = useCallback((operation) => {
|
const changeOperation = useCallback((operation) => {
|
||||||
if (firstNumber != null && secondNumber == null) {
|
if (firstNumber != null && secondNumber == null) {
|
||||||
|
|
@ -103,17 +94,13 @@ export function Calculator({ active }) {
|
||||||
}
|
}
|
||||||
|
|
||||||
setOperation(operation);
|
setOperation(operation);
|
||||||
|
}, [calculate, firstNumber, input, secondNumber]);
|
||||||
log();
|
|
||||||
}, [calculate, firstNumber, input, log, secondNumber]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const onKeyDown = (event) => {
|
const onKeyDown = (event) => {
|
||||||
if (!active)
|
if (!active)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
console.log(event.key);
|
|
||||||
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
switch (event.key) {
|
switch (event.key) {
|
||||||
|
|
|
||||||
|
|
@ -214,6 +214,7 @@ export function FileExplorer({ startPath, selectorMode, Footer, modalsManager, o
|
||||||
tabIndex={0}
|
tabIndex={0}
|
||||||
onChange={onPathChange}
|
onChange={onPathChange}
|
||||||
onKeyDown={onKeyDown}
|
onKeyDown={onKeyDown}
|
||||||
|
placeholder="Enter a path..."
|
||||||
/>
|
/>
|
||||||
<button title="Search" tabIndex={0} className={styles["Icon-button"]}>
|
<button title="Search" tabIndex={0} className={styles["Icon-button"]}>
|
||||||
<FontAwesomeIcon icon={faSearch}/>
|
<FontAwesomeIcon icon={faSearch}/>
|
||||||
|
|
|
||||||
|
|
@ -73,12 +73,17 @@
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
text-align: start;
|
text-align: start;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
padding-bottom: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.Option-list {
|
.Option-list {
|
||||||
gap: 0.5rem;
|
gap: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.Option-list .Option {
|
||||||
|
padding-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.Option-horizontal {
|
.Option-horizontal {
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,9 @@ export function AppsSettings({ modalsManager }) {
|
||||||
|
|
||||||
return <div className={`${styles["Option"]} ${styles["Option-list"]}`}>
|
return <div className={`${styles["Option"]} ${styles["Option-list"]}`}>
|
||||||
<p className={styles["Label"]}>Apps</p>
|
<p className={styles["Label"]}>Apps</p>
|
||||||
{AppsManager.APPS.map((app) =>
|
{AppsManager.APPS.sort((a, b) =>
|
||||||
|
a.name.toLowerCase().localeCompare(b.name.toLowerCase())
|
||||||
|
).map((app) =>
|
||||||
<AppOption key={app.id} app={app} modalsManager={modalsManager} pins={pins} setPins={setPins}/>
|
<AppOption key={app.id} app={app} modalsManager={modalsManager} pins={pins} setPins={setPins}/>
|
||||||
)}
|
)}
|
||||||
</div>;
|
</div>;
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,8 @@ export function SearchMenu({ active, setActive, searchQuery, setSearchQuery, inp
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setApps(AppsManager.APPS.filter(({ name }) =>
|
setApps(AppsManager.APPS.filter(({ name }) =>
|
||||||
name.toLowerCase().includes(searchQuery.toLowerCase().trim())
|
name.toLowerCase().includes(searchQuery.toLowerCase().trim())
|
||||||
|
).sort((a, b) =>
|
||||||
|
a.name.toLowerCase().localeCompare(b.name.toLowerCase())
|
||||||
));
|
));
|
||||||
}, [searchQuery]);
|
}, [searchQuery]);
|
||||||
|
|
||||||
|
|
@ -72,6 +74,7 @@ export function SearchMenu({ active, setActive, searchQuery, setSearchQuery, inp
|
||||||
value={searchQuery}
|
value={searchQuery}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
spellCheck={false}
|
spellCheck={false}
|
||||||
|
placeholder="Search..."
|
||||||
/>
|
/>
|
||||||
<div className={appStyles["App-list"]}>
|
<div className={appStyles["App-list"]}>
|
||||||
{apps?.map(({ name, id }) =>
|
{apps?.map(({ name, id }) =>
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ import { Browser } from "../../components/apps/browser/Browser.jsx";
|
||||||
import { IMAGE_FORMATS } from "../../config/apps/mediaViewer.config.js";
|
import { IMAGE_FORMATS } from "../../config/apps/mediaViewer.config.js";
|
||||||
|
|
||||||
export default class AppsManager {
|
export default class AppsManager {
|
||||||
|
/** @type {App[]} */
|
||||||
static APPS = [
|
static APPS = [
|
||||||
new App(APP_NAMES.TERMINAL, APPS.TERMINAL, Terminal),
|
new App(APP_NAMES.TERMINAL, APPS.TERMINAL, Terminal),
|
||||||
new App(APP_NAMES.SETTINGS, APPS.SETTINGS, Settings),
|
new App(APP_NAMES.SETTINGS, APPS.SETTINGS, Settings),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue