Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add time in note title #317

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

jartigag
Copy link

@jartigag jartigag commented Mar 20, 2023

Hi!

In first place, thank you for your plugin. It's really useful for me!

In second place, it's my first contribution in Typescript so sorry for my lack of knowledge.

I would like to enable a new setting needed to create an event with the same event title in the same day.
It would be just a boolean setting that says "Format note title as <YYYY-MM-DD> <HHDD> <Event title>.md"

import { EditableCalendar, EditableEventResponse } from "./EditableCalendar";

const basenameFromEvent = (event: OFCEvent): string => {
switch (event.type) {
case undefined:
case "single":
if (isRangeTimeData(event)) {
Copy link
Author

@jartigag jartigag Mar 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would use something like

if (this.plugin.settings.timeInNoteTitle && isRangeTimeData(event)) {

But this.plugin.settings is not valid from here and I don't know how to access to that value in this place.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@davish I need help with this part. How would you check that setting from the FullNoteCalendar class?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can pass the boolean timeInNoteTitle as an argument to the FullNoteCalendar constructor. When the calendar is registered in main.ts. I don't think there's a way right now to get access to "global" settings, but you could make it a per-calendar setting that lives as part of the CalendarInfo type for local calendars.

@davish
Copy link
Collaborator

davish commented Mar 20, 2023

Thanks for contributing @jartigag! It seems like this PR is still a work in progress, so I'm converting it to a draft for now. Feel free to mark it as ready for review whenever.

@davish davish marked this pull request as draft March 20, 2023 21:36
@jartigag jartigag marked this pull request as ready for review April 9, 2023 22:57
@jartigag
Copy link
Author

jartigag commented Apr 9, 2023

Hi again, @davish! I made it work, but one thing isn't ready yet: the property "timeInNoteTitle" isn't written in data.json... I have to write it manually like this:

{
  "calendarSources": [
    {
      "type": "local",
      "color": "hsl( 254,  80%, calc( 68% - 3.8%))",
      "directory": "/",
      "timeInNoteTitle": true
    }
  ]
...

What is it missing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants