Browse Source

Adding an online user count to main page.

- Fixes #274
pull/1/head
Dessalines 2 years ago
parent
commit
7e48fd9b0c
  1. 5
      src/components/main.tsx
  2. 1
      src/interfaces.ts
  3. 1
      src/translations/en.ts

5
src/components/main.tsx

@ -43,6 +43,7 @@ export class Main extends Component<any, MainState> {
},
admins: [],
banned: [],
online: null,
},
showEditSite: false,
loading: true,
@ -215,6 +216,9 @@ export class Main extends Component<any, MainState> {
</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>
@ -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}`;

1
src/interfaces.ts

@ -546,6 +546,7 @@ export interface GetSiteResponse {
site: Site;
admins: Array<UserView>;
banned: Array<UserView>;
online: number;
}

1
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',

Loading…
Cancel
Save