Skip to content

Label, divider and banner widgets #3425

Todo

Description

@rubenvdlinde

Is your feature request related to a problem? Please describe.

  • Pages need simple structure beyond a header and free text. These three come up on almost every page we built in the prototype.
Why this is needed

Describe the solution you'd like

  • Three static widget types for grid pages: a label (short text with an optional icon), a divider (a horizontal line between sections) and a banner (a coloured block with a title, text and an optional link). Each declares its settings as a server schema, like the existing header and text widgets.
Diagram
flowchart LR
    E[edit the page] --> A[add widget]
    A --> T["types from GET api/2/widget-types"]
    T --> C{label, divider or banner}
    C --> F[form built from the settings schema]
    F --> S["save: PATCH api/2/contexts/{id}/pages/{pageId}"]
    S --> V[page shows the widget in theme colours]
Loading
Acceptance Criteria
  • Each type is listed by GET /api/2/widget-types with its settings schema.
  • The widget editor builds its form from that schema, with no type-specific form code.
  • Colours come from the theme variables, no fixed colours.
  • Export and import of an application carry the widgets.
  • Unit tests for the schemas, a Playwright spec that adds each widget to a page.
  • Settings are stored as JSON text in the settings text column of tables_contexts_widget (at most 60000 bytes, GridWidgetTypes::SETTINGS_MAX_BYTES), not in a database JSON column, as advised on Grid pages in applications (frontend) #3099. Nothing is filtered or sorted on them.
  • Widgets are saved through the page route PATCH api/2/contexts/{contextId}/pages/{pageId}, which declares #[RequirePermission] for managing the application, and the service checks the same right before it writes. A test saves a page with the new widget as a reader of the application and expects 403, as learned in the review of feat(contexts): give applications a menu with its own API #3135.
  • The banner uses NcNoteCard (with the neutral type and actions slot of feat(NcNoteCard): add a neutral type and an actions slot nextcloud-libraries/nextcloud-vue#9155). A label or banner does not repeat the widget's own title (jancborchardt on Grid pages in applications (frontend) #3099).
  • Usable at 360 px wide: nothing cut off and no horizontal scroll of the page. Every action works with the keyboard alone.
Components
Out of scope

Describe alternatives you've considered

Questions for maintainers

  1. Banner colours? Options: (a) the types of NcNoteCard (info, success, warning, error and neutral from feat(NcNoteCard): add a neutral type and an actions slot nextcloud-libraries/nextcloud-vue#9155), (b) a free colour from the theme. We would go with (a): it reuses existing words and colours and stays readable in dark mode.
  2. Label as its own type, or a smaller variant of the header? Options: (a) its own type, (b) a size setting on the header. We would go with (a): a buildiq manifest maps one to one on import (Import an application from another builder's manifest #3459).
  3. Which word for the page an application opens on? jancborchardt asked on Grid pages in applications (frontend) #3099 for a word Nextcloud already uses. Options: (a) "Home", as in Talk, (b) "Dashboard", (c) keep "Start page". We would go with (a) "Home": Jan named Talk as the example, and "Dashboard" is already the Nextcloud Dashboard app, so two dashboards would confuse. The slug in the code can stay dashboard (Page::START_PAGE_SLUG).

Additional context

Linking to other objects
Relevant files:
Related issues

Drafted with AI assistance from the project plan; @remko48 reviews it. Part of #3419.

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

Metadata

Metadata

Assignees

Labels

enhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions