mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
calendar items wit round-robin color
This commit is contained in:
parent
f68c69d443
commit
b50c51bc2a
@ -2,7 +2,23 @@
|
||||
const USER_CALENDAR_SHOW_RANGES = 'ranges';
|
||||
const USER_CALENDAR_SHOW_EVENTS = 'events';
|
||||
|
||||
const COLORS = [ /* from https://colorbrewer2.org/#type=qualitative&scheme=Set3&n=12 */
|
||||
'#8dd3c7',
|
||||
'#ffffb3',
|
||||
'#bebada',
|
||||
'#fb8072',
|
||||
'#80b1d3',
|
||||
'#fdb462',
|
||||
'#b3de69',
|
||||
'#fccde5',
|
||||
'#d9d9d9',
|
||||
'#bc80bd',
|
||||
'#ccebc5',
|
||||
'#ffed6f'
|
||||
];
|
||||
|
||||
export {
|
||||
USER_CALENDAR_SHOW_RANGES,
|
||||
USER_CALENDAR_SHOW_EVENTS,
|
||||
COLORS,
|
||||
};
|
||||
|
@ -31,7 +31,11 @@ export default {
|
||||
console.log('adding ranges for user', userId);
|
||||
const s = {
|
||||
//'id': `ranges_${userId}`,
|
||||
'events': userData.calendarRanges,
|
||||
events: userData.calendarRanges,
|
||||
color: userData.mainColor,
|
||||
backgroundColor: 'white',
|
||||
textColor: 'black',
|
||||
editable: false,
|
||||
};
|
||||
|
||||
console.log('range source', s);
|
||||
|
@ -49,7 +49,7 @@ export default {
|
||||
if (state.usersData.has(user.id)) {
|
||||
userData = state.usersData.get(user.id);
|
||||
} else {
|
||||
userData = createUserData(user);
|
||||
userData = createUserData(user, state.usersData.size);
|
||||
state.usersData.set(user.id, userData);
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
import {COLORS} from '../const';
|
||||
|
||||
const addIdToValue = (string, id) => {
|
||||
let array = string ? string.split(',') : [];
|
||||
array.push(id.toString());
|
||||
@ -20,22 +22,25 @@ const mapEntity = (entity) => {
|
||||
return entity;
|
||||
};
|
||||
|
||||
const createUserData = (user) => {
|
||||
const createUserData = (user, colorIndex) => {
|
||||
const colorId = colorIndex % COLORS.length;
|
||||
console.log('colorId', colorId);
|
||||
return {
|
||||
user: user,
|
||||
calendarRanges: [],
|
||||
calendarRangesLoaded: [],
|
||||
mainColor: COLORS[colorId],
|
||||
}
|
||||
}
|
||||
|
||||
const calendarRangeToFullCalendarEvent = (entity) => {
|
||||
return {
|
||||
//id: `range_${entity.id}`,
|
||||
title: "Disponible",
|
||||
id: `range_${entity.id}`,
|
||||
title: "",
|
||||
start: entity.startDate.datetime8601,
|
||||
end: entity.endDate.datetime8601,
|
||||
allDay: false,
|
||||
//userId: entity.user.id,
|
||||
userId: entity.user.id,
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user