Skip to content

Commit

Permalink
on macOS files can now be dopped on dock icon, on macOS sleek is now …
Browse files Browse the repository at this point in the history
…available in native "Open With" context menu, lot's of refactoring
  • Loading branch information
ransome1 committed Dec 28, 2023
1 parent fae3154 commit 8746dfd
Show file tree
Hide file tree
Showing 81 changed files with 647 additions and 617 deletions.
6 changes: 3 additions & 3 deletions .erb/configs/webpack.config.renderer.dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const configuration: webpack.Configuration = {
module: {
rules: [
{
test: /\.s?(c|a)ss$/,
test: /\.s?([ca])ss$/,
use: [
'style-loader',
{
Expand All @@ -76,12 +76,12 @@ const configuration: webpack.Configuration = {
},
'sass-loader',
],
include: /\.module\.s?(c|a)ss$/,
include: /\.module\.s?([ca])ss$/,
},
{
test: /\.s?css$/,
use: ['style-loader', 'css-loader', 'sass-loader'],
exclude: /\.module\.s?(c|a)ss$/,
exclude: /\.module\.s?([ca])ss$/,
},
// Fonts
{
Expand Down
8 changes: 4 additions & 4 deletions .erb/configs/webpack.config.renderer.prod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const configuration: webpack.Configuration = {
module: {
rules: [
{
test: /\.s?(a|c)ss$/,
test: /\.s?([ac])ss$/,
use: [
MiniCssExtractPlugin.loader,
{
Expand All @@ -52,12 +52,12 @@ const configuration: webpack.Configuration = {
},
'sass-loader',
],
include: /\.module\.s?(c|a)ss$/,
include: /\.module\.s?([ca])ss$/,
},
{
test: /\.s?(a|c)ss$/,
test: /\.s?([ac])ss$/,
use: [MiniCssExtractPlugin.loader, 'css-loader', 'sass-loader'],
exclude: /\.module\.s?(c|a)ss$/,
exclude: /\.module\.s?([ca])ss$/,
},
// Fonts
{
Expand Down
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ labels: 'feature request'
### Important ###
If your feature request is more of a **loose idea** and you are **unsure about its implementation or potential impact**, please discuss it first in the [GitHub Discussions section](https://github.com/ransome1/sleek/discussions).

### Description ###
[_Provide a clear and detailed description of the feature you are requesting. Explain what the feature should do and how it would enhance the functionality or user experience of the app._]
### What problem does it solve? ###
Offer a comprehensive and detailed explanation of the problem addressed by this feature and its target audience. Describe the intended functionality and how it contributes to improving the overall app experience.

### Impact on the interface ###
[_What specific alterations will this feature make to the interface?_]
How does this feature impact the interface in terms of interactive elements? Where should these elements be positioned, and do they require specific labels? Provide a detailed description of how you envision incorporating this feature into sleek.
3 changes: 0 additions & 3 deletions .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@ jobs:
yarn run build
- name: Run Electron Builder
uses: samuelmeuli/action-electron-builder@v1
env:
CSC_LINK: ${{ secrets.CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
with:
max_attempts: 5
github_token: ${{ secrets.github_token }}
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@ npm-debug.log.*
*.drawio
*.snap
*FilterLang.js
*package-lock.json
*package-lock.json
*qodana*
2 changes: 1 addition & 1 deletion flatpak/com.github.ransome1.sleek.appdata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<developer_name>Robin Ahle</developer_name>
<content_rating type="oars-1.1"/>
<releases>
<release version="2.0.4" date="2023-12-24"/>
<release version="2.0.4-rc.5" date="2023-12-28"/>
</releases>
<url type="homepage">https://github.com/ransome1/sleek</url>
<url type="contact">https://github.com/ransome1/sleek/issues</url>
Expand Down
2 changes: 1 addition & 1 deletion flatpak/com.github.ransome1.sleek.desktop
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[Desktop Entry]
Version=2.0.4
Version=2.0.4-rc.5
Name=sleek
Exec=sleek
Type=Application
Expand Down
25 changes: 21 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sleek",
"version": "2.0.4",
"version": "2.0.4-rc.5",
"main": "./src/main/main.tsx",
"scripts": {
"build": "concurrently \"yarn run peggy\" \"yarn run build:main\" \"yarn run build:renderer\"",
Expand Down Expand Up @@ -97,6 +97,7 @@
"@teamsupercell/typings-for-css-modules-loader": "^2.5.2",
"@testing-library/jest-dom": "^6.1.5",
"@testing-library/react": "^14.0.0",
"@types/react-autosuggest": "^10.1.10",
"@types/jest": "^29.5.2",
"@types/node": "20.10.5",
"@types/react": "^18.2.8",
Expand All @@ -110,7 +111,7 @@
"css-minimizer-webpack-plugin": "^5.0.0",
"depcheck": "^1.4.7",
"detect-port": "^1.5.1",
"electron": "^27.0.0",
"electron": "27.2.0",
"electron-builder": "^24.2.1",
"electron-devtools-installer": "^3.2.0",
"electronmon": "^2.0.2",
Expand Down Expand Up @@ -166,7 +167,7 @@
"isPackage": false,
"rank": "Owner"
}
],
],
"icon": "assets/icons/icon.icns",
"type": "distribution",
"hardenedRuntime": true,
Expand Down Expand Up @@ -212,7 +213,15 @@
"nsis"
],
"icon": "assets/icons/sleek.ico",
"artifactName": "${productName}-${version}-win.${ext}"
"artifactName": "${productName}-${version}-win.${ext}",
"fileAssociations": [
{
"ext": [
"txt",
"md"
]
}
]
},
"nsis": {
"artifactName": "${productName}-${version}-win-Setup.${ext}"
Expand All @@ -232,6 +241,14 @@
"freebsd",
"rpm",
"AppImage"
],
"fileAssociations": [
{
"ext": [
"txt",
"md"
]
}
]
},
"directories": {
Expand Down
2 changes: 1 addition & 1 deletion release/app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sleek",
"version": "2.0.4",
"version": "2.0.4-rc.5",
"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 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.4"
version: "2.0.4-rc.5"
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 @@

2023-12-26 Line 1 rec:1d due:2023-12-27
2023-12-26 Line 1 rec:w due:2024-01-02
2023-12-26 Line 1 rec:2m due:2024-02-26
2023-12-26 Line 1 rec:+1d due:2023-12-28
2023-12-26 Line 1 rec:7w due:2024-02-13
2023-12-26 Line 1 due:2023-07-24 rec:+1b
2023-12-26 taxes are due in one year t:2022-03-30 due:2022-04-30 rec:+1y
2023-12-26 Water plants @home +quick due:2024-01-02 t:2023-12-23 rec:1w
2023-12-26 Line 1 rec:+1d t:2023-09-20
2023-12-26 Line 1 rec:1d pri:A due:2023-12-27
2023-12-26 (A) Do something rec:d t:2023-12-27 @SomeContext
2023-12-26 Do something rec:0d
2023-12-26 Do something rec:0d due:2023-12-26
2023-12-26 Do something rec:0d due:2023-12-26 t:2023-12-26
2023-12-28 Line 1 rec:1d due:2023-12-29
2023-12-28 Line 1 rec:w due:2024-01-04
2023-12-28 Line 1 rec:2m due:2024-02-28
2023-12-28 Line 1 rec:+1d due:2023-12-30
2023-12-28 Line 1 rec:7w due:2024-02-15
2023-12-28 Line 1 due:2023-07-24 rec:+1b
2023-12-28 taxes are due in one year t:2022-03-30 due:2022-04-30 rec:+1y
2023-12-28 Water plants @home +quick due:2024-01-04 t:2023-12-25 rec:1w
2023-12-28 Line 1 rec:+1d t:2023-09-20
2023-12-28 Line 1 rec:1d pri:A due:2023-12-29
2023-12-28 (A) Do something rec:d t:2023-12-29 @SomeContext
2023-12-28 Do something rec:0d
2023-12-28 Do something rec:0d due:2023-12-28
2023-12-28 Do something rec:0d due:2023-12-28 t:2023-12-28
2 changes: 1 addition & 1 deletion src/__tests__/main/Archive.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import archiveTodos from '../../main/modules/File/Archive';
import { archiveTodos } from '../../main/modules/File/Archive';
import fs from 'fs/promises';

jest.mock('electron', () => ({
Expand Down
1 change: 0 additions & 1 deletion src/__tests__/main/ChangeCompleteState.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { changeCompleteState } from '../../main/modules/ProcessDataRequest/ChangeCompleteState';
import { Item } from 'jstodotxt';
import dayjs from 'dayjs';

const date: string = dayjs(new Date()).format('YYYY-MM-DD');
Expand Down
33 changes: 15 additions & 18 deletions src/__tests__/main/CreateRecurringTodo.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import fs from 'fs/promises';
import { writeTodoObjectToFile } from '../../main/modules/File/Write';
import { createRecurringTodo } from '../../main/modules/ProcessDataRequest/CreateRecurringTodo';
import { getActiveFile } from '../../main/modules/File/Active';
import { lines } from '../../main/modules/ProcessDataRequest/CreateTodoObjects';
import dayjs from 'dayjs';

jest.mock('../../main/modules/ProcessDataRequest/CreateTodoObjects', () => ({
Expand Down Expand Up @@ -37,89 +34,89 @@ const dateTodayInSevenWeeks = dateToday.add(7, 'week').format('YYYY-MM-DD');
describe('Create recurring todos', () => {
beforeEach(async () => {
jest.clearAllMocks();
fs.writeFile('./src/__tests__/__mock__/recurrence.txt', '');
await fs.writeFile('./src/__tests__/__mock__/recurrence.txt', '');
});

test('Should add a new todo with due date set to tomorrow', async () => {
const recurringTodo = await createRecurringTodo(`x ${dateTodayString} ${dateTodayString} Line 1 rec:1d`, '1d');
await createRecurringTodo(`x ${dateTodayString} ${dateTodayString} Line 1 rec:1d`, '1d');
const fileContent = await fs.readFile('./src/__tests__/__mock__/recurrence.txt', 'utf8');
expect(fileContent.split('\n').pop()).toEqual(dateTodayString + ' Line 1 rec:1d due:' + dateTomorrowString);
});

test('Should add a new todo with due date set to next week', async () => {
const recurringTodo = await createRecurringTodo(`x ${dateTodayString} ${dateTodayString} Line 1 rec:w`, 'w');
await createRecurringTodo(`x ${dateTodayString} ${dateTodayString} Line 1 rec:w`, 'w');
const fileContent = await fs.readFile('./src/__tests__/__mock__/recurrence.txt', 'utf8');
expect(fileContent.split('\n').pop()).toEqual(dateTodayString + ' Line 1 rec:w due:' + dateInOneWeekString);
});

test('Should add a new todo with due date set to today in 2 months', async () => {
const recurringTodo = await createRecurringTodo(`x ${dateTodayString} ${dateTodayString} Line 1 rec:2m`, '2m');
await createRecurringTodo(`x ${dateTodayString} ${dateTodayString} Line 1 rec:2m`, '2m');
const fileContent = await fs.readFile('./src/__tests__/__mock__/recurrence.txt', 'utf8');
expect(fileContent.split('\n').pop()).toEqual(dateTodayString + ' Line 1 rec:2m due:' + dateTodayInTwoMonths);
});

test('Should add a new todo with due date set to day after tomorrow', async () => {
const recurringTodo = await createRecurringTodo(`x ${dateTodayString} ${dateTodayString} Line 1 rec:+1d due:${dateTomorrowString}`, '+1d');
await createRecurringTodo(`x ${dateTodayString} ${dateTodayString} Line 1 rec:+1d due:${dateTomorrowString}`, '+1d');
const fileContent = await fs.readFile('./src/__tests__/__mock__/recurrence.txt', 'utf8');
expect(fileContent.split('\n').pop()).toEqual(dateTodayString + ' Line 1 rec:+1d due:' + dateDayAfterTomorrowString);
});

test('Should add a new todo with due date set to today in 7 weeks', async () => {
const recurringTodo = await createRecurringTodo(`x ${dateTodayString} ${dateTodayString} Line 1 rec:7w due:${dateTomorrowString}`, '7w');
await createRecurringTodo(`x ${dateTodayString} ${dateTodayString} Line 1 rec:7w due:${dateTomorrowString}`, '7w');
const fileContent = await fs.readFile('./src/__tests__/__mock__/recurrence.txt', 'utf8');
expect(fileContent.split('\n').pop()).toEqual(dateTodayString + ' Line 1 rec:7w due:' + dateTodayInSevenWeeks);
});

test('Should add a new todo with due date set to next possible business day, based off a todo which already contains a due date', async () => {
const recurringTodo = await createRecurringTodo(`x 2023-07-21 2023-07-21 Line 1 due:2023-07-21 rec:+1b`, '+1b');
await createRecurringTodo(`x 2023-07-21 2023-07-21 Line 1 due:2023-07-21 rec:+1b`, '+1b');
const fileContent = await fs.readFile('./src/__tests__/__mock__/recurrence.txt', 'utf8');
expect(fileContent.split('\n').pop()).toEqual(`${dateTodayString} Line 1 due:2023-07-24 rec:+1b`);
});

test('Should add a new todo adding a strict recurrence of one year to due date and threshold date', async () => {
const recurringTodo = await createRecurringTodo(`x 2021-01-01 2021-01-01 taxes are due in one year t:2021-03-30 due:2021-04-30 rec:+1y`, '+1y');
await createRecurringTodo(`x 2021-01-01 2021-01-01 taxes are due in one year t:2021-03-30 due:2021-04-30 rec:+1y`, '+1y');
const fileContent = await fs.readFile('./src/__tests__/__mock__/recurrence.txt', 'utf8');
expect(fileContent.split('\n').pop()).toEqual(`${dateTodayString} taxes are due in one year t:2022-03-30 due:2022-04-30 rec:+1y`);
});

test('Should add a new todo adding a non-strict recurrence of one week to due date and threshold date', async () => {
const recurringTodo = await createRecurringTodo(`x ${dateTodayString} ${dateTodayString} Water plants @home +quick due:2021-07-19 t:2021-07-09 rec:1w`, '1w');
await createRecurringTodo(`x ${dateTodayString} ${dateTodayString} Water plants @home +quick due:2021-07-19 t:2021-07-09 rec:1w`, '1w');
const fileContent = await fs.readFile('./src/__tests__/__mock__/recurrence.txt', 'utf8');
expect(fileContent.split('\n').pop()).toEqual(`${dateTodayString} Water plants @home +quick due:${dateInOneWeekString} t:${dateInOneWeekMinus10String} rec:1w`);
});

test('Should add a new todo adding a strict recurrence of one day to threshold date. No due date should be created.', async () => {
const recurringTodo = await createRecurringTodo(`x ${dateTodayString} ${dateTodayString} Line 1 rec:+1d t:2023-09-19`, '+1d');
await createRecurringTodo(`x ${dateTodayString} ${dateTodayString} Line 1 rec:+1d t:2023-09-19`, '+1d');
const fileContent = await fs.readFile('./src/__tests__/__mock__/recurrence.txt', 'utf8');
expect(fileContent.split('\n').pop()).toEqual(`${dateTodayString} Line 1 rec:+1d t:2023-09-20`);
});

test('Should add a new todo and preserve the priority in the pri extension, but should not set the priority (A) for the task.', async () => {
const recurringTodo = await createRecurringTodo(`x ${dateTodayString} ${dateTodayString} Line 1 rec:1d pri:A`, '1d');
await createRecurringTodo(`x ${dateTodayString} ${dateTodayString} Line 1 rec:1d pri:A`, '1d');
const fileContent = await fs.readFile('./src/__tests__/__mock__/recurrence.txt', 'utf8');
expect(fileContent.split('\n').pop()).toEqual(`${dateTodayString} Line 1 rec:1d pri:A due:${dateTomorrowString}`);
});

test('Should add a new todo based on a daily recurrence and a threshold date set for today, without unwanted due date and priority labels', async () => {
const recurringTodo = await createRecurringTodo(`x ${dateTodayString} ${dateTodayString} (A) Do something rec:d t:${dateTodayString} @SomeContext`, 'd');
await createRecurringTodo(`x ${dateTodayString} ${dateTodayString} (A) Do something rec:d t:${dateTodayString} @SomeContext`, 'd');
const fileContent = await fs.readFile('./src/__tests__/__mock__/recurrence.txt', 'utf8');
expect(fileContent.split('\n').pop()).toEqual(`${dateTodayString} (A) Do something rec:d t:${dateTomorrowString} @SomeContext`);
});

test('Should add a new todo based on a zero daily recurrence and no due date and no threshold date are set', async () => {
const recurringTodo = await createRecurringTodo(`x ${dateTodayString} ${dateTodayString} Do something rec:0d`, '0d');
await createRecurringTodo(`x ${dateTodayString} ${dateTodayString} Do something rec:0d`, '0d');
const fileContent = await fs.readFile('./src/__tests__/__mock__/recurrence.txt', 'utf8');
expect(fileContent.split('\n').pop()).toEqual(`${dateTodayString} Do something rec:0d`);
});

test('Should add a new todo based on a zero daily recurrence and a due date of today is set', async () => {
const recurringTodo = await createRecurringTodo(`x ${dateTodayString} ${dateTodayString} Do something rec:0d due:1999-11-11`, '0d');
await createRecurringTodo(`x ${dateTodayString} ${dateTodayString} Do something rec:0d due:1999-11-11`, '0d');
const fileContent = await fs.readFile('./src/__tests__/__mock__/recurrence.txt', 'utf8');
expect(fileContent.split('\n').pop()).toEqual(`${dateTodayString} Do something rec:0d due:${dateTodayString}`);
});

test('Should add a new todo based on a zero daily recurrence and a due date and a threshold date of today are set', async () => {
const recurringTodo = await createRecurringTodo(`x ${dateTodayString} ${dateTodayString} Do something rec:0d due:1999-11-11 t:2010-03-05`, '0d');
await createRecurringTodo(`x ${dateTodayString} ${dateTodayString} Do something rec:0d due:1999-11-11 t:2010-03-05`, '0d');
const fileContent = await fs.readFile('./src/__tests__/__mock__/recurrence.txt', 'utf8');
expect(fileContent.split('\n').pop()).toEqual(`${dateTodayString} Do something rec:0d due:${dateTodayString} t:${dateTodayString}`);
});
Expand Down
4 changes: 0 additions & 4 deletions src/__tests__/main/CreateTodoObjects.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import dayjs from 'dayjs';
import { createTodoObjects } from '../../main/modules/ProcessDataRequest/CreateTodoObjects';
import { configStorage } from '../../main/config';

const dateTodayString: string = dayjs(new Date()).format('YYYY-MM-DD');

jest.mock('electron', () => ({
app: {
Expand Down
1 change: 0 additions & 1 deletion src/__tests__/main/Dialog.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { dialog } from 'electron';
import { openFile, createFile } from '../../main/modules/File/Dialog';
import { addFile } from '../../main/modules/File/File';
import { configStorage } from '../../main/config';
import fs from 'fs/promises';

jest.mock('../../main/main', () => ({
Expand Down
1 change: 0 additions & 1 deletion src/__tests__/main/File.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import path from 'path'
import { configStorage } from '../../main/config';
import { createMenu } from '../../main/modules/Menu';
import { addFile, removeFile, setFile } from '../../main/modules/File/File';

jest.mock('../../main/main', () => ({
Expand Down
2 changes: 0 additions & 2 deletions src/__tests__/main/ProcessTodoObjects.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,6 @@ const todoObjects: any =
}
];

let groupedTodoObjects: any;

describe('Process todo.txt objects', () => {

beforeEach(() => {
Expand Down
1 change: 0 additions & 1 deletion src/__tests__/main/Write.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import fs from 'fs/promises';
import { writeTodoObjectToFile, removeLineFromFile } from '../../main/modules/File/Write';
import { lines } from '../../main/modules/ProcessDataRequest/CreateTodoObjects';
import { configStorage } from '../../main/config';
import dayjs from 'dayjs';

Expand Down
3 changes: 2 additions & 1 deletion src/locales/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"openFile": "Otevřít soubor",
"createFile": "Vytvořit soubor",
"fileTabs.changeLocation": "Změnit soubor pro archivaci",
"fileTabs.revealFile": "Zobrazit v správci souborů",
"fileTabs.revealTodoFile": "Zobrazit soubor s úkoly v průzkumníku souborů",
"fileTabs.revealArchivingFile": "Zobrazit archivační soubor v průzkumníku souborů",
"fileTabs.removeFileHeadline": "Odstranit soubor ze sleek?",
"fileTabs.removeFileText": "Nebude smazán z pevného disku.",
"fileTabs.removeFileLabel": "Odstranit",
Expand Down
3 changes: 2 additions & 1 deletion src/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"openFile": "Datei öffnen",
"createFile": "Datei erstellen",
"fileTabs.changeLocation": "Datei für die Archivierung ändern",
"fileTabs.revealFile": "Im Dateimanager anzeigen",
"fileTabs.revealTodoFile": "Todo-Datei im Dateimanager anzeigen",
"fileTabs.revealArchivingFile": "Archivdatei im Dateimanager anzeigen",
"fileTabs.removeFileHeadline": "Datei aus sleek entfernen?",
"fileTabs.removeFileText": "Die Datei wird nicht von Ihrer Festplatte gelöscht.",
"fileTabs.removeFileLabel": "Entfernen",
Expand Down
Loading

0 comments on commit 8746dfd

Please sign in to comment.