|
8 | 8 | use OCA\Notes\Service\NotesService; |
9 | 9 | use OCP\Dashboard\IAPIWidget; |
10 | 10 | use OCP\Dashboard\IButtonWidget; |
| 11 | +use OCP\Dashboard\IIconWidget; |
11 | 12 | use OCP\Dashboard\IWidget; |
12 | 13 | use OCP\Dashboard\Model\WidgetButton; |
13 | 14 | use OCP\Dashboard\Model\WidgetItem; |
14 | 15 | use OCP\IL10N; |
15 | 16 | use OCP\IURLGenerator; |
16 | 17 |
|
17 | | -class DashboardWidget implements IWidget, IButtonWidget, IAPIWidget { |
| 18 | +class DashboardWidget implements IWidget, IButtonWidget, IAPIWidget, IIconWidget { |
18 | 19 | private IURLGenerator $url; |
19 | 20 | private IL10N $l10n; |
20 | 21 | private NotesService $notesService; |
@@ -91,8 +92,16 @@ public function getItems(string $userId, ?string $since = null, int $limit = 7): |
91 | 92 | } catch (\Throwable $e) { |
92 | 93 | } |
93 | 94 | $link = $this->url->linkToRouteAbsolute('notes.page.indexnote', ['id' => $note->getId()]); |
94 | | - $icon = $note->getFavorite() ? $this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/starred.svg')) : ''; |
| 95 | + $icon = $this->url->getAbsoluteURL( |
| 96 | + $note->getFavorite() |
| 97 | + ? $this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/starred.svg')) |
| 98 | + : $this->getIconUrl() |
| 99 | + ); |
95 | 100 | return new WidgetItem($note->getTitle(), $excerpt, $link, $icon, (string)$note->getModified()); |
96 | 101 | }, $notes); |
97 | 102 | } |
| 103 | + |
| 104 | + public function getIconUrl(): string { |
| 105 | + return $this->url->getAbsoluteURL($this->url->imagePath('notes', 'notes-dark.svg')); |
| 106 | + } |
98 | 107 | } |
0 commit comments