Skip to content

FLN-people-panel Add count to nearby and friends

Fallen requested to merge afallenhope/viewer:people-panel-count into main

UI Improvement

Improving the UX by adding the count of nearby avatars count list in the friend tabs.

People Panel

  • Add the [COUNT] and [REGION] to people panel, Nearby tab
  • Add the Online ([COUNT]) and All ([COUNT]) to Friends tab accordions

Nearby Region

Conditions

  • When a user enters region, number increases
  • When a user leaves region, number decreases

Friends

Conditions

  • When friend list is populated, display all and online only total
  • When friend list is filtered, display the number of friends that match the filter in "online" or "all" tab.*** Small caveat is that it takes until the next cycle of showFriendsAccordionsIfNeeded() to be triggered i.e tab switching

Mock-up

Nearby tab Friends tab

Tech Design

  • A new function void LLPanelPeople::updateAccordionTabTitles(); that updates the title of the mAccodionAllTab and mAccordionOnlineTab
  • The new function should update the title of the accordion tab with the number of online and all friends and will change based on filter.
  • updateAccordionTabTitles() should be called whenever the getActiveTabName() is set to FRIENDS_TAB_NAME.
  • It should be called in the showFriendsAccordionsIfNeeded() vs the proposed updateFriendsList() as it will delay and not update if a user enters text in the friend search. Having it update real time gives it a good user experience

Proposed Function

void LLPanelPeople::updateAccordionTabTitles()
{
    if (FRIENDS_TAB_NAME == getActiveTabName())
    {
        if (mOnlineFriendList)
	{
	    LLStringUtil::format_map_t args_online;
	    args_online["[COUNT]"] = llformat("%d", mOnlineFriendList->size());
	    std::string online_title = LLTrans::getString("online_friends_count", args_online);
	    mAccordionOnlineTab->setTitle(online_title);
	}
		
	if (mAllFriendList)
	{
	    LLStringUtil::format_map_t args_all;
	    args_all["[COUNT]"] = llformat("%d", mAllFriendList->size());
	    std::string all_title = LLTrans::getString("all_friends_count", args_all);
	    mAccordionAllTab->setTitle(all_title);
	}
    }
}
Edited by Fallen

Merge request reports