Skip to content

Commit dd8e431

Browse files
committed
Merge remote-tracking branch 'upstream/main' into temp
2 parents 4c18964 + 9f84a84 commit dd8e431

39 files changed

+1113
-611
lines changed

main.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ import vaultScanner, {
2828
} from "src/managers/VaultScanner";
2929
import { TaskBoardIcon } from "src/interfaces/Icons";
3030
import { TaskBoardSettingTab } from "./src/settings/TaskBoardSettingTab";
31-
import { VIEW_TYPE_TASKBOARD } from "src/interfaces/Constants";
31+
import {
32+
newReleaseVersion,
33+
VIEW_TYPE_TASKBOARD,
34+
} from "src/interfaces/Constants";
3235
import { isReminderPluginInstalled } from "src/services/CommunityPlugins";
3336
import { loadTranslationsOnStartup, t } from "src/utils/lang/helper";
3437
import { TaskBoardApi } from "src/taskboardAPIs";
@@ -949,15 +952,18 @@ export default class TaskBoard extends Plugin {
949952

950953
private runOnPluginUpdate() {
951954
// Check if the plugin version has changed
952-
const currentVersion = "1.8.2"; // Change this whenever you will going to release a new version.
953-
const runMandatoryScan = false; // Change this whenever you will release a major version which requires user to scan the whole vault again. And to enable the notification.
955+
const currentVersion = newReleaseVersion; // Change this whenever you will going to release a new version.
956+
const runMandatoryScan = true; // Change this whenever you will release a major version which requires user to scan the whole vault again. And to enable the notification.
954957
const previousVersion = this.settings.version;
955958

956959
if (previousVersion == "" || currentVersion !== previousVersion) {
957960
// make the localStorage flag, 'manadatoryScan' to True
958961

959962
if (previousVersion === "" || runMandatoryScan) {
960963
localStorage.setItem("manadatoryScan", "true");
964+
const smallMessage =
965+
"Even being a minor release, this new version of Task Board requires a re-scan of your vault. Kindly re-scan using the top-right button in the task board tab.";
966+
new Notice(smallMessage, 0);
961967
}
962968

963969
this.settings.version = currentVersion;

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"id": "task-board",
33
"name": "Task Board",
4-
"version": "1.8.2",
4+
"version": "1.8.3",
55
"minAppVersion": "1.4.13",
66
"description": "Manage all your tasks throughout your vault from a single board and much more...",
77
"author": "Atmanand Gauns",

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "task-board",
3-
"version": "1.8.2",
3+
"version": "1.8.3",
44
"description": "An Obsidian plugin to manage small to large projects using tasks from the whole vault on a centralized board using various kinds of views like Kanban, map, list, etc.",
55
"main": "main.js",
66
"type": "module",

src/components/AddOrEditTaskRC.tsx

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// React component for adding or editing tasks, usable in both modals and views
33

44
import { Component, Keymap, Platform, TFile, UserEvent, debounce, normalizePath } from "obsidian";
5-
import { FaTimes } from 'react-icons/fa';
5+
import { FaTimes, FaTrash } from 'react-icons/fa';
66
import React, { useEffect, useRef, useState } from "react";
77
import { cursorLocation, taskItem } from "src/interfaces/TaskItem";
88

@@ -243,7 +243,11 @@ export const AddOrEditTaskRC: React.FC<{
243243
// Automatically update end time if only start time is provided
244244
const handleCompleteTimeChange = (updatedStartTime: string, updatedEndTime: string) => {
245245
let newTime = '';
246-
if (updatedStartTime && !updatedEndTime) {
246+
if (!updatedStartTime) {
247+
setStartTime("");
248+
setEndTime("");
249+
setNewTime("");
250+
} else if (updatedStartTime && !updatedEndTime) {
247251
const [hours, minutes] = updatedStartTime.split(':');
248252
const newEndTime = `${String(Number(hours) + 1).padStart(2, '0')}:${minutes}`;
249253
setEndTime(newEndTime);
@@ -527,7 +531,10 @@ export const AddOrEditTaskRC: React.FC<{
527531
// ------------------ Tab Switching and other components ------------------
528532

529533
const [activeTab, setActiveTab] = useState<'liveEditor' | 'rawEditor'>('liveEditor');
530-
const handleTabSwitch = (tab: 'liveEditor' | 'rawEditor') => setActiveTab(tab);
534+
const handleTabSwitch = (tab: 'liveEditor' | 'rawEditor') => {
535+
setActiveTab(tab);
536+
// setIsEditorContentChanged(true);
537+
};
531538

532539
const filePathRef = useRef<HTMLInputElement>(null);
533540
const communityPlugins = new CommunityPlugins(plugin);
@@ -567,7 +574,7 @@ export const AddOrEditTaskRC: React.FC<{
567574

568575
plugin.realTimeScanning.processAllUpdatedFiles(filePath).then(() => {
569576
onClose();
570-
sleep(2000).then(() => {
577+
sleep(1000).then(() => {
571578
eventEmitter.emit("SWITCH_VIEW", 'map');
572579
});
573580
});
@@ -908,14 +915,14 @@ export const AddOrEditTaskRC: React.FC<{
908915
}
909916
applyIdToTaskInNote(plugin, selectedTask).then((newId) => {
910917
const getUpdatedDependsOnIds = (prev: string[]) => {
911-
if (!prev.includes(task.legacyId ? task.legacyId : String(task.id))) {
918+
if (!prev.includes(task.legacyId ? task.legacyId : task.id)) {
912919
if (newId === undefined && !selectedTask?.legacyId) {
913920
bugReporter(plugin, "Both newId and legacyId are undefined", `Both newId and legacyId are undefined for the selected task titled ${selectedTask.title}.`, "AddOrEditTaskModal.tsx/EditTaskContent/childTaskInputRef useEffect/getUpdatedDependsOnIds");
914921
return [...prev, String(plugin.settings.data.globalSettings.uniqueIdCounter)];
915922
} else if (newId === undefined) {
916923
return [...prev, selectedTask.legacyId];
917924
} else if (newId) {
918-
return [...prev, String(newId)];
925+
return [...prev, newId];
919926
}
920927
}
921928
return prev;
@@ -968,7 +975,7 @@ export const AddOrEditTaskRC: React.FC<{
968975
// Render child task titles when childTasks changes
969976
useEffect(() => {
970977
childTasks.forEach((childTask, index) => {
971-
const element = childTaskTitleRefs.current[childTask.legacyId ? childTask.legacyId : String(childTask.id)];
978+
const element = childTaskTitleRefs.current[childTask.legacyId ? childTask.legacyId : childTask.id];
972979
if (!element) return;
973980

974981
// Clear previous content before rendering
@@ -988,7 +995,7 @@ export const AddOrEditTaskRC: React.FC<{
988995

989996
const handleOpenChildTaskModal = async (event: React.MouseEvent, taskId: string) => {
990997
event.stopPropagation();
991-
const childTask = childTasks.find(t => String(t.legacyId) === taskId);
998+
const childTask = childTasks.find(t => t.legacyId === taskId);
992999
if (!childTask) {
9931000
bugReporter(plugin, "Child task not found", `The child task with ID ${taskId} was not found in pending tasks.`, "AddOrEditTaskModal.tsx/EditTaskContent/handleOpenChildTaskModal");
9941001
return;
@@ -1157,9 +1164,6 @@ export const AddOrEditTaskRC: React.FC<{
11571164
className="EditTaskModalBodyDescription"
11581165
value={formattedTaskContent}
11591166
onChange={handleTextareaChange}
1160-
onBlur={() => {
1161-
setIsEditorContentChanged(true);
1162-
}}
11631167
placeholder={t("body-content")}
11641168
style={{ display: activeTab === 'rawEditor' ? 'block' : 'none', width: '100%' }}
11651169
/>
@@ -1228,7 +1232,10 @@ export const AddOrEditTaskRC: React.FC<{
12281232

12291233
{/* Task Time Input */}
12301234
<div className="EditTaskModalHomeField">
1231-
<label className="EditTaskModalHomeFieldTitle">{t("start-time")}</label>
1235+
<div className="EditTaskModalHomeFieldTitleContainer">
1236+
<label className="EditTaskModalHomeFieldTitle">{t("start-time")}</label>
1237+
<FaTrash onClick={() => handleCompleteTimeChange("", "")} size={12} />
1238+
</div>
12321239
<input className="EditTaskModalHomeTimeInput" type="time" value={startTime} onChange={(e) => handleStartTimeChange(e.target.value)} />
12331240
</div>
12341241
<div className="EditTaskModalHomeField">

src/components/BoardFilters/FilterConfigModal.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export class FilterConfigModal extends Modal {
110110
text: t("no-saved-filter-configurations"),
111111
});
112112
new Setting(contentEl).addButton((btn) => {
113-
btn.setButtonText(t("Close")).onClick(() => {
113+
btn.setButtonText(t("close")).onClick(() => {
114114
this.close();
115115
});
116116
});

src/components/KanbanView/Column.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,13 +325,12 @@ const Column: React.FC<ColumnProps> = ({
325325
</div>
326326
<div className={`tasksContainer${plugin.settings.data.globalSettings.showVerticalScroll ? '' : '-SH'}`}>
327327
{tasks.length > 0 ? (
328-
tasks.map((task, index = task.id) => {
328+
tasks.map((task, index) => {
329329
return (
330330
<div key={index} className="taskItemFadeIn">
331331
<TaskItem
332332
key={index}
333333
plugin={plugin}
334-
taskKey={index}
335334
task={task}
336335
columnIndex={columnIndex}
337336
activeBoardSettings={activeBoardData}

src/components/KanbanView/LazyColumn.tsx

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const LazyColumn: React.FC<LazyColumnProps> = ({
3636
columnData,
3737
tasksForThisColumn,
3838
}) => {
39-
if (activeBoardData?.hideEmptyColumns && (tasksForThisColumn === undefined || tasksForThisColumn.length === 0)) {
39+
if (activeBoardData?.hideEmptyColumns && (tasksForThisColumn === undefined || tasksForThisColumn?.length === 0)) {
4040
return null; // Don't render the column if it has no tasks and empty columns are hidden
4141
}
4242

@@ -54,7 +54,9 @@ const LazyColumn: React.FC<LazyColumnProps> = ({
5454
const allTasks = useMemo(() => tasksForThisColumn, [tasksForThisColumn]);
5555
// Memoize visible tasks based on count
5656
const visibleTasks = useMemo(() => {
57-
return allTasks.slice(0, visibleTaskCount);
57+
if (allTasks && allTasks?.length < 1) return [];
58+
59+
return allTasks?.slice(0, visibleTaskCount) ?? [];
5860
}, [allTasks, visibleTaskCount]);
5961

6062
// Reset visible count when tasks change (e.g., switching boards or filtering)
@@ -71,13 +73,13 @@ const LazyColumn: React.FC<LazyColumnProps> = ({
7173
const scrollPercentage = ((scrollTop + clientHeight) / scrollHeight) * 100;
7274

7375
// Load more tasks when scroll threshold is reached and there are more tasks to load
74-
if (scrollPercentage >= scrollThresholdPercent && visibleTaskCount < allTasks.length) {
76+
if (scrollPercentage >= scrollThresholdPercent && visibleTaskCount < allTasks?.length) {
7577
setVisibleTaskCount((prevCount) => {
76-
const newCount = Math.min(prevCount + loadMoreCount, allTasks.length);
78+
const newCount = Math.min(prevCount + loadMoreCount, allTasks?.length);
7779
return newCount;
7880
});
7981
}
80-
}, [scrollThresholdPercent, visibleTaskCount, allTasks.length, loadMoreCount]);
82+
}, [scrollThresholdPercent, visibleTaskCount, allTasks?.length, loadMoreCount]);
8183

8284
// Attach scroll listener
8385
useEffect(() => {
@@ -304,7 +306,7 @@ const LazyColumn: React.FC<LazyColumnProps> = ({
304306
// Minimized view
305307
<div className="taskBoardColumnMinimized">
306308
<div className='taskBoardColumnSecHeaderTitleSecColumnCount' onClick={(evt) => openColumnMenu(evt)} aria-label={t("open-column-menu")}>
307-
{allTasks.length}
309+
{allTasks?.length ?? 0}
308310
</div>
309311
<div className="taskBoardColumnMinimizedTitle" onClick={async () => {
310312
await handleMinimizeColumn();
@@ -319,32 +321,31 @@ const LazyColumn: React.FC<LazyColumnProps> = ({
319321
<div className="taskBoardColumnSecHeaderTitleSecColumnTitle">{columnData.name}</div>
320322
</div>
321323
<div className='taskBoardColumnSecHeaderTitleSecColumnCount' onClick={(evt) => openColumnMenu(evt)} aria-label={t("open-column-menu")}>
322-
{allTasks.length}
324+
{allTasks?.length ?? 0}
323325
</div>
324326
</div>
325327
<div
326328
className={`tasksContainer${plugin.settings.data.globalSettings.showVerticalScroll ? '' : '-SH'}`}
327329
ref={tasksContainerRef}
328330
>
329-
{visibleTasks.length > 0 ? (
331+
{(visibleTasks && visibleTasks?.length > 0) ? (
330332
<>
331-
{visibleTasks.map((task, index = task.id) => {
333+
{visibleTasks.map((task, index) => {
332334
return (
333335
<div key={index} className="taskItemFadeIn">
334336
<TaskItem
335337
key={index}
336338
plugin={plugin}
337-
taskKey={index}
338339
task={task}
339340
columnIndex={columnIndex}
340341
activeBoardSettings={activeBoardData}
341342
/>
342343
</div>
343344
);
344345
})}
345-
{visibleTaskCount < allTasks.length && (
346+
{(allTasks && visibleTaskCount < allTasks?.length) && (
346347
<div className="lazyLoadIndicator">
347-
<p>{t("scroll-to-load-more")} ({visibleTaskCount} / {allTasks.length})</p>
348+
<p>{t("scroll-to-load-more")} ({visibleTaskCount} / {allTasks?.length ?? 0})</p>
348349
</div>
349350
)}
350351
</>

0 commit comments

Comments
 (0)