✨ (pagetop): Oculta enlaces sin acceso con Endpoint

Las rutas se declaran con su acceso en un enum que implementa Endpoint y
se montan con `routes.endpoint()`. Convertidas en Route, `nav::Item`,
`dropdown::Item` y `Button::anchor()` no se muestran a quien no cumple
el acceso, sin repetir el permiso. `to()` rellena el parámetro de la
ruta.
This commit is contained in:
Manuel Cillero 2026-11-08 08:56:57 +01:00
parent 87711e4a37
commit e2e2ccb31e
13 changed files with 677 additions and 10 deletions

View file

@ -78,6 +78,10 @@ impl Component for Button {
self.props.get_id()
}
fn is_renderable(&self, cx: &Context) -> bool {
self.href().is_accessible(cx)
}
fn setup(&mut self, cx: &mut Context) {
use button::{Size, Style};
@ -182,6 +186,8 @@ impl Button {
/// [`with_style()`](Self::with_style)), por lo que el tema activo puede mostrarlo igual que
/// cualquier otra variante de `Button`. No confundir con [`button::Style::Link`], que es sólo
/// un estilo visual sobre un `<button>`.
///
/// No se renderiza si el usuario actual no puede acceder a la ruta (ver [`Endpoint`]).
pub fn anchor(label: Lc, route: impl Into<Route>) -> Self {
Self {
label,