title( __( 'Comments', 'desktop-mode' ) ) ->icon( 'dashicons-admin-comments' ) ->size( 1180, 760 ) ->min_size( 760, 480 ) // No dock or wallpaper tile from this registration: the Comments // dock tile lives in WordPress's `$menu`, and the shell's URL remap // routes its click here when the opt-in is on. ->placement( 'none' ) ->can( static function () { return \openstation_comments_window_user_can_register(); } ) // Static facts the view reads on every paint — shipped once with // the window config, never riding a response. Resolved when the // manifest is built, for the acting user. UI-side gating is // polish: every action re-checks the cap server-side. ->config( static function () { return array( 'currentUserId' => (int) get_current_user_id(), 'canModerate' => current_user_can( 'moderate_comments' ), 'canEditComments' => current_user_can( 'edit_posts' ), ); } ) ->state( array( 'tab' => 'pending', 'search' => '', 'page' => 1, // The `edit-comments.php?p=` scope; 0 is every post. 'post' => 0, // The conversation on screen; 0 is the placeholder. 'selected' => 0, // Bumped by every mutation that moves rows between views, so // the client's page accumulation starts clean from page 1. 'gen' => 0, ) ) ->mount( __NAMESPACE__ . '\mount' ) ->action( 'reopen', __NAMESPACE__ . '\reopen_action' ) ->action( 'filter', __NAMESPACE__ . '\filter_action' ) ->action( 'page', __NAMESPACE__ . '\page_action' ) ->action( 'select', __NAMESPACE__ . '\select_action' ) ->action( 'moderate', __NAMESPACE__ . '\moderate_action' ) ->action( 'reply', __NAMESPACE__ . '\reply_action' ) ->action( 'edit', __NAMESPACE__ . '\edit_action' ) // A comment changing anywhere on the desktop repaints the window. ->watch( 'comment' ) ->data( __NAMESPACE__ . '\data' );