From d2184c6882bd5381fcb52c10b738ee916401d457 Mon Sep 17 00:00:00 2001 From: ransome1 Date: Mon, 29 Apr 2024 11:37:52 +0200 Subject: [PATCH] Refactoring wip. Fixed https://github.com/ransome1/sleek/issues/701. --- LICENSE | 2 +- flatpak/com.github.ransome1.sleek.appdata.xml | 4 +- package.json | 4 +- release/app/package.json | 4 +- snap/snapcraft.yaml | 2 +- src/__tests__/__mock__/recurrence.txt | 28 +- src/__tests__/main/Archive.tsx | 1 - src/main/modules/DataRequest/DataRequest.tsx | 4 +- src/main/modules/File/Watcher.tsx | 2 - src/renderer/App.scss | 2 +- src/renderer/App.tsx | 2 +- src/renderer/Dialog/AutoSuggest.scss | 3 - src/renderer/Dialog/Dialog.tsx | 2 +- src/renderer/Drawer/Attributes.tsx | 4 +- .../Drawer/Sorting/DraggableList.scss | 4 - src/renderer/Grid/Grid.tsx | 2 + src/renderer/Navigation.scss | 6 +- src/renderer/Shared.tsx | 2 +- src/renderer/index.ejs | 2 +- src/types.tsx | 2 +- yarn.lock | 505 +++++++++--------- 21 files changed, 292 insertions(+), 295 deletions(-) diff --git a/LICENSE b/LICENSE index fe9b8f0a..f6c68357 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2024 Robin Ahle +Copyright (c) 2024 ransome1 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/flatpak/com.github.ransome1.sleek.appdata.xml b/flatpak/com.github.ransome1.sleek.appdata.xml index 85ea823c..97050688 100755 --- a/flatpak/com.github.ransome1.sleek.appdata.xml +++ b/flatpak/com.github.ransome1.sleek.appdata.xml @@ -6,10 +6,10 @@ com.github.ransome1.sleek.desktop MIT MIT - Robin Ahle + ransome1 - + https://github.com/ransome1/sleek https://github.com/ransome1/sleek/issues diff --git a/package.json b/package.json index f1f7428a..56948a4d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sleek", - "version": "2.0.14", + "version": "2.0.14-rc.1", "main": "./src/main/main.tsx", "scripts": { "build": "concurrently \"yarn run peggy\" \"yarn run build:main\" \"yarn run build:renderer\"", @@ -230,7 +230,7 @@ "displayName": "sleek - todo.txt manager for Windows, free and open-source (FOSS)", "identityName": "17450RobinAhle.sleektodomanager", "publisher": "CN=2B3D4037-FF2E-4C36-84A6-CFF49F585C0C", - "publisherDisplayName": "Robin Ahle", + "publisherDisplayName": "ransome1", "applicationId": "RobinAhle.sleektodomanager" }, "linux": { diff --git a/release/app/package.json b/release/app/package.json index 23a95e98..0838b7f4 100644 --- a/release/app/package.json +++ b/release/app/package.json @@ -1,6 +1,6 @@ { "name": "sleek", - "version": "2.0.14", + "version": "2.0.14-rc.1", "description": "todo.txt manager for Linux, Windows and MacOS, free and open-source (FOSS)", "synopsis": "todo.txt manager for Linux, Windows and MacOS, free and open-source (FOSS)", "keywords": [ @@ -18,7 +18,7 @@ "type": "git", "url": "https://github.com/ransome1/sleek.git" }, - "author": "Robin Ahle ", + "author": "ransome1 ", "copyright": "Copyright © 2024 ${author}", "license": "MIT", "main": "./dist/main/main.js", diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 0a887e8c..5e366641 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -1,6 +1,6 @@ name: sleek base: core20 -version: "2.0.14" +version: "2.0.14-rc.1" summary: todo.txt manager for Linux, free and open-source (FOSS) description: | sleek is an open-source (FOSS) todo manager based on the todo.txt syntax. Stripped down to only the most necessary features, and with a clean and simple interface, sleek aims to help you focus on getting things done. diff --git a/src/__tests__/__mock__/recurrence.txt b/src/__tests__/__mock__/recurrence.txt index 39c10123..c1047d2f 100644 --- a/src/__tests__/__mock__/recurrence.txt +++ b/src/__tests__/__mock__/recurrence.txt @@ -1,15 +1,15 @@ -2024-04-05 Line 1 rec:1d due:2024-04-06 -2024-04-05 Line 1 rec:w due:2024-04-12 -2024-04-05 Line 1 rec:2m due:2024-06-05 -2024-04-05 Line 1 rec:+1d due:2024-04-07 -2024-04-05 Line 1 rec:7w due:2024-05-24 -2024-04-05 Line 1 due:2023-07-24 rec:+1b -2024-04-05 taxes are due in one year t:2022-03-30 due:2022-04-30 rec:+1y -2024-04-05 Water plants @home +quick due:2024-04-12 t:2024-04-02 rec:1w -2024-04-05 Line 1 rec:+1d t:2023-09-20 -2024-04-05 Line 1 rec:1d pri:A due:2024-04-06 -2024-04-05 (A) Do something rec:d t:2024-04-06 @SomeContext -2024-04-05 Do something rec:0d -2024-04-05 Do something rec:0d due:2024-04-05 -2024-04-05 Do something rec:0d due:2024-04-05 t:2024-04-05 \ No newline at end of file +2024-04-06 Line 1 rec:1d due:2024-04-07 +2024-04-06 Line 1 rec:w due:2024-04-13 +2024-04-06 Line 1 rec:2m due:2024-06-06 +2024-04-06 Line 1 rec:+1d due:2024-04-08 +2024-04-06 Line 1 rec:7w due:2024-05-25 +2024-04-06 Line 1 due:2023-07-24 rec:+1b +2024-04-06 taxes are due in one year t:2022-03-30 due:2022-04-30 rec:+1y +2024-04-06 Water plants @home +quick due:2024-04-13 t:2024-04-03 rec:1w +2024-04-06 Line 1 rec:+1d t:2023-09-20 +2024-04-06 Line 1 rec:1d pri:A due:2024-04-07 +2024-04-06 (A) Do something rec:d t:2024-04-07 @SomeContext +2024-04-06 Do something rec:0d +2024-04-06 Do something rec:0d due:2024-04-06 +2024-04-06 Do something rec:0d due:2024-04-06 t:2024-04-06 \ No newline at end of file diff --git a/src/__tests__/main/Archive.tsx b/src/__tests__/main/Archive.tsx index fddeb2d9..1038c1df 100644 --- a/src/__tests__/main/Archive.tsx +++ b/src/__tests__/main/Archive.tsx @@ -48,7 +48,6 @@ describe('Archiving', () => { archiveTodos(); const fileContent = fs.readFileSync('./src/__tests__/__mock__/done.txt', 'utf8'); const expectedContent = `x 2022-02-02 todo from done.txt 1\nx 2022-02-03 todo from done.txt 2\nx 2022-02-04 todo from done.txt 3\nx 2022-02-05 todo from done.txt 4\nx 2022-02-01 Finished todo 3\nx 2022-02-08 Finished todo 1\nx 2022-02-17 Finished todo 2`; - //await new Promise((resolve) => setTimeout(resolve, 1000)); setTimeout(() => expect(fileContent).toEqual(expectedContent), 1000); }); }); \ No newline at end of file diff --git a/src/main/modules/DataRequest/DataRequest.tsx b/src/main/modules/DataRequest/DataRequest.tsx index 56c14cbe..6ece4a25 100644 --- a/src/main/modules/DataRequest/DataRequest.tsx +++ b/src/main/modules/DataRequest/DataRequest.tsx @@ -26,7 +26,7 @@ function dataRequest(search?: string): RequestedData { const fileContent = readFileContent(activeFile.todoFilePath, activeFile.todoFileBookmark); const sorting: Sorting[] = config.get('sorting'); - const filters: Filters = filter.get('attributes'); + const filters: Filters = filter.get('attributes'); todoObjects = createTodoObjects(fileContent); @@ -53,6 +53,8 @@ function dataRequest(search?: string): RequestedData { const todoData: TodoDate = sortAndGroupTodoObjects(todoObjects, sorting); + headers.visibleObjects = todoObjects.length; + const requestedData: RequestedData = { todoData, attributes, diff --git a/src/main/modules/File/Watcher.tsx b/src/main/modules/File/Watcher.tsx index 1a38c761..c8f8ef92 100644 --- a/src/main/modules/File/Watcher.tsx +++ b/src/main/modules/File/Watcher.tsx @@ -35,8 +35,6 @@ function createFileWatcher(files: FileObject[]): void { }) .on('unlink', (file) => { console.log(`Unlinked file: ${file}`); - const updatedFiles = files.filter((item) => item.todoFilePath !== file); - config.set('files', updatedFiles); }); eventListeners.watcher = watcher; diff --git a/src/renderer/App.scss b/src/renderer/App.scss index 1f1c6191..912d0d34 100644 --- a/src/renderer/App.scss +++ b/src/renderer/App.scss @@ -7,7 +7,7 @@ body { -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; - font-family: "Helvetica, Arial, Sans-Serif"; + font-family: Helvetica, Arial, sans-serif; code { font-size: 0.9em; background-color: rgba(18, 18, 18, 0.15); diff --git a/src/renderer/App.tsx b/src/renderer/App.tsx index 9f4968af..95895875 100644 --- a/src/renderer/App.tsx +++ b/src/renderer/App.tsx @@ -132,7 +132,7 @@ const App = () => { : null } )} - {todoData && ( + {todoData && headers.availableObjects > 0 && ( <> = memo(({ useEffect(() => { const handleTextFieldValue = () => { - if(textFieldValue) ipcRenderer.send('updateAttributeFields', todoObject?.lineNumber, textFieldValue) + ipcRenderer.send('updateAttributeFields', todoObject?.lineNumber, textFieldValue) }; const delayedSearch: NodeJS.Timeout = setTimeout(handleTextFieldValue, 100); return () => { diff --git a/src/renderer/Drawer/Attributes.tsx b/src/renderer/Drawer/Attributes.tsx index e674997a..a461db7b 100644 --- a/src/renderer/Drawer/Attributes.tsx +++ b/src/renderer/Drawer/Attributes.tsx @@ -147,16 +147,14 @@ const DrawerAttributes: React.FC = memo(({ }; return ( -
+
{!isAttributesEmpty ? ( - Object.keys(attributes).map((key, index) => { const preprocessedAttributes: Attributes = preprocessAttributes(key, attributes[key]); const attributeHeadline: string = translatedAttributes(t)[key]; return Object.keys(preprocessedAttributes).length > 0 ? ( handleAccordionToggle(index)} diff --git a/src/renderer/Drawer/Sorting/DraggableList.scss b/src/renderer/Drawer/Sorting/DraggableList.scss index 4763233f..9c425fbb 100644 --- a/src/renderer/Drawer/Sorting/DraggableList.scss +++ b/src/renderer/Drawer/Sorting/DraggableList.scss @@ -23,10 +23,6 @@ box-shadow: 0 0 0.25em rgba(0, 0, 0, 0.1); } } - .MuiBox-root.disabled { - cursor: not-allowed; - filter: opacity(50%) grayscale(100%); - } } .darkTheme { diff --git a/src/renderer/Grid/Grid.tsx b/src/renderer/Grid/Grid.tsx index 516a1acb..5688091f 100644 --- a/src/renderer/Grid/Grid.tsx +++ b/src/renderer/Grid/Grid.tsx @@ -89,6 +89,8 @@ const GridComponent: React.FC = memo(({ } }; + if(headers.visibleObjects === 0) return null; + return ( {todoData?.map(group => { diff --git a/src/renderer/Navigation.scss b/src/renderer/Navigation.scss index bce7c634..46b8bdfe 100644 --- a/src/renderer/Navigation.scss +++ b/src/renderer/Navigation.scss @@ -63,9 +63,9 @@ svg { color: $dark-grey; } - // &:hover, &:active, &.active { - // background: $light-grey; - // } + &:active, &.active { + background: $light-grey; + } &:focus-visible { background: $mid-grey; border-color: $mid-grey; diff --git a/src/renderer/Shared.tsx b/src/renderer/Shared.tsx index cb04f058..ded3c1c2 100644 --- a/src/renderer/Shared.tsx +++ b/src/renderer/Shared.tsx @@ -107,7 +107,7 @@ export const friendlyDate = (value: string, attributeKey: string, settings: Sett results.push(t('drawer.attributes.nextMonth')); } - if (date.isAfter(today.add(2, 'month').startOf('month'))) { + if (date.isAfter(today.add(1, 'month').endOf('month'))) { results.push(dayjs(date).format('YYYY-MM-DD')); } diff --git a/src/renderer/index.ejs b/src/renderer/index.ejs index 43d22bf0..b46aa3c5 100644 --- a/src/renderer/index.ejs +++ b/src/renderer/index.ejs @@ -1,5 +1,5 @@ - + =3.0.0 <4.0.0" immutable "^4.0.0" @@ -8999,10 +8995,10 @@ saxes@^6.0.0: dependencies: xmlchars "^2.2.0" -scheduler@^0.23.0: - version "0.23.0" - resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.23.0.tgz#ba8041afc3d30eb206a487b6b384002e4e61fdfe" - integrity sha512-CtuThmgHNg7zIZWAXi3AsyIzA3n4xx7aNyjwC2VJldO2LMVDhFK+63xGqq6CsJH4rTAt6/M+N4GhZiDYPx9eUw== +scheduler@^0.23.2: + version "0.23.2" + resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.23.2.tgz#414ba64a3b282892e944cf2108ecc078d115cdc3" + integrity sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ== dependencies: loose-envify "^1.1.0" @@ -9283,19 +9279,24 @@ socks-proxy-agent@^7.0.0: socks "^2.6.2" socks@^2.6.2: - version "2.8.1" - resolved "https://registry.yarnpkg.com/socks/-/socks-2.8.1.tgz#22c7d9dd7882649043cba0eafb49ae144e3457af" - integrity sha512-B6w7tkwNid7ToxjZ08rQMT8M9BJAf8DKx8Ft4NivzH0zBUfd6jldGcisJn/RLgxcX3FPNDdNQCUEMMT79b+oCQ== + version "2.8.3" + resolved "https://registry.yarnpkg.com/socks/-/socks-2.8.3.tgz#1ebd0f09c52ba95a09750afe3f3f9f724a800cb5" + integrity sha512-l5x7VUUWbjVFbafGLxPWkYsHIhEvmF85tbIeFZWc8ZPtoMyybuEhL7Jye/ooC4/d48FgOjSJXgsF/AJPYCW8Zw== dependencies: ip-address "^9.0.5" smart-buffer "^4.2.0" +sonic-forest@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/sonic-forest/-/sonic-forest-1.0.0.tgz#b0b77d9bca76434f4ef87b61042d041da63f3be5" + integrity sha512-yFO2N4uTUFtgKLw03WWFpN1iEwZySweMsa18XN3Kt0yYrlmVHunC2ZgM+437zDoKISAJHcH3Cg18U7d6tuSgSQ== + source-map-generator@0.8.0: version "0.8.0" resolved "https://registry.yarnpkg.com/source-map-generator/-/source-map-generator-0.8.0.tgz#10d5ca0651e2c9302ea338739cbd4408849c5d00" integrity sha512-psgxdGMwl5MZM9S3FWee4EgsEaIjahYV5AzGnwUvPhWeITz/j6rKpysQHlQ4USdxvINlb8lKfWGIXwfkrgtqkA== -"source-map-js@>=0.6.2 <2.0.0", source-map-js@^1.0.1, source-map-js@^1.0.2, source-map-js@^1.2.0: +"source-map-js@>=0.6.2 <2.0.0", source-map-js@^1.0.1, source-map-js@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.2.0.tgz#16b809c162517b5b8c3e7dcd315a2a5c2612b2af" integrity sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg== @@ -9634,9 +9635,9 @@ terser-webpack-plugin@^5.3.10, terser-webpack-plugin@^5.3.9: terser "^5.26.0" terser@^5.10.0, terser@^5.26.0: - version "5.30.3" - resolved "https://registry.yarnpkg.com/terser/-/terser-5.30.3.tgz#f1bb68ded42408c316b548e3ec2526d7dd03f4d2" - integrity sha512-STdUgOUx8rLbMGO9IOwHLpCqolkDITFFQSMYYwKE1N2lY6MVSaeoi10z/EhWxRc6ybqoVmKSkhKYH/XUpl7vSA== + version "5.30.4" + resolved "https://registry.yarnpkg.com/terser/-/terser-5.30.4.tgz#62b4d16a819424e6317fd5ceffb4ee8dc769803a" + integrity sha512-xRdd0v64a8mFK9bnsKVdoNP9GQIKUAaJPTaqEQDL4w/J8WaW4sWXXoMZ+6SimPkfT5bElreXf8m9HnmPc3E1BQ== dependencies: "@jridgewell/source-map" "^0.3.3" acorn "^8.8.2" @@ -9652,6 +9653,11 @@ test-exclude@^6.0.0: glob "^7.1.4" minimatch "^3.0.4" +thingies@^1.20.0: + version "1.21.0" + resolved "https://registry.yarnpkg.com/thingies/-/thingies-1.21.0.tgz#e80fbe58fd6fdaaab8fad9b67bd0a5c943c445c1" + integrity sha512-hsqsJsFMsV+aD4s3CWKk85ep/3I9XzYV/IXaSouJMYIoDlgyi11cBhsqYe9/geRfB0YIikBQg6raRaM+nIMP9g== + thunky@^1.0.2: version "1.1.0" resolved "https://registry.yarnpkg.com/thunky/-/thunky-1.1.0.tgz#5abaf714a9405db0504732bbccd2cedd9ef9537d" @@ -9836,9 +9842,9 @@ type-is@~1.6.18: mime-types "~2.1.24" typescript@^5.3.3, typescript@^5.4.2: - version "5.4.4" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.4.4.tgz#eb2471e7b0a5f1377523700a21669dce30c2d952" - integrity sha512-dGE2Vv8cpVvw28v8HCPqyb08EzbBURxDpuhJvTrusShUfGnhHBafDsLdS1EhhxyL6BJQE+2cT3dDPAv+MQ6oLw== + version "5.4.5" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.4.5.tgz#42ccef2c571fdbd0f6718b1d1f5e6e5ef006f611" + integrity sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ== undici-types@~5.26.4: version "5.26.5" @@ -10141,9 +10147,9 @@ webidl-conversions@^7.0.0: integrity sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g== webpack-bundle-analyzer@^4.9.0: - version "4.10.1" - resolved "https://registry.yarnpkg.com/webpack-bundle-analyzer/-/webpack-bundle-analyzer-4.10.1.tgz#84b7473b630a7b8c21c741f81d8fe4593208b454" - integrity sha512-s3P7pgexgT/HTUSYgxJyn28A+99mmLq4HsJepMPzu0R8ImJc52QNqaFYW1Z2z2uIb1/J3eYgaAWVpaC+v/1aAQ== + version "4.10.2" + resolved "https://registry.yarnpkg.com/webpack-bundle-analyzer/-/webpack-bundle-analyzer-4.10.2.tgz#633af2862c213730be3dbdf40456db171b60d5bd" + integrity sha512-vJptkMm9pk5si4Bv922ZbKLV8UTT4zib4FPgXMhgzUny0bfDDkLXAVQs3ly3fS4/TN9ROFtb0NFrm04UXFE/Vw== dependencies: "@discoveryjs/json-ext" "0.5.7" acorn "^8.0.4" @@ -10153,7 +10159,6 @@ webpack-bundle-analyzer@^4.9.0: escape-string-regexp "^4.0.0" gzip-size "^6.0.0" html-escaper "^2.0.2" - is-plain-object "^5.0.0" opener "^1.5.2" picocolors "^1.0.0" sirv "^2.0.3" @@ -10399,9 +10404,9 @@ ws@^7.3.1: integrity sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q== ws@^8.11.0, ws@^8.16.0: - version "8.16.0" - resolved "https://registry.yarnpkg.com/ws/-/ws-8.16.0.tgz#d1cd774f36fbc07165066a60e40323eab6446fd4" - integrity sha512-HS0c//TP7Ina87TfiPUz1rQzMhHrl/SG2guqRcTOIUYD2q8uhUdNHZYJUaQ8aTGPzCh+c6oawMKW35nFl1dxyQ== + version "8.17.0" + resolved "https://registry.yarnpkg.com/ws/-/ws-8.17.0.tgz#d145d18eca2ed25aaf791a183903f7be5e295fea" + integrity sha512-uJq6108EgZMAl20KagGkzCKfMEjxmKvZHG7Tlq0Z6nOky7YF7aq4mOx6xK8TJ/i1LeK4Qus7INktacctDgY8Ow== xml-name-validator@^4.0.0: version "4.0.0"