mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-11-22 20:19:21 +00:00
Load users presence
This commit is contained in:
parent
8705fc6581
commit
5f5f27e79d
7
assets/css/pages/groups/pages/presence.css
Normal file
7
assets/css/pages/groups/pages/presence.css
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
/**
|
||||||
|
* Groups presence stylesheet
|
||||||
|
*
|
||||||
|
* This is a Forez feature
|
||||||
|
*
|
||||||
|
* @author Pierre Hubert
|
||||||
|
*/
|
32
assets/js/components/presence/PresenceHelper.js
Normal file
32
assets/js/components/presence/PresenceHelper.js
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
/**
|
||||||
|
* Forez Presence Helper
|
||||||
|
*
|
||||||
|
* @author Pierre Hubert
|
||||||
|
*/
|
||||||
|
|
||||||
|
class Presence {
|
||||||
|
constructor(userID, year, month, day) {
|
||||||
|
this.userID = userID;
|
||||||
|
this.year = year;
|
||||||
|
this.month = month;
|
||||||
|
this.day = day;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class ForezPresenceHelper {
|
||||||
|
/**
|
||||||
|
* Load the list of presence
|
||||||
|
*
|
||||||
|
* @param {number} groupID Target group ID
|
||||||
|
* @returns {Promise<Presence[]>}
|
||||||
|
*/
|
||||||
|
static async GetList(groupID) {
|
||||||
|
const list = await ws("forez_presence/list", {group: groupID});
|
||||||
|
|
||||||
|
return list.map(el => {
|
||||||
|
const infos = el.split(",").map(e => Number(e));
|
||||||
|
return new Presence(...infos)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -120,6 +120,12 @@ const GroupsPage = {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case "presence":
|
||||||
|
if (group.is_forez_group) {
|
||||||
|
await GroupPresencePage.Show(group, target)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ComunicWeb.common.error.pageNotFound(null, target);
|
ComunicWeb.common.error.pageNotFound(null, target);
|
||||||
}
|
}
|
||||||
|
22
assets/js/pages/groups/pages/presence.js
Normal file
22
assets/js/pages/groups/pages/presence.js
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
/**
|
||||||
|
* Group presence tab
|
||||||
|
*
|
||||||
|
* This is a Forez feature
|
||||||
|
*
|
||||||
|
* @author Pierre Hubert
|
||||||
|
*/
|
||||||
|
|
||||||
|
class GroupPresencePage {
|
||||||
|
/**
|
||||||
|
* Show the page
|
||||||
|
*
|
||||||
|
* @param {AdvancedGroupInfo} group
|
||||||
|
* @param {HTMLElement} target
|
||||||
|
*/
|
||||||
|
static async Show(group, target) {
|
||||||
|
const presence = await ForezPresenceHelper.GetList(group.id);
|
||||||
|
const users = await getUsers([...new Set(presence.map(e => e.userID))]);
|
||||||
|
|
||||||
|
console.error(presence, users)
|
||||||
|
}
|
||||||
|
}
|
@ -28,6 +28,7 @@ const GroupTabs = {
|
|||||||
activePage: activePage,
|
activePage: activePage,
|
||||||
firstArgument: firstArgument,
|
firstArgument: firstArgument,
|
||||||
conversations: group.conversations,
|
conversations: group.conversations,
|
||||||
|
is_forez: group.is_forez_group
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -5,6 +5,9 @@
|
|||||||
<ul class="nav nav-tabs group-page-tabs" style="display: flex; flex-wrap: wrap; justify-content: start;">
|
<ul class="nav nav-tabs group-page-tabs" style="display: flex; flex-wrap: wrap; justify-content: start;">
|
||||||
<li v-bind:class="activePage == 'posts' ? 'active': ''"><a @click="openPage('posts')">tr("Posts")</a></li>
|
<li v-bind:class="activePage == 'posts' ? 'active': ''"><a @click="openPage('posts')">tr("Posts")</a></li>
|
||||||
|
|
||||||
|
<!-- Forez presence -->
|
||||||
|
<li v-bind:class="activePage == 'presence' ? 'active': ''"><a @click="openPage('presence')" v-if="is_forez">tr("Presence")</a></li>
|
||||||
|
|
||||||
<!-- Group conversations -->
|
<!-- Group conversations -->
|
||||||
<li v-for="conv in conversations" v-bind:class="activePage == 'conversation' && firstArgument == conv.id ? 'active': ''">
|
<li v-for="conv in conversations" v-bind:class="activePage == 'conversation' && firstArgument == conv.id ? 'active': ''">
|
||||||
<a @click="openPage('conversation/' + conv.id)">{{conv.name}}</a></li>
|
<a @click="openPage('conversation/' + conv.id)">{{conv.name}}</a></li>
|
||||||
|
@ -272,6 +272,7 @@ class Dev {
|
|||||||
"css/pages/groups/pages/members.css",
|
"css/pages/groups/pages/members.css",
|
||||||
"css/pages/groups/pages/forbidden.css",
|
"css/pages/groups/pages/forbidden.css",
|
||||||
"css/pages/groups/pages/about.css",
|
"css/pages/groups/pages/about.css",
|
||||||
|
"css/pages/groups/pages/presence.css",
|
||||||
|
|
||||||
//Groups sections
|
//Groups sections
|
||||||
"css/pages/groups/sections/header.css",
|
"css/pages/groups/sections/header.css",
|
||||||
@ -495,6 +496,9 @@ class Dev {
|
|||||||
// Small media player
|
// Small media player
|
||||||
"js/components/smallMediaPlayer.js",
|
"js/components/smallMediaPlayer.js",
|
||||||
|
|
||||||
|
// Presence helper
|
||||||
|
"js/components/presence/PresenceHelper.js",
|
||||||
|
|
||||||
//User scripts
|
//User scripts
|
||||||
"js/user/loginTokens.js",
|
"js/user/loginTokens.js",
|
||||||
"js/user/userLogin.js",
|
"js/user/userLogin.js",
|
||||||
@ -539,6 +543,7 @@ class Dev {
|
|||||||
"js/pages/groups/pages/members.js",
|
"js/pages/groups/pages/members.js",
|
||||||
"js/pages/groups/pages/forbidden.js",
|
"js/pages/groups/pages/forbidden.js",
|
||||||
"js/pages/groups/pages/about.js",
|
"js/pages/groups/pages/about.js",
|
||||||
|
"js/pages/groups/pages/presence.js",
|
||||||
|
|
||||||
//Groups sections
|
//Groups sections
|
||||||
"js/pages/groups/sections/header.js",
|
"js/pages/groups/sections/header.js",
|
||||||
|
Loading…
Reference in New Issue
Block a user