Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

POC: Minimal example of actions API #1396

Closed
wants to merge 3 commits into from
Closed

Conversation

susnux
Copy link
Contributor

@susnux susnux commented Nov 8, 2023

This is a minimal example how an API could look like to register actions for the Activity sidebar.
For example it could be used to register the comment input action on the activity tab.

See code or this example how the usage would look like:

/**
 * Dummy example of how to add a sidebar action
 */
window.OCA.Activity.registerSidebarAction({
	mount: (el) => {
		// eslint-disable-next-line no-console
		console.log('Register example plugin')
		const label = document.createElement('label')
		label.innerText = 'Write a comment'
		label.appendChild(document.createElement('input'))
		label.appendChild(document.createElement('hr'))
		label.style.display = 'flex'
		label.style.flexDirection = 'column'
		el.appendChild(label)
	},
	// eslint-disable-next-line no-console
	unmount: () => console.log('unregister example plugin'),
})

window.OCA.Activity.registerAction('comments', {
	label: 'Delete comment',
	handler: (activity) => console.log(activity),
})

This example looks bad, because no styling is done but it works:
image

Of cause you could simply mount the comment app's input component, no big adjustments needed.

src/sidebar.js Outdated Show resolved Hide resolved
@susnux susnux force-pushed the poc/minimal-api-for-actions branch 4 times, most recently from 1c52563 to db475ac Compare November 14, 2023 12:48
This is intended for the comments app to register the "write comment" action.

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
@susnux
Copy link
Contributor Author

susnux commented Nov 15, 2023

See nextcloud/server#41483 for comments part

@susnux
Copy link
Contributor Author

susnux commented Nov 15, 2023

Closed in favor of #1416

@susnux susnux closed this Nov 15, 2023
@susnux susnux deleted the poc/minimal-api-for-actions branch November 15, 2023 12:52
Copy link
Contributor

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process.

Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6

Thank you for contributing to Nextcloud and we hope to hear from you soon!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant