site: Option<SiteView>,
admins: Vec<UserView>,
banned: Vec<UserView>,
+ pub online: usize,
}
#[derive(Serialize, Deserialize)]
site: site_view,
admins: admins,
banned: banned,
+ online: 0
})
}
}
site: Some(site_view),
admins: admins,
banned: banned,
+ online: 0
})
}
}
Ok(serde_json::to_string(&res)?)
}
UserOperation::GetSite => {
+ let online: usize = chat.sessions.len();
let get_site: GetSite = serde_json::from_str(data)?;
- let res = Oper::new(user_operation, get_site).perform()?;
+ let mut res = Oper::new(user_operation, get_site).perform()?;
+ res.online = online;
Ok(serde_json::to_string(&res)?)
}
UserOperation::Search => {
},
admins: [],
banned: [],
+ online: null,
},
showEditSite: false,
loading: true,
</ul>
}
<ul class="my-2 list-inline">
+ <li className="list-inline-item badge badge-secondary">
+ <T i18nKey="number_online" interpolation={{count: this.state.site.online}}>#</T>
+ </li>
<li className="list-inline-item badge badge-secondary">
<T i18nKey="number_of_users" interpolation={{count: this.state.site.site.number_of_users}}>#</T>
</li>
this.state.site.admins = res.admins;
this.state.site.site = res.site;
this.state.site.banned = res.banned;
+ this.state.site.online = res.online;
this.setState(this.state);
document.title = `${WebSocketService.Instance.site.name}`;
site: Site;
admins: Array<UserView>;
banned: Array<UserView>;
+ online: number;
}
number_of_users:'{{count}} Users',
number_of_subscribers:'{{count}} Subscribers',
number_of_points:'{{count}} Points',
+ number_online:'{{count}} Users Online',
name: 'Name',
title: 'Title',
category: 'Category',