diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index 787db6da2f3..fd1f1de995f 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -36,6 +36,7 @@ use OCA\Talk\Collaboration\Resources\Listener as ResourceListener; use OCA\Talk\Config; use OCA\Talk\Dashboard\TalkWidget; +use OCA\Talk\Dashboard\TalkWidget2; use OCA\Talk\Events\ChatEvent; use OCA\Talk\Events\RoomEvent; use OCA\Talk\Files\Listener as FilesListener; @@ -102,6 +103,7 @@ public function register(IRegistrationContext $context): void { $context->registerSearchProvider(MessageSearch::class); $context->registerDashboardWidget(TalkWidget::class); + $context->registerDashboardWidget(TalkWidget2::class); } public function boot(IBootContext $context): void { diff --git a/lib/Dashboard/TalkWidget2.php b/lib/Dashboard/TalkWidget2.php new file mode 100644 index 00000000000..82e9d867e8d --- /dev/null +++ b/lib/Dashboard/TalkWidget2.php @@ -0,0 +1,90 @@ + + * + * @author Julius Härtl + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ + +namespace OCA\Talk\Dashboard; + +use OCP\Dashboard\IWidget; +use OCP\IL10N; +use OCP\IURLGenerator; +use OCP\Util; + +class TalkWidget2 implements IWidget { + + /** @var IURLGenerator */ + private $url; + /** @var IL10N */ + private $l10n; + + public function __construct( + IURLGenerator $url, + IL10N $l10n + ) { + $this->url = $url; + $this->l10n = $l10n; + } + + /** + * @inheritDoc + */ + public function getId(): string { + return 'spreed'; + } + + /** + * @inheritDoc + */ + public function getTitle(): string { + return $this->l10n->t('Unread and favourites conversations'); + } + + /** + * @inheritDoc + */ + public function getOrder(): int { + return 10; + } + + /** + * @inheritDoc + */ + public function getIconClass(): string { + return 'icon-talk'; + } + + /** + * @inheritDoc + */ + public function getUrl(): ?string { + return $this->url->linkToRouteAbsolute('spreed.Page.index'); + } + + /** + * @inheritDoc + */ + public function load(): void { + Util::addStyle('spreed', 'icons'); + Util::addScript('spreed', 'dashboard'); + } +} diff --git a/src/dashboard.js b/src/dashboard.js index b516f8d26a2..5bf01e2a465 100644 --- a/src/dashboard.js +++ b/src/dashboard.js @@ -25,6 +25,7 @@ import { generateFilePath } from '@nextcloud/router' import { getRequestToken } from '@nextcloud/auth' import { translate, translatePlural } from '@nextcloud/l10n' import Dashboard from './views/Dashboard' +import Dashboard2 from './views/Dashboard2' // CSP config for webpack dynamic chunk loading // eslint-disable-next-line @@ -51,4 +52,11 @@ document.addEventListener('DOMContentLoaded', function() { }).$mount(el) }) + OCA.Dashboard2.register('spreed', (el) => { + const View = Vue.extend(Dashboard2) + new View({ + propsData: {}, + }).$mount(el) + }) + }) diff --git a/src/views/Dashboard2.vue b/src/views/Dashboard2.vue new file mode 100644 index 00000000000..649bf93dfd4 --- /dev/null +++ b/src/views/Dashboard2.vue @@ -0,0 +1,195 @@ + + + + + + +