diff options
author | Dessalines <tyhou13@gmx.com> | 2019-09-13 09:09:01 -0700 |
---|---|---|
committer | Dessalines <tyhou13@gmx.com> | 2019-09-13 09:09:01 -0700 |
commit | e24f4a2d337ee0d3da58a7eab35be78bc54f267b (patch) | |
tree | 7a88869c7a034027d68bc7fa1764d070846dba65 /ui | |
parent | c8da0a92ec7aecfb8fd37435ad2973af6b6fc04b (diff) |
Adding an online user count to main page.
- Fixes #274
Diffstat (limited to 'ui')
-rw-r--r-- | ui/src/components/main.tsx | 5 | ||||
-rw-r--r-- | ui/src/interfaces.ts | 1 | ||||
-rw-r--r-- | ui/src/translations/en.ts | 1 |
3 files changed, 7 insertions, 0 deletions
diff --git a/ui/src/components/main.tsx b/ui/src/components/main.tsx index 9ee4afdd..b6c901be 100644 --- a/ui/src/components/main.tsx +++ b/ui/src/components/main.tsx @@ -43,6 +43,7 @@ export class Main extends Component<any, MainState> { }, admins: [], banned: [], + online: null, }, showEditSite: false, loading: true, @@ -216,6 +217,9 @@ export class Main extends Component<any, MainState> { } <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> <li className="list-inline-item badge badge-secondary"> @@ -420,6 +424,7 @@ export class Main extends Component<any, MainState> { 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}`; diff --git a/ui/src/interfaces.ts b/ui/src/interfaces.ts index 8c78d7d8..3221415b 100644 --- a/ui/src/interfaces.ts +++ b/ui/src/interfaces.ts @@ -546,6 +546,7 @@ export interface GetSiteResponse { site: Site; admins: Array<UserView>; banned: Array<UserView>; + online: number; } diff --git a/ui/src/translations/en.ts b/ui/src/translations/en.ts index 459e3b79..591221c6 100644 --- a/ui/src/translations/en.ts +++ b/ui/src/translations/en.ts @@ -70,6 +70,7 @@ export const en = { 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', |