";
- html += '
';
- html += '
';
- return html + '
';
- }
- // FIXME: It seems that, sometimes, server sends date in the future, so date-fns displays messages like 'in less than a minute'. We should fix
- // how dates are returned by the server when the session is active and show something like 'Active now', instead of past/future sentences
- function getLastSeenText(lastActivityDate) {
- if (lastActivityDate) {
- return globalize.translate('LastSeen', formatDistanceToNow(Date.parse(lastActivityDate), localeWithSuffix));
- }
-
- return '';
- }
-
- function getUserSectionHtml(users) {
- return users.map(function (u__q) {
- return getUserHtml(u__q);
- }).join('');
- }
-
- function renderUsers(page, users) {
- page.querySelector('.localUsers').innerHTML = getUserSectionHtml(users);
- }
-
- function loadData(page) {
- loading.show();
- ApiClient.getUsers().then(function (users) {
- renderUsers(page, users);
- loading.hide();
- });
- }
-
- pageIdOn('pageinit', 'userProfilesPage', function () {
- const page = this;
- page.querySelector('.btnAddUser').addEventListener('click', function() {
- Dashboard.navigate('usernew.html');
- });
- page.querySelector('.localUsers').addEventListener('click', function (e__e) {
- const btnUserMenu = dom.parentWithClass(e__e.target, 'btnUserMenu');
-
- if (btnUserMenu) {
- showUserMenu(btnUserMenu);
- }
- });
- });
-
- pageIdOn('pagebeforeshow', 'userProfilesPage', function () {
- loadData(this);
- });
-
-/* eslint-enable indent */
diff --git a/src/scripts/routes.js b/src/scripts/routes.js
index c747957248..ed0b40b97d 100644
--- a/src/scripts/routes.js
+++ b/src/scripts/routes.js
@@ -479,7 +479,7 @@ import { appRouter } from '../components/appRouter';
path: 'dashboard/users/userprofiles.html',
autoFocus: false,
roles: 'admin',
- controller: 'dashboard/users/userprofilespage'
+ pageComponent: 'UserProfilesPage'
});
defineRoute({
From cbc822ce6510940d3684f1d9af6b36b331881af6 Mon Sep 17 00:00:00 2001
From: grafixeyehero <32230989+grafixeyehero@users.noreply.github.com>
Date: Sat, 2 Oct 2021 20:10:46 +0300
Subject: [PATCH 2/3] use user.Id for key instead of index
---
src/components/pages/UserProfilesPage.tsx | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/components/pages/UserProfilesPage.tsx b/src/components/pages/UserProfilesPage.tsx
index fd1641f900..a9a727fedc 100644
--- a/src/components/pages/UserProfilesPage.tsx
+++ b/src/components/pages/UserProfilesPage.tsx
@@ -141,8 +141,8 @@ const UserProfilesPage: FunctionComponent = () => {
/>
- {users.map((user, index: number)=> {
- return ;
+ {users.map(user => {
+ return ;
})}
From 7aca1f699ce305c78ac84032d07ab6345fcde324 Mon Sep 17 00:00:00 2001
From: grafixeyehero <32230989+grafixeyehero@users.noreply.github.com>
Date: Thu, 7 Oct 2021 21:08:21 +0300
Subject: [PATCH 3/3] update component path
---
.../users}/SectionTitleButtonElement.tsx | 2 +-
.../users}/SectionTitleLinkElement.tsx | 2 +-
.../UserProfilesPage => dashboard/users}/UserCardBox.tsx | 6 +++---
src/components/pages/UserProfilesPage.tsx | 6 +++---
4 files changed, 8 insertions(+), 8 deletions(-)
rename src/components/{DashboardComponent/users/UserProfilesPage => dashboard/users}/SectionTitleButtonElement.tsx (93%)
rename src/components/{DashboardComponent/users/UserProfilesPage => dashboard/users}/SectionTitleLinkElement.tsx (93%)
rename src/components/{DashboardComponent/users/UserProfilesPage => dashboard/users}/UserCardBox.tsx (94%)
diff --git a/src/components/DashboardComponent/users/UserProfilesPage/SectionTitleButtonElement.tsx b/src/components/dashboard/users/SectionTitleButtonElement.tsx
similarity index 93%
rename from src/components/DashboardComponent/users/UserProfilesPage/SectionTitleButtonElement.tsx
rename to src/components/dashboard/users/SectionTitleButtonElement.tsx
index fe384e3813..52c94ba4af 100644
--- a/src/components/DashboardComponent/users/UserProfilesPage/SectionTitleButtonElement.tsx
+++ b/src/components/dashboard/users/SectionTitleButtonElement.tsx
@@ -1,5 +1,5 @@
import React, { FunctionComponent } from 'react';
-import globalize from '../../../../scripts/globalize';
+import globalize from '../../../scripts/globalize';
const createButtonElement = ({ className, title, icon }) => ({
__html: `