Skip to content

Commit

Permalink
2.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Joshua Tazman Reinier committed Apr 1, 2024
1 parent ee516bb commit d5e7273
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 17 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,17 @@

# Changelog

## 2.3.0 (Upcoming)
## 2.3.0 (4/1/2023)
**Added:**
- Added move button (blue right arrow) to move tasks to different files
- Added option to hide unscheduled subtasks from Time Ruler, streamlining the display

**Changed:**
- Removed "Upcoming" section, due tasks now show with their path/priority group

**Fixed:**
- Fixed bug with [length](https://github.com/joshuatazrein/obsidian-time-ruler/issues/101) field, it is now called "duration" (although "length" is still recognized)
- Fixed bug with [links](https://github.com/joshuatazrein/obsidian-time-ruler/issues/107) being recognized as tags
- Reorder headings within "Hybrid" sort mode

## 2.2.0 (1/31/2023)
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ When editing a task via drag-and-drop, tasks are converted back to the formattin

- To **reschedule** a task, drag-and-drop the task onto the target block or time. You can drag a task to one of the day buttons or a day's heading to reschedule to that day. Click on a task to jump to it in Obsidian.
- To **create** a new scheduled task, drag the `+` button (top left) onto a time. For unscheduled, simply click the `+` button.
- To **move** a task to a different file or heading, drag it to the blue `->` button (top left).
- To change the **duration** of a task, drag its duration onto a time.
- To change the **deadline** of a task, drag its deadline onto a time.
- To **unschedule** a task, drag the task to the `Unscheduled` button.
Expand Down
2 changes: 1 addition & 1 deletion dist/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "time-ruler",
"name": "Time Ruler",
"version": "2.2.0",
"version": "2.3.0",
"minAppVersion": "0.15.0",
"description": "A drag-and-drop time ruler combining the best of a task list and a calendar view (integrates with Tasks, Full Calendar, and Dataview).",
"author": "Joshua Tazman Reinier",
Expand Down
12 changes: 4 additions & 8 deletions dist/styles.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "time-ruler",
"name": "Time Ruler",
"version": "2.2.0",
"version": "2.3.0",
"minAppVersion": "0.15.0",
"description": "A drag-and-drop time ruler combining the best of a task list and a calendar view (integrates with Tasks, Full Calendar, and Dataview).",
"author": "Joshua Tazman Reinier",
Expand Down
6 changes: 5 additions & 1 deletion src/components/Day.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,11 @@ export default function Day({

if (scheduledForToday) {
invariant(scheduled)
if (isDateISO(scheduled)) {
if (
isDateISO(scheduled) ||
scheduled < startDate ||
scheduled > endISO
) {
allDay.tasks.push(task)
} else {
if (blocksByTime[scheduled]) blocksByTime[scheduled].tasks.push(task)
Expand Down
5 changes: 2 additions & 3 deletions src/components/NewTask.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export default function NewTask({ dragContainer }: { dragContainer: string }) {
return _.uniq(
_.flatMap(state.tasks, (task) => {
if (task.completed) return []
if (task.page && newTaskMode === 'move') return []
return getHeading(task, dailyNoteInfo, 'path')
})
).sort()
Expand Down Expand Up @@ -196,16 +197,14 @@ function NewTaskHeading({
onMouseDown={async () => {
const api = getters.getObsidianAPI()
if (newTaskType === 'move') {
console.log('deleting task', newTask)

await api.moveTask(newTask as TaskProps, headingPath)
} else {
api.createNewTask(newTask, headingPath, dailyNoteInfo)
}
setTimeout(() => setters.set({ newTask: null }))
}}
className={`flex items-center w-full selectable cursor-pointer rounded-icon px-2 hover:underline ${
headingPath.includes('#') ? 'text-muted pl-4' : 'font-bold text-accent'
headingPath.includes('#') ? 'text-muted' : 'font-bold text-accent'
}`}
>
<div className='grow'>{title}</div>
Expand Down
9 changes: 8 additions & 1 deletion src/services/obsidianApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -367,9 +367,15 @@ export default class ObsidianAPI extends Component {
const fileText = await app.vault.read(file)
const lines = fileText.split('\n')

// tasks move their subtasks as well
let subtask = task
while (subtask.children.length > 0) {
subtask = getters.getTask(_.last(subtask.children)!)
}
const end = subtask.position.end.line
const copyLines = lines.splice(
task.position.start.line,
task.position.end.line + 1 - task.position.start.line
end + 1 - task.position.start.line
)

await app.vault.modify(file, lines.join('\n'))
Expand All @@ -382,6 +388,7 @@ export default class ObsidianAPI extends Component {
lines.splice(position.start.line, 0, ...copyLines)
return lines.join('\n')
})
openTask({ ...task, path: fileName, position })
}

createNewTask = (
Expand Down
4 changes: 3 additions & 1 deletion src/services/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,9 @@ export function pageToTask(

const parseScheduledAndLength = () => {
let scheduled: TaskProps['scheduled'] = testDateTime(item.scheduled)
let length: TaskProps['duration'] = testDuration(item.length)
let length: TaskProps['duration'] = testDuration(
item.length || item.duration
)
let isDate = false
let startHours: number | undefined = undefined,
startMinutes: number | undefined = undefined
Expand Down

0 comments on commit d5e7273

Please sign in to comment.