Skip to content

Commit 8d4b9d6

Browse files
committed
users on card
1 parent 3fb49f7 commit 8d4b9d6

File tree

3 files changed

+30
-13
lines changed

3 files changed

+30
-13
lines changed

services/static-webserver/client/source/class/osparc/dashboard/GridButtonBase.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,16 @@ qx.Class.define("osparc.dashboard.GridButtonBase", {
6161
rowSpan: 1,
6262
colSpan: 4
6363
},
64-
TAGS: {
64+
AVATAR_GROUP: {
6565
row: 3,
6666
column: 0
6767
},
68-
FOOTER: {
68+
TAGS: {
6969
row: 4,
70+
column: 0
71+
},
72+
FOOTER: {
73+
row: 5,
7074
column: 0,
7175
rowSpan: 1,
7276
colSpan: 4

services/static-webserver/client/source/class/osparc/dashboard/GridButtonItem.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ qx.Class.define("osparc.dashboard.GridButtonItem", {
8181
layout = this.getChildControl("footer");
8282
layout.add(control, osparc.dashboard.GridButtonBase.FPOS.HITS);
8383
break;
84+
case "avatar-group":
85+
control = new osparc.ui.basic.AvatarGroup(24, "left", 150);
86+
layout = this.getChildControl("main-layout");
87+
layout.add(control, osparc.dashboard.GridButtonBase.POS.AVATAR_GROUP);
88+
break;
8489
case "tags":
8590
control = new qx.ui.container.Composite(new qx.ui.layout.Flow(5, 3)).set({
8691
anonymous: true,
@@ -237,6 +242,25 @@ qx.Class.define("osparc.dashboard.GridButtonItem", {
237242
const user = this.__createOwner(value);
238243
label.setValue(user);
239244
label.setVisibility(value ? "visible" : "excluded");
245+
246+
// remove this, testing purposes
247+
if (this.getResourceType() === "study") {
248+
const avatarGroup = this.getChildControl("avatar-group");
249+
const allUsers = [
250+
{ name: "Alice", avatar: "https://i.pravatar.cc/150?img=1" },
251+
{ name: "Bob", avatar: "https://i.pravatar.cc/150?img=2" },
252+
{ name: "Charlie", avatar: "https://i.pravatar.cc/150?img=3" },
253+
{ name: "Dana", avatar: "https://i.pravatar.cc/150?img=4" },
254+
{ name: "Eve", avatar: "https://i.pravatar.cc/150?img=5" },
255+
{ name: "Frank", avatar: "https://i.pravatar.cc/150?img=6" },
256+
];
257+
// Random number of users between 1 and 6
258+
const randomCount = Math.floor(Math.random() * 6) + 1;
259+
// Shuffle the array and take the first randomCount users
260+
const shuffled = allUsers.sort(() => 0.5 - Math.random());
261+
const randomUsers = shuffled.slice(0, randomCount);
262+
avatarGroup.setUsers(randomUsers);
263+
}
240264
},
241265

242266
_applyAccessRights: function(value) {

services/static-webserver/client/source/class/osparc/navigation/NavigationBar.js

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -108,17 +108,6 @@ qx.Class.define("osparc.navigation.NavigationBar", {
108108
converter: s => s ? "visible" : "excluded"
109109
});
110110

111-
const avatarGroup = new osparc.ui.basic.AvatarGroup();
112-
avatarGroup.setUsers([
113-
{ name: "Alice", avatar: "https://i.pravatar.cc/150?img=1" },
114-
{ name: "Bob", avatar: "https://i.pravatar.cc/150?img=2" },
115-
{ name: "Charlie", avatar: "https://i.pravatar.cc/150?img=3" },
116-
{ name: "Dana", avatar: "https://i.pravatar.cc/150?img=4" },
117-
{ name: "Eve", avatar: "https://i.pravatar.cc/150?img=5" },
118-
{ name: "Frank", avatar: "https://i.pravatar.cc/150?img=6" },
119-
]);
120-
this.getChildControl("left-items").add(avatarGroup);
121-
122111
const studyTitleOptions = this.getChildControl("study-title-options");
123112
this.bind("study", studyTitleOptions, "visibility", {
124113
converter: s => s ? "visible" : "excluded"

0 commit comments

Comments
 (0)