Skip to content

Commit

Permalink
Refactoring wip. Fixed #701.
Browse files Browse the repository at this point in the history
  • Loading branch information
ransome1 committed Apr 29, 2024
1 parent 882d4da commit d2184c6
Show file tree
Hide file tree
Showing 21 changed files with 292 additions and 295 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions flatpak/com.github.ransome1.sleek.appdata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
<launchable type="desktop-id">com.github.ransome1.sleek.desktop</launchable>
<metadata_license>MIT</metadata_license>
<project_license>MIT</project_license>
<developer_name>Robin Ahle</developer_name>
<developer_name>ransome1</developer_name>
<content_rating type="oars-1.1"/>
<releases>
<release version="2.0.14" date="2024-03-31"/>
<release version="2.0.14-rc.1" date="2024-04-29"/>
</releases>
<url type="homepage">https://github.com/ransome1/sleek</url>
<url type="contact">https://github.com/ransome1/sleek/issues</url>
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -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\"",
Expand Down Expand Up @@ -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": {
Expand Down
4 changes: 2 additions & 2 deletions release/app/package.json
Original file line number Diff line number Diff line change
@@ -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": [
Expand All @@ -18,7 +18,7 @@
"type": "git",
"url": "https://github.com/ransome1/sleek.git"
},
"author": "Robin Ahle <ransome@mailbox.org>",
"author": "ransome1 <ransome@mailbox.org>",
"copyright": "Copyright © 2024 ${author}",
"license": "MIT",
"main": "./dist/main/main.js",
Expand Down
2 changes: 1 addition & 1 deletion snap/snapcraft.yaml
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
28 changes: 14 additions & 14 deletions src/__tests__/__mock__/recurrence.txt
Original file line number Diff line number Diff line change
@@ -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
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
1 change: 0 additions & 1 deletion src/__tests__/main/Archive.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});
4 changes: 3 additions & 1 deletion src/main/modules/DataRequest/DataRequest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -53,6 +53,8 @@ function dataRequest(search?: string): RequestedData {

const todoData: TodoDate = sortAndGroupTodoObjects(todoObjects, sorting);

headers.visibleObjects = todoObjects.length;

const requestedData: RequestedData = {
todoData,
attributes,
Expand Down
2 changes: 0 additions & 2 deletions src/main/modules/File/Watcher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/App.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ const App = () => {
: null }
</>
)}
{todoData && (
{todoData && headers.availableObjects > 0 && (
<>
<GridComponent
todoData={todoData}
Expand Down
3 changes: 0 additions & 3 deletions src/renderer/Dialog/AutoSuggest.scss
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
@import "../Variables.scss";

.react-autosuggest__suggestions-container--open {
display: flex;

max-height: 20em;
min-height: 5em;
overflow-y: auto;
position: fixed;
z-index: 10;
margin-top: 0.125em;
padding: 1em;
display: block;
border-radius: $radius;
background-color: rgba(240, 240, 240, 1);
ul {
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/Dialog/Dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ const DialogComponent: React.FC<Props> = 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 () => {
Expand Down
4 changes: 1 addition & 3 deletions src/renderer/Drawer/Attributes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,16 +147,14 @@ const DrawerAttributes: React.FC<DrawerAttributesProps> = memo(({
};

return (
<div id="Attributes" ref={firstTabbableElementRef}>
<div id="Attributes">
{!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 ? (
<Accordion
TransitionProps={{ unmountOnExit: true }}
key={index}
expanded={settings.accordionOpenState[index]}
onChange={() => handleAccordionToggle(index)}
Expand Down
4 changes: 0 additions & 4 deletions src/renderer/Drawer/Sorting/DraggableList.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 2 additions & 0 deletions src/renderer/Grid/Grid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ const GridComponent: React.FC<GridComponentProps> = memo(({
}
};

if(headers.visibleObjects === 0) return null;

return (
<List id="grid" onScroll={handleScroll} onKeyUp={handleKeyUp}>
{todoData?.map(group => {
Expand Down
6 changes: 3 additions & 3 deletions src/renderer/Navigation.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/Shared.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
}

Expand Down
2 changes: 1 addition & 1 deletion src/renderer/index.ejs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta
Expand Down
2 changes: 1 addition & 1 deletion src/types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ declare global {
};

interface RequestedData {
todoData: TodoDate,
todoData: TodoData,
attributes: Attributes,
headers: HeadersObject,
filters: Filters,
Expand Down
Loading

0 comments on commit d2184c6

Please sign in to comment.