show_alerts_in_menu == '1') `
* so nothing about this component runs when the operator turned the
* bell off.
*/
#[Lazy]
class AlertMenu extends Component
{
public function placeholder(): string
{
// Reserve the same visual footprint as the loaded bell so the
// top-nav doesn't shift when the real component swaps in. The
// hidden label reserves badge width so hydration with alerts
// does not push the surrounding nav items sideways. Kept in
// sync with the same-shape hidden-label in the loaded view
// (livewire/alert-menu.blade.php) so the "no alerts" state also
// preserves the reserved width.
// Match the loaded view's markup exactly — same icon, same
// sr-only span position, same label markup with no surrounding
// whitespace. Any inline-element width difference between the
// placeholder and the loaded state translates directly into a
// top-nav layout shift on hydration.
$srOnly = trans('general.alerts');
return <<
{$srOnly}
0
HTML;
}
public function render(): View
{
$alert_items = Helper::checkLowInventory();
$deprecations = Helper::deprecationCheck();
return view('livewire.alert-menu', [
'alert_items' => $alert_items,
'deprecations' => $deprecations,
'alert_count' => count($alert_items) + count($deprecations),
]);
}
}