MCPcopy
hub / github.com/callumalpass/tasknotes / renderTaskCardMetadata

Function renderTaskCardMetadata

src/ui/taskCardMetadata.ts:156–213  ·  view source on GitHub ↗
(config: RenderTaskCardMetadataConfig)

Source from the content-addressed store, hash-verified

154}
155
156export function renderTaskCardMetadata(config: RenderTaskCardMetadataConfig): HTMLElement[] {
157 const { metadataLine, task, plugin, visibleProperties, propertyOptions = {} } = config;
158 metadataLine.empty();
159 const metadataElements: HTMLElement[] = [];
160 const propertiesToShow = getPropertiesToShow(visibleProperties, plugin);
161
162 const occurrencePill = createOccurrenceMetadataPill(config);
163 if (occurrencePill) {
164 metadataElements.push(occurrencePill);
165 }
166
167 for (const propertyId of propertiesToShow) {
168 if (
169 isPropertyForField(propertyId, "status", plugin) ||
170 isPropertyForField(propertyId, "priority", plugin)
171 ) {
172 continue;
173 }
174
175 if (propertyId === "blocked") {
176 const blockedPill = createBlockedMetadataPill(config);
177 if (blockedPill) {
178 metadataElements.push(blockedPill);
179 }
180 continue;
181 }
182
183 if (propertyId === "blocking") {
184 const blockingPill = createBlockingMetadataPill(config);
185 if (blockingPill) {
186 metadataElements.push(blockingPill);
187 }
188 continue;
189 }
190
191 if (propertyId === "googleCalendarSync") {
192 const syncPill = createGoogleCalendarSyncPill(config);
193 if (syncPill) {
194 metadataElements.push(syncPill);
195 }
196 continue;
197 }
198
199 const propertyElement = renderPropertyMetadata(
200 metadataLine,
201 propertyId,
202 task,
203 plugin,
204 propertyOptions
205 );
206 if (propertyElement) {
207 metadataElements.push(propertyElement);
208 }
209 }
210
211 updateMetadataVisibility(metadataLine, metadataElements);
212 return metadataElements;
213}

Callers 2

Calls 8

isPropertyForFieldFunction · 0.90
renderPropertyMetadataFunction · 0.90
updateMetadataVisibilityFunction · 0.90
getPropertiesToShowFunction · 0.85

Tested by

no test coverage detected