Skip to content

Commit

Permalink
update README, switch to menu, bux fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Joshua Tazman Reinier committed Aug 6, 2023
1 parent b0c0a06 commit 53dffcc
Show file tree
Hide file tree
Showing 14 changed files with 332 additions and 221 deletions.
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

## In progress
- Add support for [Full Calendar full notes](https://github.com/joshuatazrein/obsidian-time-ruler/issues/10#issuecomment-1655804209)
- Add formatting for [Obsidian Reminder](https://github.com/joshuatazrein/obsidian-time-ruler/issues/20)

## Planned
- Option to [hide/show headings](https://github.com/joshuatazrein/obsidian-time-ruler/issues/11#issuecomment-1655862428) to reduce visual clutter
Expand All @@ -18,7 +17,12 @@

# Changelog

## 1.0.5 (Upcoming)
## 1.0.6 (Upcoming)
- **Improved:** Moved search, refresh, and view buttons to a collapsible menu

## 1.0.5 (8/6/2023)
- **Added:** Support for [Obsidian Reminder](https://github.com/joshuatazrein/obsidian-time-ruler/issues/20)
- **Improved:** Time Ruler now auto-detects field formats (Dataview, Tasks, and Full Calendar) and will format changed tasks appropriately. When auto-detecting is impossible, defaults to selected setting.
- **Improved:** Timer focus mode
- **Fixed:** Error with drag `id`s for all-day headings
- **Fixed:** Scheduled tasks with deadlines disappearing
Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@ When editing a task via drag-and-drop, tasks are converted to the user's preferr

![refresh](assets/buttons.png)

- Click the **search** (magnifying glass) button to show all tasks and headings and filter them.
- Click the **calendar** button to toggle between all-day and hourly views.
- Click the **refresh** (circlular arrow) button to refresh Obsidian tasks and online calendars.
- **Search**: Show all tasks and headings. Filter by tag, priority, filepath, or heading.
- **Daily / Hourly view**: Toggle between daily and hourly views. In daily view, hours are hidden.
- **Refresh**: Reload Obsidian tasks and online calendars.
- **Unscheduled:** Drag a task here to unschedule it. Click to show unscheduled tasks.
- **Days:** Click to scroll to that date, drag a task on top to schedule it for that date.

## Obsidian integrations
- **Click** on tasks and headings to show them in Obsidian (Time Ruler will update while you edit them)
Expand Down
Binary file modified assets/buttons.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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": "1.0.4",
"version": "1.0.5",
"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
91 changes: 55 additions & 36 deletions src/components/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import { Platform } from 'obsidian'
import { getDailyNoteInfo } from '../services/obsidianApi'
import Heading from './Heading'
import Group from './Group'
import Logo from './Logo'

/**
* @param apis: We need to store these APIs within the store in order to hold their references to call from the store itself, which is why we do things like this.
Expand Down Expand Up @@ -180,7 +181,6 @@ export default function App({ apis }: { apis: Required<AppState['apis']> }) {

const getDragElement = () => {
if (!activeDrag) return <></>
console.log(activeDrag)

switch (activeDrag.dragType) {
case 'task':
Expand Down Expand Up @@ -284,6 +284,7 @@ export default function App({ apis }: { apis: Required<AppState['apis']> }) {
}}
>
<DragOverlay dropAnimation={null}>{getDragElement()}</DragOverlay>
<Search />
<Buttons {...{ times, datesShown, setDatesShown, datesShownState }} />
<Timer />
<div
Expand Down Expand Up @@ -319,6 +320,7 @@ const Buttons = ({ times, datesShown, datesShownState, setDatesShown }) => {

const nextButton = (
<Button
className={`${calendarMode ? '!w-full' : ''}`}
onClick={() => setDatesShown(datesShownState + 7)}
src={'chevron-right'}
/>
Expand All @@ -334,7 +336,7 @@ const Buttons = ({ times, datesShown, datesShownState, setDatesShown }) => {
const unscheduledButton = (
<Droppable id={'unscheduled::button'} data={{ scheduled: '' }}>
<Button
className={`h-[28px] ${calendarMode ? '!w-full flex-none' : ''}`}
className={`h-[28px]`}
onClick={() => {
setters.set({ searchStatus: 'unscheduled' })
}}
Expand All @@ -347,39 +349,56 @@ const Buttons = ({ times, datesShown, datesShownState, setDatesShown }) => {
return (
<>
<div className={`flex w-full items-center space-x-1`}>
<div
className={`space-2 flex-none ${
calendarMode
? 'grid grid-cols-2'
: 'flex items-center justify-center'
}`}
>
<Search />

<Button
title='reload'
onClick={async () => {
getters.getCalendarAPI().loadEvents()
const obsidianAPI = getters.getObsidianAPI()
setters.set({
...(await getDailyNoteInfo()),
})
obsidianAPI.loadTasks()
}}
src={'rotate-cw'}
/>

<Button
title='toggle day view'
onClick={() => {
setters.set({
calendarMode: !calendarMode,
})
}}
src={calendarMode ? 'calendar-days' : 'calendar'}
></Button>
{calendarMode && nextButton}
<div className='text-left'>
<div className='group relative'>
<Button src='more-horizontal' />
<div className='absolute left-0 top-full z-50 hidden max-w-[80vw] p-2 group-hover:block'>
<div className='rounded-lg border border-solid border-faint bg-primary p-2'>
<div
className='clickable-icon flex items-center !justify-start space-x-2'
onClick={() => {
setters.set({ searchStatus: 'all' })
}}
>
<Logo src={'search'} className='w-6 flex-none' />
<span className='whitespace-nowrap'>Search</span>
</div>
<div
className='clickable-icon flex items-center !justify-start space-x-2'
onClick={async () => {
getters.getCalendarAPI().loadEvents()
const obsidianAPI = getters.getObsidianAPI()
setters.set({
...(await getDailyNoteInfo()),
})
obsidianAPI.loadTasks()
}}
>
<Logo src={'rotate-cw'} className='w-6 flex-none' />
<span className='whitespace-nowrap'>Reload</span>
</div>
<div
className='clickable-icon flex items-center !justify-start space-x-2'
onClick={() => {
setters.set({
calendarMode: !calendarMode,
})
}}
>
<Logo
src={calendarMode ? 'calendar-days' : 'calendar'}
className='w-6 flex-none'
/>
<span className='whitespace-nowrap'>{`${
calendarMode ? 'Hourly' : 'Daily'
} view`}</span>
</div>
</div>
</div>
</div>
{calendarMode && unscheduledButton}
</div>

<div
className={`no-scrollbar flex w-full snap-mandatory rounded-icon pb-0.5 child:snap-start ${
calendarMode
Expand All @@ -389,7 +408,7 @@ const Buttons = ({ times, datesShown, datesShownState, setDatesShown }) => {
data-auto-scroll={calendarMode ? 'y' : 'x'}
>
{calendarMode && dayPadding()}
{unscheduledButton}
{!calendarMode && unscheduledButton}
{times.map((times, i) => {
const thisDate = DateTime.fromISO(times.startISO)
return (
Expand All @@ -415,7 +434,7 @@ const Buttons = ({ times, datesShown, datesShownState, setDatesShown }) => {
)
})}

{!calendarMode && nextButton}
{nextButton}
</div>
</div>
</>
Expand Down
6 changes: 3 additions & 3 deletions src/components/Heading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ export default function Heading({
if (thisPath.includes('/'))
thisPath = thisPath.slice(0, thisPath.lastIndexOf('/'))
const matchesPath = thisPath === dailyNotePath

if (!matchesPath) return false
const fileName = (
thisPath.includes('/')
? thisPath.slice(thisPath.lastIndexOf('/') + 1)
: thisPath
path.includes('/') ? path.slice(path.lastIndexOf('/') + 1) : path
).replace('.md', '')

const date = moment(fileName, dailyNoteFormat)
if (!date.isValid()) return false
return `Daily: ${DateTime.fromJSDate(date.toDate()).toFormat('ccc, LLL d')}`
Expand Down
Loading

0 comments on commit 53dffcc

Please sign in to comment.