From 28201bf2b55464845ef967e46e95366bc2c40ee4 Mon Sep 17 00:00:00 2001 From: Chad Little Date: Fri, 16 Sep 2016 14:56:58 -0700 Subject: [PATCH] New NUX states for Conpherence Summary: Roughly, if user isn't in any rooms, search for joinable ones. If no results, show big NUX banner. Test Plan: Left all rooms, got fallback, joined room, left room. Create new instance, see new NUX. Set instance to public, visit Conpherence with and without public rooms. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D16563 --- resources/celerity/map.php | 10 +-- .../controller/ConpherenceViewController.php | 2 +- .../view/ConpherenceLayoutView.php | 78 +++++++++++++------ .../rsrc/css/application/conpherence/menu.css | 21 ----- .../application/conpherence/message-pane.css | 16 +++- 5 files changed, 73 insertions(+), 54 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index b31e0d637b..ca33f2d429 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -7,7 +7,7 @@ */ return array( 'names' => array( - 'conpherence.pkg.css' => '1e8e5a40', + 'conpherence.pkg.css' => '80a3fcb3', 'conpherence.pkg.js' => '89b4837e', 'core.pkg.css' => '476e9330', 'core.pkg.js' => '1d376fa9', @@ -48,8 +48,8 @@ return array( 'rsrc/css/application/config/unhandled-exception.css' => '4c96257a', 'rsrc/css/application/conpherence/durable-column.css' => '194ac487', 'rsrc/css/application/conpherence/header-pane.css' => '517de9fe', - 'rsrc/css/application/conpherence/menu.css' => '8344d122', - 'rsrc/css/application/conpherence/message-pane.css' => 'c075e8fe', + 'rsrc/css/application/conpherence/menu.css' => '78c7b811', + 'rsrc/css/application/conpherence/message-pane.css' => '8d13ac4d', 'rsrc/css/application/conpherence/notification.css' => '6cdcc253', 'rsrc/css/application/conpherence/participant-pane.css' => '7bba0b56', 'rsrc/css/application/conpherence/transaction.css' => '46253e19', @@ -620,8 +620,8 @@ return array( 'config-page-css' => '8798e14f', 'conpherence-durable-column-view' => '194ac487', 'conpherence-header-pane-css' => '517de9fe', - 'conpherence-menu-css' => '8344d122', - 'conpherence-message-pane-css' => 'c075e8fe', + 'conpherence-menu-css' => '78c7b811', + 'conpherence-message-pane-css' => '8d13ac4d', 'conpherence-notification-css' => '6cdcc253', 'conpherence-participant-pane-css' => '7bba0b56', 'conpherence-thread-manager' => '01774ab2', diff --git a/src/applications/conpherence/controller/ConpherenceViewController.php b/src/applications/conpherence/controller/ConpherenceViewController.php index 7478ef08bc..e13d020626 100644 --- a/src/applications/conpherence/controller/ConpherenceViewController.php +++ b/src/applications/conpherence/controller/ConpherenceViewController.php @@ -154,7 +154,7 @@ final class ConpherenceViewController extends $button_text = pht('Send'); } else if ($user->isLoggedIn()) { $action = ConpherenceUpdateActions::JOIN_ROOM; - $button_text = pht('Join'); + $button_text = pht('Join Room'); } else { // user not logged in so give them a login button. $login_href = id(new PhutilURI('/auth/start/')) diff --git a/src/applications/conpherence/view/ConpherenceLayoutView.php b/src/applications/conpherence/view/ConpherenceLayoutView.php index 635280e35a..2b6ed5e0d2 100644 --- a/src/applications/conpherence/view/ConpherenceLayoutView.php +++ b/src/applications/conpherence/view/ConpherenceLayoutView.php @@ -72,6 +72,7 @@ final class ConpherenceLayoutView extends AphrontView { $selected_thread_id = null; $selected_thread_phid = null; $can_edit_selected = null; + $nux = null; if ($this->thread) { $selected_id = $this->thread->getPHID().'-nav-item'; $selected_thread_id = $this->thread->getID(); @@ -80,6 +81,8 @@ final class ConpherenceLayoutView extends AphrontView { $this->getUser(), $this->thread, PhabricatorPolicyCapability::CAN_EDIT); + } else { + $nux = $this->buildNUXView(); } $this->initBehavior('conpherence-menu', array( @@ -146,29 +149,7 @@ final class ConpherenceLayoutView extends AphrontView { 'sigil' => 'conpherence-no-threads', 'style' => 'display: none;', ), - array( - phutil_tag( - 'div', - array( - 'class' => 'text', - ), - pht('You are not in any rooms yet.')), - javelin_tag( - 'a', - array( - 'href' => '/conpherence/search/', - 'class' => 'button grey mlr', - ), - pht('Join a Room')), - javelin_tag( - 'a', - array( - 'href' => '/conpherence/new/', - 'class' => 'button grey', - 'sigil' => 'workflow', - ), - pht('Create a Room')), - )), + $nux), javelin_tag( 'div', array( @@ -224,4 +205,55 @@ final class ConpherenceLayoutView extends AphrontView { )); } + private function buildNUXView() { + $viewer = $this->getViewer(); + + $engine = new ConpherenceThreadSearchEngine(); + $engine->setViewer($viewer); + $saved = $engine->buildSavedQueryFromBuiltin('all'); + $query = $engine->buildQueryFromSavedQuery($saved); + $pager = $engine->newPagerForSavedQuery($saved); + $pager->setPageSize(10); + $results = $engine->executeQuery($query, $pager); + $view = $engine->renderResults($results, $saved); + + $create_button = id(new PHUIButtonView()) + ->setTag('a') + ->setText(pht('New Room')) + ->setHref('/conpherence/new/') + ->setWorkflow(true) + ->setColor(PHUIButtonView::GREEN); + + if ($results) { + $create_button->setIcon('fa-comments'); + + $header = id(new PHUIHeaderView()) + ->setHeader(pht('Joinable Rooms')) + ->addActionLink($create_button); + + $box = id(new PHUIObjectBoxView()) + ->setHeader($header) + ->setObjectList($view->getObjectList()); + if ($viewer->isLoggedIn()) { + $info = id(new PHUIInfoView()) + ->appendChild(pht('You have not joined any rooms yet.')) + ->setSeverity(PHUIInfoView::SEVERITY_NOTICE); + $box->setInfoView($info); + } + + return $box; + } else { + + $view = id(new PHUIBigInfoView()) + ->setIcon('fa-comments') + ->setTitle(pht('Welcome to Conpherence')) + ->setDescription( + pht('Conpherence lets you create public or private rooms to '. + 'communicate with others.')) + ->addAction($create_button); + + return $view; + } + } + } diff --git a/webroot/rsrc/css/application/conpherence/menu.css b/webroot/rsrc/css/application/conpherence/menu.css index 44a91849d7..aa5798bfff 100644 --- a/webroot/rsrc/css/application/conpherence/menu.css +++ b/webroot/rsrc/css/application/conpherence/menu.css @@ -11,27 +11,6 @@ background: #fff; } -.conpherence-layout .conpherence-no-threads { - text-align: center; - position: fixed; - left: 240px; - right: 240px; - top: 76px; - bottom: 0px; - min-width: 300px; - width: auto; -} - -.device .conpherence-layout .conpherence-no-threads { - left: 0; - right: 0; - width: 100%; -} - -.conpherence-layout .conpherence-no-threads .text { - margin: 0px 0px 16px 0px; -} - .conpherence-menu-pane { width: 100%; position: absolute; diff --git a/webroot/rsrc/css/application/conpherence/message-pane.css b/webroot/rsrc/css/application/conpherence/message-pane.css index 954e4ef44b..7209ac7085 100644 --- a/webroot/rsrc/css/application/conpherence/message-pane.css +++ b/webroot/rsrc/css/application/conpherence/message-pane.css @@ -24,12 +24,20 @@ width: 100%; } -.conpherence-layout .conpherence-no-threads { - text-align: center; +.conpherence-layout .conpherence-content-pane .conpherence-no-threads { + top: 44px; + right: 0; + background: #fff; + z-index: 26; } -.conpherence-layout .conpherence-no-threads .text { - margin: 16px 0px 16px 0px; +.conpherence-layout .phui-big-info-view { + margin: 16px; +} + +.conpherence-layout .conpherence-no-threads .phui-box-border { + border: none; + margin: 0; } .conpherence-show-more-messages {