Skip to content

Commit

Permalink
Updated framework and dependencies; reduced window size and added zoom
Browse files Browse the repository at this point in the history
  • Loading branch information
Bonnev committed May 26, 2024
1 parent 9ad029b commit 65bda32
Show file tree
Hide file tree
Showing 13 changed files with 1,912 additions and 1,447 deletions.
1 change: 0 additions & 1 deletion .env.dev

This file was deleted.

1 change: 0 additions & 1 deletion .env.prod

This file was deleted.

3 changes: 0 additions & 3 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
"ecmaVersion": 2021,
"sourceType": "module"
},
"globals": {
"Neutralino": "readonly"
},
"settings": {
"react": {
"version": "detect"
Expand Down
Binary file removed bin/neutralino-win_x64.exe.original
Binary file not shown.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React</title>
<script src="{{VITE_APP_NEUTRALINO_PREFIX}}/neutralino.js"></script>
<script src="./__neutralino_globals.js"></script>
</head>
<body>
<div id="root"></div>
Expand Down
45 changes: 15 additions & 30 deletions neutralino.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@
"applicationId": "js.neutralino.sample",
"version": "1.0.0",
"defaultMode": "window",
"port": 0,
"documentRoot": "/dist/",
"url": "/index.html",
"__documentRoot": "/./",
"__url": "http://127.0.0.1:5173/index.html",
"url": "/",
"enableServer": true,
"enableNativeAPI": true,
"tokenSecurity": "none",
Expand All @@ -16,16 +13,17 @@
},
"nativeAllowList": [
"filesystem.*",
"window.*"
"window.*",
"app.exit"
],
"globalVariables": {
"TEST1": "Hello"
},
"modes": {
"window": {
"title": "time-traq-nag",
"width": 450,
"height": 286,
"width": 470,
"height": 250,
"__minWidth__": 400,
"__minHeight__": 200,
"fullScreen": false,
Expand All @@ -36,35 +34,22 @@
"maximize": false,
"hidden": false,
"resizable": true,
"exitProcessOnClose": true
},
"browser": {
"globalVariables": {
"TEST": "Test value browser"
},
"nativeBlockList": [
"filesystem.*"
]
},
"chrome": {
"width": 800,
"height": 500,
"args": "--user-agent=\"Neutralinojs chrome mode\"",
"nativeBlockList": [
"os.*"
]
"center": true,
"exitProcessOnClose": false
}
},
"cli": {
"binaryName": "neutralinojs",
"resourcesPath": "/dist/",
"extensionsPath": "/extensions/",
"clientLibrary": "/dist/neutralino.js",
"binaryVersion": "4.5.0",
"clientVersion": "3.4.0",
"frontendLibrary": {
"patchFile": "/index.html",
"devUrl": "http://127.0.0.1:5173"
"binaryVersion": "5.1.0",
"clientVersion": "5.1.0",
"frontendLibrary": {
"patchFile": "./index.html",
"projectPath": "./",
"devUrl": "http://localhost:5173",
"devCommand": "yarn vite-dev",
"buildCommand": "yarn vite-build"
}
}
}
30 changes: 17 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,34 @@
{
"name": "vite-project",
"version": "1.0.0-alpha",
"type": "module",
"scripts": {
"start": "concurrently -k -n vite-dev,neu \"yarn:vite-dev\" \"neu run -- --port=8080 --url=http://127.0.0.1:5173/index.html --document-root=\"\\/./\" --window-enable-inspector=true\"",
"build": "vite build --mode prod && neu build",
"preview": "vite build --mode prod && neu run",
"vite-dev": "vite --mode dev",
"vite-preview": "vite preview"
"init": "neu update",
"start": "neu run -- --window-enable-inspector=true",
"build": "neu build",
"vite-dev": "vite",
"vite-build": "NODE_ENV=production vite build"
},
"dependencies": {
"@neutralinojs/lib": "^5.1.0",
"dayjs": "^1.11.5",
"moment": "^2.29.4",
"prop-types": "^15.8.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"vite-plugin-html-env": "^1.2.7"
"react-dom": "^18.2.0"
},
"devDependencies": {
"@neutralinojs/neu": "^9.3.1",
"@types/react": "^18.0.17",
"@types/react-dom": "^18.0.6",
"@vitejs/plugin-react": "^2.0.1",
"concurrently": "^7.3.0",
"@neutralinojs/neu": "^11.0.1",
"@types/react": "^18.2.0",
"@types/react-dom": "^18.2.0",
"@vitejs/plugin-react": "^4.2.1",
"eslint": "^8.23.0",
"eslint-plugin-react": "^7.31.4",
"eslint-plugin-react-hooks": "^4.6.0",
"vite": "^3.0.7"
"vite": "^5.2.0"
},
"engines": {
"node": ">=20",
"npm": ">=10"
}
}
1 change: 0 additions & 1 deletion public/neutralino.js

This file was deleted.

1 change: 0 additions & 1 deletion public/neutralino.js.map

This file was deleted.

13 changes: 7 additions & 6 deletions src/components/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ import React, { useCallback, useEffect, useRef } from 'react';
import { useState } from 'react';
import reactLogo from '/react.svg';
import neutralinoLogo from '/neutralino-logo.gif';
import { filesystem } from '@neutralinojs/lib';
import '../styles/App.css';
import Timer from './Timer';
import dayjs from 'dayjs';

Neutralino.filesystem.writeFile('./test.txt', 'random text');
filesystem.writeFile('./test.txt', 'random text');

const App = () => {
// const [estimate, setEstimate] = useState('');
Expand Down Expand Up @@ -35,7 +36,7 @@ const App = () => {
(async () => {
try {
const result = {};
const file = await Neutralino.filesystem.readFile(dayjs().format('YY-MM-DD') + '-stats.txt') || '';
const file = await filesystem.readFile(dayjs().format('YY-MM-DD') + '-stats.txt') || '';
const lines = file.split('\n');
lines.forEach(l => result[l.split('\t')[0]] = { seconds: +l.split('\t')[1] });
setInitialTasks(result);
Expand All @@ -60,14 +61,14 @@ const App = () => {

const duration = dayjs.duration(seconds.current * 1000);
if (duration.seconds() % 10 === 0) {
Neutralino.filesystem.appendFile(dayjs().format('YY-MM-DD') + '.txt', `${dayjs().format('YY-MM-DDTHH:mm:ss')}\t${currentTask}\t${duration.format('HH:mm:ss')}\n`);
filesystem.appendFile(dayjs().format('YY-MM-DD') + '.txt', `${dayjs().format('YY-MM-DDTHH:mm:ss')}\t${currentTask}\t${duration.format('HH:mm:ss')}\n`);
}
if (duration.seconds() % 60 === 0) {
(async () => {
let index = -1;
let lines = [];
try {
const file = await Neutralino.filesystem.readFile(dayjs().format('YY-MM-DD') + '-stats.txt') || '';
const file = await filesystem.readFile(dayjs().format('YY-MM-DD') + '-stats.txt') || '';
lines = file.split('\n');
index = lines.findIndex(l => l.split('\t')[0] === currentTask);
} catch (e) { /* dasd */ }
Expand All @@ -78,14 +79,14 @@ const App = () => {
} else {
lines[index] = newLine;
}
Neutralino.filesystem.writeFile(dayjs().format('YY-MM-DD') + '-stats.txt', lines.join('\n'));
filesystem.writeFile(dayjs().format('YY-MM-DD') + '-stats.txt', lines.join('\n'));
})();
}
}, [currentTask]);

const onEvent = useCallback((event) => {
if (event === 'PAUSED' || event === 'RESUMED') {
Neutralino.filesystem.appendFile(dayjs().format('YY-MM-DD') + '.txt', `${dayjs().format('YY-MM-DDTHH:mm:ss')}\t${event}\n`);
filesystem.appendFile(dayjs().format('YY-MM-DD') + '.txt', `${dayjs().format('YY-MM-DDTHH:mm:ss')}\t${event}\n`);
}
});

Expand Down
Loading

0 comments on commit 65bda32

Please sign in to comment.