Skip to content

Commit

Permalink
Enhanced "human friendly dates" poc. Added channels for Matomo. Fixed #…
Browse files Browse the repository at this point in the history
  • Loading branch information
ransome1 committed Feb 26, 2024
1 parent e827284 commit fd0ee07
Show file tree
Hide file tree
Showing 33 changed files with 362 additions and 195 deletions.
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.11" date="2024-02-25"/>
<release version="2.0.12-rc.1" date="2024-02-26"/>
</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 package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sleek",
"version": "2.0.11",
"version": "2.0.12-rc.1",
"main": "./src/main/main.tsx",
"scripts": {
"build": "concurrently \"yarn run peggy\" \"yarn run build:main\" \"yarn run build:renderer\"",
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.11",
"version": "2.0.12-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 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.11"
version: "2.0.12-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-02-25 Line 1 rec:1d due:2024-02-26
2024-02-25 Line 1 rec:w due:2024-03-03
2024-02-25 Line 1 rec:2m due:2024-04-25
2024-02-25 Line 1 rec:+1d due:2024-02-27
2024-02-25 Line 1 rec:7w due:2024-04-14
2024-02-25 Line 1 due:2023-07-24 rec:+1b
2024-02-25 taxes are due in one year t:2022-03-30 due:2022-04-30 rec:+1y
2024-02-25 Water plants @home +quick due:2024-03-03 t:2024-02-22 rec:1w
2024-02-25 Line 1 rec:+1d t:2023-09-20
2024-02-25 Line 1 rec:1d pri:A due:2024-02-26
2024-02-25 (A) Do something rec:d t:2024-02-26 @SomeContext
2024-02-25 Do something rec:0d
2024-02-25 Do something rec:0d due:2024-02-25
2024-02-25 Do something rec:0d due:2024-02-25 t:2024-02-25
2024-02-26 Line 1 rec:1d due:2024-02-27
2024-02-26 Line 1 rec:w due:2024-03-04
2024-02-26 Line 1 rec:2m due:2024-04-26
2024-02-26 Line 1 rec:+1d due:2024-02-28
2024-02-26 Line 1 rec:7w due:2024-04-15
2024-02-26 Line 1 due:2023-07-24 rec:+1b
2024-02-26 taxes are due in one year t:2022-03-30 due:2022-04-30 rec:+1y
2024-02-26 Water plants @home +quick due:2024-03-04 t:2024-02-23 rec:1w
2024-02-26 Line 1 rec:+1d t:2023-09-20
2024-02-26 Line 1 rec:1d pri:A due:2024-02-27
2024-02-26 (A) Do something rec:d t:2024-02-27 @SomeContext
2024-02-26 Do something rec:0d
2024-02-26 Do something rec:0d due:2024-02-26
2024-02-26 Do something rec:0d due:2024-02-26 t:2024-02-26
14 changes: 7 additions & 7 deletions src/__tests__/main/Attributes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ describe('Set of filters must create a respective set of attributes and its coun
];

const expectedAttributes = {
priority: { 'A': { count: 1, notify: false, visible: true}, 'C': { count: 1, notify: false, visible: true} },
projects: { 'Project 1': { count: 2, notify: false, visible: true}, 'Project 2': { count: 2, notify: false, visible: true} },
contexts: { 'Context 1': { count: 2, notify: false, visible: true} },
due: { '2023-01-01': { count: 1, notify: false, visible: true}, '2023-02-01': { count: 1, notify: false, visible: true}, '2023-03-01': { count: 1, notify: true, visible: true}, '2023-04-01': { count: 1, notify: false, visible: true} },
t: { '2024-02-01': { count: 2, notify: false, visible: true} },
rec: { '2b': { count: 1, notify: false, visible: true} },
priority: { 'A': { count: 1, notify: false}, 'C': { count: 1, notify: false} },
projects: { 'Project 1': { count: 2, notify: false}, 'Project 2': { count: 2, notify: false} },
contexts: { 'Context 1': { count: 2, notify: false} },
due: { '2023-01-01': { count: 1, notify: false}, '2023-02-01': { count: 1, notify: false}, '2023-03-01': { count: 1, notify: true}, '2023-04-01': { count: 1, notify: false} },
t: { '2024-02-01': { count: 2, notify: false} },
rec: { '2b': { count: 1, notify: false} },
pm: {},
created: { '2026-01-01': { count: 2, notify: false, visible: true} },
created: { '2026-01-01': { count: 2, notify: false} },
completed: {},
};
await updateAttributes(todoObjects, sorting, false);
Expand Down
5 changes: 5 additions & 0 deletions src/locales/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@
"drawer.filters.thresholdDateInTheFuture": "Termín v budoucnosti",
"drawer.filters.dueDateInTheFuture": "Termín splnění v budoucnosti",
"drawer.attributes.noAttributesAvailable": "Zatím nejsou k dispozici žádné atributy",
"drawer.attributes.today": "dnes",
"drawer.attributes.tomorrow": "zítra",
"drawer.attributes.nextWeek": "příští týden",
"drawer.attributes.yesterday": "včera",
"drawer.attributes.lastWeek": "minulý týden",
"drawer.sorting.fileSorting": "Seřadit úkoly podle pořadí v souboru",
"shared.attributeMapping.t": "Termín",
"shared.attributeMapping.due": "Termín splnění",
Expand Down
5 changes: 5 additions & 0 deletions src/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@
"drawer.filters.thresholdDateInTheFuture": "Schwellenwertdatum in der Zukunft",
"drawer.filters.dueDateInTheFuture": "Fälligkeitsdatum in der Zukunft",
"drawer.attributes.noAttributesAvailable": "Noch keine Attribute verfügbar",
"drawer.attributes.today": "heute",
"drawer.attributes.tomorrow": "morgen",
"drawer.attributes.nextWeek": "nächste Woche",
"drawer.attributes.yesterday": "gestern",
"drawer.attributes.lastWeek": "letzte Woche",
"drawer.sorting.fileSorting": "Aufgaben in der Reihenfolge der Datei anordnen",
"shared.attributeMapping.t": "Schwellenwertdatum",
"shared.attributeMapping.due": "Fälligkeitsdatum",
Expand Down
5 changes: 5 additions & 0 deletions src/locales/en-gb.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@
"drawer.filters.thresholdDateInTheFuture": "Threshold date in the future",
"drawer.filters.dueDateInTheFuture": "Due date in the future",
"drawer.attributes.noAttributesAvailable": "No attributes available yet",
"drawer.attributes.today": "today",
"drawer.attributes.tomorrow": "tomorrow",
"drawer.attributes.nextWeek": "next week",
"drawer.attributes.yesterday": "yesterday",
"drawer.attributes.lastWeek": "last week",
"drawer.sorting.fileSorting": "Order todos as they appear in the file",
"shared.attributeMapping.t": "Threshold date",
"shared.attributeMapping.due": "Due date",
Expand Down
5 changes: 5 additions & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@
"drawer.filters.thresholdDateInTheFuture": "Threshold date in the future",
"drawer.filters.dueDateInTheFuture": "Due date in the future",
"drawer.attributes.noAttributesAvailable": "No attributes available yet",
"drawer.attributes.today": "today",
"drawer.attributes.tomorrow": "tomorrow",
"drawer.attributes.nextWeek": "next week",
"drawer.attributes.yesterday": "yesterday",
"drawer.attributes.lastWeek": "last week",
"drawer.sorting.fileSorting": "Order todos as they appear in the file",
"shared.attributeMapping.t": "Threshold date",
"shared.attributeMapping.due": "Due date",
Expand Down
5 changes: 5 additions & 0 deletions src/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@
"drawer.filters.thresholdDateInTheFuture": "Fecha umbral en el futuro",
"drawer.filters.dueDateInTheFuture": "Fecha de vencimiento en el futuro",
"drawer.attributes.noAttributesAvailable": "No hay atributos disponibles aún",
"drawer.attributes.today": "hoy",
"drawer.attributes.tomorrow": "mañana",
"drawer.attributes.nextWeek": "próxima semana",
"drawer.attributes.yesterday": "ayer",
"drawer.attributes.lastWeek": "la semana pasada",
"drawer.sorting.fileSorting": "Ordenar tareas como aparecen en el archivo",
"shared.attributeMapping.t": "Fecha umbral",
"shared.attributeMapping.due": "Fecha de vencimiento",
Expand Down
5 changes: 5 additions & 0 deletions src/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@
"drawer.filters.thresholdDateInTheFuture": "Date limite dans le futur",
"drawer.filters.dueDateInTheFuture": "Date d'échéance dans le futur",
"drawer.attributes.noAttributesAvailable": "Aucun attribut disponible pour le moment",
"drawer.attributes.today": "aujourd'hui",
"drawer.attributes.tomorrow": "demain",
"drawer.attributes.nextWeek": "la semaine prochaine",
"drawer.attributes.yesterday": "hier",
"drawer.attributes.lastWeek": "la semaine dernière",
"drawer.sorting.fileSorting": "Classer les tâches comme elles apparaissent dans le fichier",
"shared.attributeMapping.t": "Date limite",
"shared.attributeMapping.due": "Date d'échéance",
Expand Down
5 changes: 5 additions & 0 deletions src/locales/hi.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@
"drawer.filters.thresholdDateInTheFuture": "भविष्य की सीमा तिथि",
"drawer.filters.dueDateInTheFuture": "भविष्य की समापन तिथि",
"drawer.attributes.noAttributesAvailable": "वर्तमान में कोई गुण उपलब्ध नहीं हैं",
"drawer.attributes.today": "आज",
"drawer.attributes.tomorrow": "कल",
"drawer.attributes.nextWeek": "अगले हफ्ते",
"drawer.attributes.yesterday": "कल",
"drawer.attributes.lastWeek": "पिछले हफ्ते",
"drawer.sorting.fileSorting": "वे दिखाई देते हैं जैसे कि वे फ़ाइल में हैं, कार्य क्रमबद्ध करें",
"shared.attributeMapping.t": "सीमा तिथि",
"shared.attributeMapping.due": "समापन तिथि",
Expand Down
5 changes: 5 additions & 0 deletions src/locales/hu.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@
"drawer.filters.thresholdDateInTheFuture": "Hátralévő dátum a jövőben",
"drawer.filters.dueDateInTheFuture": "Határidő a jövőben",
"drawer.attributes.noAttributesAvailable": "Nincs elérhető tulajdonság",
"drawer.attributes.today": "ma",
"drawer.attributes.tomorrow": "holnap",
"drawer.attributes.nextWeek": "jövő hét",
"drawer.attributes.yesterday": "tegnap",
"drawer.attributes.lastWeek": "múlt hét",
"drawer.sorting.fileSorting": "Feladatok rendezése, ahogy megjelennek a fájlban",
"shared.attributeMapping.t": "Hátralévő dátum",
"shared.attributeMapping.due": "Határidő",
Expand Down
5 changes: 5 additions & 0 deletions src/locales/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@
"drawer.filters.thresholdDateInTheFuture": "Data di scadenza nel futuro",
"drawer.filters.dueDateInTheFuture": "Data di scadenza nel futuro",
"drawer.attributes.noAttributesAvailable": "Nessun attributo disponibile al momento",
"drawer.attributes.today": "oggi",
"drawer.attributes.tomorrow": "domani",
"drawer.attributes.nextWeek": "la prossima settimana",
"drawer.attributes.yesterday": "ieri",
"drawer.attributes.lastWeek": "la settimana scorsa",
"drawer.sorting.fileSorting": "Ordina i compiti come appaiono nel file",
"shared.attributeMapping.t": "Data di scadenza",
"shared.attributeMapping.due": "Data di scadenza",
Expand Down
5 changes: 5 additions & 0 deletions src/locales/jp.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@
"drawer.filters.thresholdDateInTheFuture": "未来の期限日",
"drawer.filters.dueDateInTheFuture": "未来の期日",
"drawer.attributes.noAttributesAvailable": "現在利用可能な属性はありません",
"drawer.attributes.today": "今日",
"drawer.attributes.tomorrow": "明日",
"drawer.attributes.nextWeek": "来週",
"drawer.attributes.yesterday": "昨日",
"drawer.attributes.lastWeek": "先週",
"drawer.sorting.fileSorting": "ファイルに表示される順にタスクを並べ替え",
"shared.attributeMapping.t": "期限日",
"shared.attributeMapping.due": "期日",
Expand Down
5 changes: 5 additions & 0 deletions src/locales/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@
"drawer.filters.thresholdDateInTheFuture": "미래 임계 날짜",
"drawer.filters.dueDateInTheFuture": "미래 마감일",
"drawer.attributes.noAttributesAvailable": "현재 사용 가능한 속성 없음",
"drawer.attributes.today": "오늘",
"drawer.attributes.tomorrow": "내일",
"drawer.attributes.nextWeek": "다음 주",
"drawer.attributes.yesterday": "어제",
"drawer.attributes.lastWeek": "지난 주",
"drawer.sorting.fileSorting": "파일에 나타나는 대로 작업 정렬",
"shared.attributeMapping.t": "임계 날짜",
"shared.attributeMapping.due": "마감일",
Expand Down
5 changes: 5 additions & 0 deletions src/locales/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@
"drawer.filters.thresholdDateInTheFuture": "Data progowa w przyszłości",
"drawer.filters.dueDateInTheFuture": "Termin w przyszłości",
"drawer.attributes.noAttributesAvailable": "Brak dostępnych atrybutów",
"drawer.attributes.today": "dzisiaj",
"drawer.attributes.tomorrow": "jutro",
"drawer.attributes.nextWeek": "następny tydzień",
"drawer.attributes.yesterday": "wczoraj",
"drawer.attributes.lastWeek": "ostatni tydzień",
"drawer.sorting.fileSorting": "Sortuj zadania tak, jak występują w pliku",
"shared.attributeMapping.t": "Data progowa",
"shared.attributeMapping.due": "Termin",
Expand Down
5 changes: 5 additions & 0 deletions src/locales/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@
"drawer.filters.thresholdDateInTheFuture": "Data de limite no futuro",
"drawer.filters.dueDateInTheFuture": "Data de vencimento no futuro",
"drawer.attributes.noAttributesAvailable": "Sem atributos disponíveis por agora",
"drawer.attributes.today": "hoje",
"drawer.attributes.tomorrow": "amanhã",
"drawer.attributes.nextWeek": "próxima semana",
"drawer.attributes.yesterday": "ontem",
"drawer.attributes.lastWeek": "semana passada",
"drawer.sorting.fileSorting": "Ordenar tarefas como aparecem no ficheiro",
"shared.attributeMapping.t": "Data de limite",
"shared.attributeMapping.due": "Data de vencimento",
Expand Down
5 changes: 5 additions & 0 deletions src/locales/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@
"drawer.filters.thresholdDateInTheFuture": "Дата порога в будущем",
"drawer.filters.dueDateInTheFuture": "Дата выполнения в будущем",
"drawer.attributes.noAttributesAvailable": "Нет доступных атрибутов",
"drawer.attributes.today": "сегодня",
"drawer.attributes.tomorrow": "завтра",
"drawer.attributes.nextWeek": "на следующей неделе",
"drawer.attributes.yesterday": "вчера",
"drawer.attributes.lastWeek": "на прошлой неделе",
"drawer.sorting.fileSorting": "Сортировать задачи в порядке их появления в файле",
"shared.attributeMapping.t": "Дата порога",
"shared.attributeMapping.due": "Дата выполнения",
Expand Down
5 changes: 5 additions & 0 deletions src/locales/tr.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@
"drawer.filters.thresholdDateInTheFuture": "Gelecekteki eşik tarihi",
"drawer.filters.dueDateInTheFuture": "Gelecekteki bitiş tarihi",
"drawer.attributes.noAttributesAvailable": "Şu anda kullanılabilir özellik yok",
"drawer.attributes.today": "сегодня",
"drawer.attributes.tomorrow": "завтра",
"drawer.attributes.nextWeek": "на следующей неделе",
"drawer.attributes.yesterday": "вчера",
"drawer.attributes.lastWeek": "на прошлой неделе",
"drawer.sorting.fileSorting": "Görevleri dosyada göründükleri sıraya göre sırala",
"shared.attributeMapping.t": "Eşik tarihi",
"shared.attributeMapping.due": "Bitiş tarihi",
Expand Down
5 changes: 5 additions & 0 deletions src/locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@
"drawer.filters.thresholdDateInTheFuture": "未来的阈值日期",
"drawer.filters.dueDateInTheFuture": "未来的截止日期",
"drawer.attributes.noAttributesAvailable": "目前无可用属性",
"drawer.attributes.today": "今天",
"drawer.attributes.tomorrow": "明天",
"drawer.attributes.nextWeek": "下周",
"drawer.attributes.yesterday": "昨天",
"drawer.attributes.lastWeek": "上周",
"drawer.sorting.fileSorting": "按照它们在文件中出现的顺序排序任务",
"shared.attributeMapping.t": "阈值日期",
"shared.attributeMapping.due": "截止日期",
Expand Down
5 changes: 5 additions & 0 deletions src/main/config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { createFileWatcher } from './modules/File/Watcher';
import { createTray } from './modules/Tray';
import { processDataRequest, searchString } from './modules/ProcessDataRequest/ProcessDataRequest';
import handleTheme from './modules/Theme';
import { getChannel } from './util';
import crypto from 'crypto';

Store.initRenderer();
Expand Down Expand Up @@ -96,6 +97,10 @@ const config: Store<Settings> = new Store<Settings>({
store.set('useHumanFriendlyDates', false);
store.set('excludeLinesWithPrefix', null);
},
'2.0.12': store => {
console.log('Migrating from 2.0.11 → 2.0.12');
store.set('channel', getChannel());
},
}
});

Expand Down
9 changes: 6 additions & 3 deletions src/main/modules/Attributes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,30 @@ function incrementCount(countObject: any, key: any | null, notify: boolean, visi
if(key) {
let previousCount: number = parseInt(countObject[key]?.count) || 0;
countObject[key] = {
count: previousCount + 1,
count: (visible) ? previousCount + 1 : previousCount,
notify: notify,
visible: visible,
}
}
}

function updateAttributes(todoObjects: TodoObject[], sorting: Sorting[], reset: boolean) {

Object.keys(attributes).forEach((key) => {

Object.keys(attributes[key]).forEach((attributeKey) => {
(reset) ? attributes[key] = {} : attributes[key][attributeKey].count = 0
});

todoObjects.forEach((todoObject: TodoObject) => {
const value = todoObject[key as keyof TodoObject];
const notify: boolean = (key === 'due') ? !!todoObject?.notify : false;
const visible: boolean = todoObject.visible;

if(Array.isArray(value)) {
value.forEach((element) => {
if(element !== null) {
const attributeKey = element as keyof Attribute;

incrementCount(attributes[key], attributeKey, notify, visible);
}
});
Expand Down
9 changes: 6 additions & 3 deletions src/main/modules/Filters/Filters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function applyFilters(todoObjects: TodoObject[], filters: Filters | null): TodoO

const attributeValues: any = ['due', 't'].includes(key) ? todoObject[key as keyof TodoObject] : todoObject[key as keyof TodoObject];

return filterArray.every(({ value, exclude }: Filter) => {
return filterArray.every(({ values, exclude }: Filter) => {
if (
attributeValues === undefined ||
attributeValues === null ||
Expand All @@ -20,7 +20,10 @@ function applyFilters(todoObjects: TodoObject[], filters: Filters | null): TodoO
return exclude;
}

const hasMatchingValue = attributeValues.includes(value);
const hasMatchingValue = Array.isArray(attributeValues)
? attributeValues.some((val) => values.includes(val))
: values.includes(attributeValues);

return exclude ? !hasMatchingValue : hasMatchingValue;
});
});
Expand All @@ -31,4 +34,4 @@ function applyFilters(todoObjects: TodoObject[], filters: Filters | null): TodoO
});
}

export { applyFilters };
export { applyFilters };
23 changes: 22 additions & 1 deletion src/main/util.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,25 @@ function resolveHtmlPath(htmlFileName: string): string {
return `file://${path.resolve(__dirname, '../renderer/', htmlFileName)}`;
}

export { getAssetPath, resolveHtmlPath }
function getChannel(): string {
switch (true) {
case process.env.APPIMAGE:
return "AppImage";
case process.windowsStore:
return "Windows Store";
case process.mas:
return "Mac App Store";
case process.env.SNAP:
return "Snap Store";
case process.env.FLATPAK_ID:
return "Flathub";
case process.env.AUR:
return "AUR";
case process.env.PORTABLE_EXECUTABLE_DIR:
return "Portable";
default:
return "Misc";
}
}

export { getAssetPath, resolveHtmlPath, getChannel }
Loading

0 comments on commit fd0ee07

Please sign in to comment.