(config: RenderTaskCardMetadataConfig)
| 154 | } |
| 155 | |
| 156 | export 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 | } |
no test coverage detected