Compare commits

..

No commits in common. "master" and "4.5.0" have entirely different histories.

8 changed files with 9 additions and 34 deletions

View file

@ -1,7 +1,7 @@
{
"id": "dynamic-timetable",
"name": "Dynamic Timetable",
"version": "4.6.1",
"version": "4.5.0",
"minAppVersion": "1.2.8",
"description": "Calculate the estimated time of completion from the estimated time of the task and dynamically create a timetable.",
"author": "L7Cy",

View file

@ -1,7 +1,7 @@
{
"id": "dynamic-timetable",
"name": "Dynamic Timetable",
"version": "4.6.1",
"version": "4.5.0",
"minAppVersion": "1.2.8",
"description": "Calculate the estimated time of completion from the estimated time of the task and dynamically create a timetable.",
"author": "L7Cy",

View file

@ -1,6 +1,6 @@
{
"name": "dynamic-timetable",
"version": "4.6.1",
"version": "4.5.0",
"description": "Calculate the estimated time of completion from the estimated time of the task and dynamically create a timetable.",
"main": "main.js",
"scripts": {

View file

@ -4,17 +4,11 @@ type BufferTimeRowProps = {
bufferTime: number | null;
};
const formatTime = (minutes: number): string => {
const hours = Math.floor(minutes / 60);
const remainingMinutes = minutes % 60;
return `${hours}h${remainingMinutes}min`;
};
const BufferTimeRow: React.FC<BufferTimeRowProps> = ({ bufferTime }) => (
<tr className="buffer-time dt-buffer-time">
<td>Buffer Time</td>
<td colSpan={3} style={{ textAlign: 'center' }}>
{bufferTime !== null ? formatTime(bufferTime) : '0h0min'}
{bufferTime ? bufferTime : 0}min
</td>
</tr>
);

View file

@ -60,11 +60,6 @@ export class DynamicTimetableSettingTab extends PluginSettingTab {
'Enter a regex that matches the delimiter for a new day.',
'^---$'
);
this.createTextSetting(
'Show Until Regex',
'showUntilRegex',
'Enter a regex. Tasks will be shown until a line matching this regex is found.'
);
const headerNames = Array.isArray(this.plugin.settings.headerNames)
? this.plugin.settings.headerNames.join(', ')
: '';

View file

@ -13,7 +13,6 @@ export interface Task {
export class TaskParser {
private dateDelimiter: RegExp;
private showUntilRegex: RegExp;
constructor(
private separator: string,
@ -21,13 +20,9 @@ export class TaskParser {
dateDelimiter: string,
private showStartTimeInTaskName: boolean,
private showEstimateInTaskName: boolean,
private showCategoryNamesInTask: boolean,
showUntilRegex: string
private showCategoryNamesInTask: boolean
) {
this.dateDelimiter = dateDelimiter ? new RegExp(dateDelimiter) : /(?!x)x/;
this.showUntilRegex = showUntilRegex
? new RegExp(showUntilRegex)
: /(?!x)x/;
}
static fromSettings(settings: DynamicTimetableSettings): TaskParser {
@ -37,8 +32,7 @@ export class TaskParser {
settings.dateDelimiter,
settings.showStartTimeInTaskName,
settings.showEstimateInTaskName,
settings.showCategoryNamesInTask,
settings.showUntilRegex
settings.showCategoryNamesInTask
);
}
@ -47,24 +41,18 @@ export class TaskParser {
let firstUncompletedTaskFound = false;
let nextDay = 0;
let dateDelimiterFound = false;
let stopParsing = false;
const yamlStartTime = this.getYamlStartTime(content);
const tasks = content
.split('\n')
.map((line) => line.trim())
.reduce((acc: Task[], task) => {
if (stopParsing) return acc;
if (this.isDateDelimiterLine(task)) {
if (firstUncompletedTaskFound) {
dateDelimiterFound = true;
}
return acc;
}
if (this.showUntilRegex.test(task)) {
stopParsing = true;
return acc;
}
if (
!task.startsWith('- [ ]') &&

View file

@ -115,10 +115,10 @@ const TimetableViewComponent = forwardRef<
}
newBackgroundColors[category] = color;
document.documentElement.style.setProperty(`--${className}-bg`, color);
if (!plugin.isCategoryColorsReady) {
plugin.isCategoryColorsReady = true;
}
});
if (!plugin.isCategoryColorsReady) {
plugin.isCategoryColorsReady = true;
}
});
setCategoryBackgroundColors(newBackgroundColors);

View file

@ -30,7 +30,6 @@ export interface DynamicTimetableSettings {
pathToDictionary: string;
showRemainingTime: boolean;
customUrlScheme: string;
showUntilRegex: string;
[key: string]:
| string
| boolean
@ -75,7 +74,6 @@ export default class DynamicTimetable extends Plugin {
pathToDictionary: '',
showRemainingTime: true,
customUrlScheme: '',
showUntilRegex: '',
};
async onload() {