diff --git a/core/src/components/ContactsMenu.js b/core/src/components/ContactsMenu.js index e07a699ab9f..92e992cb026 100644 --- a/core/src/components/ContactsMenu.js +++ b/core/src/components/ContactsMenu.js @@ -6,13 +6,16 @@ import Vue from 'vue' import ContactsMenu from '../views/ContactsMenu.vue' +import ContactsMenuService from '../services/ContactsMenuService.ts' /** * @todo move to contacts menu code https://github.com/orgs/nextcloud/projects/31#card-21213129 */ export const setUp = () => { const mountPoint = document.getElementById('contactsmenu') + if (mountPoint) { + window.OC.ContactsMenu = new ContactsMenuService() // eslint-disable-next-line no-new new Vue({ name: 'ContactsMenuRoot', diff --git a/core/src/services/ContactsMenuService.ts b/core/src/services/ContactsMenuService.ts new file mode 100644 index 00000000000..82ee8a7fcdd --- /dev/null +++ b/core/src/services/ContactsMenuService.ts @@ -0,0 +1,28 @@ +/** + * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +import type { IContactsMenuAction } from '../types/contactsMenuAction.ts' + +export default class ContactsMenuService { + + private _actions: IContactsMenuAction[] + + constructor() { + this._actions = [] + } + + get actions(): IContactsMenuAction[] { + return this._actions + } + + /* + * Register an action for the contacts menu + * Actions use NcButton + */ + addAction(action: IContactsMenuAction): void { + this._actions.push(action) + } + +} diff --git a/core/src/types/contactsMenuAction.d.ts b/core/src/types/contactsMenuAction.d.ts new file mode 100644 index 00000000000..179f0b6e879 --- /dev/null +++ b/core/src/types/contactsMenuAction.d.ts @@ -0,0 +1,11 @@ +/*! + * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +export interface IContactsMenuAction { + id: string + icon: string + label: string + onClick: () => void | Promise +} diff --git a/core/src/views/ContactsMenu.vue b/core/src/views/ContactsMenu.vue index 924ddcea56b..a6f73b6e4f3 100644 --- a/core/src/views/ContactsMenu.vue +++ b/core/src/views/ContactsMenu.vue @@ -12,18 +12,31 @@
-
- +
+
+ +
+ + +