(config: RenderTaskCardMetadataConfig)
| 122 | } |
| 123 | |
| 124 | function createOccurrenceMetadataPill(config: RenderTaskCardMetadataConfig): HTMLElement | null { |
| 125 | const { metadataLine, task, plugin } = config; |
| 126 | if (!task.recurrence_parent || !task.occurrence_date) { |
| 127 | return null; |
| 128 | } |
| 129 | |
| 130 | const dateLabel = formatDateTimeForDisplay(task.occurrence_date, { |
| 131 | dateFormat: "MMM d", |
| 132 | showTime: false, |
| 133 | userTimeFormat: plugin.settings.calendarViewSettings?.timeFormat, |
| 134 | }); |
| 135 | const pill = metadataLine.createSpan({ |
| 136 | cls: "task-card__metadata-pill task-card__metadata-pill--occurrence", |
| 137 | }); |
| 138 | setIcon(pill, "refresh-ccw"); |
| 139 | pill.createSpan({ text: `Occurrence: ${dateLabel}` }); |
| 140 | prepareInteractiveControl(pill); |
| 141 | pill.setAttribute( |
| 142 | "aria-label", |
| 143 | `Open recurring parent for occurrence on ${task.occurrence_date}` |
| 144 | ); |
| 145 | setTooltip(pill, `Occurrence of ${task.recurrence_parent} on ${task.occurrence_date}`, { |
| 146 | placement: "top", |
| 147 | }); |
| 148 | pill.addEventListener("click", (event) => { |
| 149 | event.stopPropagation(); |
| 150 | const parentPath = parseLinkToPath(task.recurrence_parent || ""); |
| 151 | void plugin.app.workspace.openLinkText(parentPath, task.path, false); |
| 152 | }); |
| 153 | return pill; |
| 154 | } |
| 155 | |
| 156 | export function renderTaskCardMetadata(config: RenderTaskCardMetadataConfig): HTMLElement[] { |
| 157 | const { metadataLine, task, plugin, visibleProperties, propertyOptions = {} } = config; |
no test coverage detected