summaryrefslogtreecommitdiffstats
path: root/lib/Dashboard/OnThisDay.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Dashboard/OnThisDay.php')
-rw-r--r--lib/Dashboard/OnThisDay.php63
1 files changed, 63 insertions, 0 deletions
diff --git a/lib/Dashboard/OnThisDay.php b/lib/Dashboard/OnThisDay.php
new file mode 100644
index 00000000..187648b3
--- /dev/null
+++ b/lib/Dashboard/OnThisDay.php
@@ -0,0 +1,63 @@
+<?php
+
+namespace OCA\Photos\Dashboard;
+
+use OCA\Photos\AppInfo\Application;
+use OCP\AppFramework\Services\IInitialState;
+use OCP\Dashboard\IWidget;
+use OCP\IL10N;
+use OCP\IURLGenerator;
+use OCP\Util;
+
+class OnThisDay implements IWidget {
+ public function __construct(
+ private IL10N $l,
+ private IURLGenerator $url,
+ private IInitialState $initialState
+ ) {
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function getId(): string {
+ return 'photos.onthisday';
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function getTitle(): string {
+ return $this->l->t('On This Day');
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function getOrder(): int {
+ return 20;
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function getIconClass(): string {
+ return 'icon-calendar-dark';
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function getUrl(): ?string {
+ return $this->url->linkToRoute('photos.page.indexthisday');
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function load(): void {
+ Util::addScript('photos', 'photos-dashboard');
+ $this->initialState->provideInitialState('image-mimes', Application::IMAGE_MIMES);
+ $this->initialState->provideInitialState('video-mimes', Application::VIDEO_MIMES);
+ }
+}