Skip to content

Commit

Permalink
Fixed #609 (comment). Introducing chokidarOptions settings (#692) and…
Browse files Browse the repository at this point in the history
… reverting default filewatcher configuration to pre 2.0.12
  • Loading branch information
ransome1 committed Mar 27, 2024
1 parent 340fd37 commit 13f8f4d
Show file tree
Hide file tree
Showing 12 changed files with 28 additions and 24 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.13-rc.1" date="2024-03-24"/>
<release version="2.0.13-rc.2" date="2024-03-27"/>
</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.13-rc.1",
"version": "2.0.13-rc.2",
"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.13-rc.1",
"version": "2.0.13-rc.2",
"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.13-rc.1"
version: "2.0.13-rc.2"
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
13 changes: 11 additions & 2 deletions src/main/config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,18 @@ const config: Store<Settings> = new Store<Settings>({
store.set('fileWatcherPolling', false);
store.set('fileWatcherPollingInterval', 100);
},
'2.0.13': store => {
console.log('Migrating from 2.0.12 → 2.0.13');
'2.0.13-rc.2': store => {
console.log('Migrating from 2.0.12 → 2.0.13-rc.2');
store.set('weekStart', 1);
store.delete('fileWatcherAtomic');
store.delete('fileWatcherPolling');
store.delete('fileWatcherPollingInterval');
store.set('chokidarOptions', {
awaitWriteFinish: {
stabilityThreshold: 100,
pollInterval: 100
}
})
},
}
});
Expand Down
12 changes: 3 additions & 9 deletions src/main/modules/File/Watcher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,9 @@ function createFileWatcher(files: FileObject[]): void {
config.set('files', files)
}

const fileWatcherAtomic = config.get('fileWatcherAtomic') || 1000;
const fileWatcherPolling = config.get('fileWatcherPolling') || false;
const fileWatcherPollingInterval = config.get('fileWatcherPollingInterval') || 100;

watcher = chokidar.watch(files.map((file) => file.todoFilePath), {
atomic: fileWatcherAtomic,
usePolling: fileWatcherPolling,
interval: fileWatcherPollingInterval
});
const chokidarOptions = config.get('chokidarOptions');

watcher = chokidar.watch(files.map((file) => file.todoFilePath), chokidarOptions);

watcher
.on('add', (file) => {
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const App = () => {
.catch((error) => {
console.error(error);
});
}, [settings.language]);
}, [settings.language]);

useEffect(() => {
const windowHeight = window.innerHeight;
Expand Down
5 changes: 5 additions & 0 deletions src/renderer/Dialog/DatePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import { i18n } from '../Settings/LanguageSelector';
import { DatePicker, LocalizationProvider } from '@mui/x-date-pickers';
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
import dayjs from 'dayjs';
import updateLocale from 'dayjs/plugin/updateLocale';
import './DatePicker.scss';
dayjs.extend(updateLocale);

interface Props extends WithTranslation {
date: string | null;
Expand All @@ -21,6 +23,9 @@ const DatePickerComponent: React.FC<Props> = ({
handleChange,
t,
}) => {
dayjs.updateLocale(settings.language, {
weekStart: settings.weekStart,
});
return (
<LocalizationProvider dateAdapter={AdapterDayjs} adapterLocale={settings.language}>
<DatePicker
Expand Down
3 changes: 0 additions & 3 deletions src/renderer/Header/Search/Input.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
}
.MuiButtonBase-root {
border: none;
svg {
color: $blue;
}
svg.invert {
transform: rotate(180deg);
}
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/Settings/LanguageSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ i18n
.init(options)
.then(() => {
if(!store.getConfig('language')) {
store.setConfig('language', navigator.language.toLowerCase());
store.setConfig('language', navigator.language.toLowerCase().substr(0, 2));
}
i18n.on('missingKey', (key: string) => {
console.warn(`Missing translation key: ${key}`);
Expand Down
5 changes: 2 additions & 3 deletions src/renderer/Shared.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export const friendlyDate = (value: string, attributeKey: string, settings: Sett
results.push((attributeKey === 'due') ? t('drawer.attributes.overdue') : t('drawer.attributes.elapsed'));
}

if (date.isAfter(today.subtract(1, 'week').startOf('week')) && date.isBefore(today.subtract(1, 'week').endOf('week'))) {
if (date.isAfter(today.subtract(1, 'week').startOf('week').subtract(1, 'day')) && date.isBefore(today.subtract(1, 'week').endOf('week'))) {
results.push(t('drawer.attributes.lastWeek'));
}

Expand All @@ -99,13 +99,12 @@ export const friendlyDate = (value: string, attributeKey: string, settings: Sett
results.push(t('drawer.attributes.tomorrow'));
}


if (date.isSame(today.add(1, 'week'), 'week')) {
results.push(t('drawer.attributes.nextWeek'));
}

if (date.month() === today.add(1, 'month').month()) {
results.push(t('drawer.attributes.nextMonth'));
results.push(t('drawer.attributes.nextMonth'));
}

if (date.isAfter(today.add(2, 'month').startOf('month'))) {
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/index.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8" />
<meta
http-equiv="Content-Security-Policy"
content="script-src 'self' 'unsafe-inline' https://www.datenkrake.eu https://datenkrake.eu http://49.13.201.203"
content="script-src 'self' https://www.datenkrake.eu/matomo/js https://datenkrake.eu/matomo/js"
/>
<title>sleek</title>
</head>
Expand Down

0 comments on commit 13f8f4d

Please sign in to comment.