Skip to content

Inline project action buttons#694

Draft
ericholscher wants to merge 1 commit intomainfrom
project-actions-inline-config
Draft

Inline project action buttons#694
ericholscher wants to merge 1 commit intomainfrom
project-actions-inline-config

Conversation

@ericholscher
Copy link
Member

Summary:

  • Replace the single-item dropdown with a direct Configure button beside View documentation.
  • Add an admin-aware web component and tests.

Testing:

  • npm run build
  • npm test

Issues:

  • GitHub: none
  • Sentry: none

Copilot generated

@ericholscher
Copy link
Member Author

Example here:

Screenshot 2026-02-04 at 12 31 24 PM

Would love review on the concept rather than the code itself, since I haven't dived in there.

Comment on lines +350 to +395
export class ItemProjectAdminElement extends APIConsumerElement {
static properties = {
...APIConsumerElement.properties,
urlSettings: { type: String, attribute: "url-settings" },
};

handleClick(event) {
const isAdmin = this.data?.permissions?.admin;
if (this.disabled || isAdmin === false) {
event.preventDefault();
event.stopPropagation();
return;
}

this.queueEvent(event);
}

render() {
const isAdmin = this.data?.permissions?.admin;
const isDisabled = this.disabled || isAdmin === false;
const urlSettings = this.data?.urls?.settings || this.urlSettings || "#";
const label = this.label || msg(`Configure project`);

return html`
<a
class="ui button ${classMap({
disabled: isDisabled,
loading: !isDisabled && this.state === States.LOADING,
})}"
href=${urlSettings}
@click=${this.handleClick}
data-content="${label}"
aria-label="${label}"
aria-disabled="${isDisabled}"
tabindex=${isDisabled ? -1 : 0}
>
<i class="fa-duotone fa-wrench icon"></i>
</a>
`;
}
}
customElements.define(
"readthedocs-item-project-admin",
ItemProjectAdminElement,
);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason why you implemented this as a new class instead of reusing the existing class? Pretty sure this is the only view the menu item is used.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the code doesn't matter here since Eric was trying to show the idea only. He wrote:

Would love review on the concept rather than the code itself, since I haven't dived in there.

@agjohnson
Copy link
Contributor

For background here, this has a dropdown context menu because there have been other items in this list previously. The context menu is helpful for items that have bad icon matches and would only be confusing to users in icon form. In the context menu, the text is explicit. We don't use text buttons in the listing because it eats space, so context menu serves these two purposes.

If there are no other items to go in the context menu, it can be squashed. If we want other actions in the context menu, we should add them and keep the menu.

What does this look like when the user is not an admin?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants