@@ -678,7 +763,7 @@
RIBC.initRIBC(floGlobals.subAdmins.includes(myFloID)).then(result => {
console.log(result)
renderAllElements()
- showPage(window.location.hash, {firstLoad: true})
+ showPage(window.location.hash, { firstLoad: true })
loader('hide')
}).catch(error => console.error(error))
}).catch(error => console.error(error))
@@ -1414,7 +1499,7 @@
//Function for displaying toast notifications. pass in error for mode param if you want to show an error.
function notify(message, mode, options = {}) {
- if(mode === 'error'){
+ if (mode === 'error') {
console.error(message)
}
const { pinned = false, sound = false } = options
@@ -1564,17 +1649,19 @@
}
}
if (!appPages.includes(pageId)) return
-
+
if (searchParams) {
const urlSearchParams = new URLSearchParams('?' + searchParams);
params = Object.fromEntries(urlSearchParams.entries());
}
- if(pageId !== lastPage){
- document.querySelector('.page:not(.hide-completely)')?.classList.add('hide-completely')
+ if (pageId !== lastPage && document.querySelector('.page:not(.hide-completely)')) {
+ document.querySelector('.page:not(.hide-completely)').classList.add('hide-completely')
}
- document.querySelector('.nav-list__item--active')?.classList.remove('nav-list__item--active')
+ if (document.querySelector('.nav-list__item--active'))
+ document.querySelector('.nav-list__item--active').classList.remove('nav-list__item--active')
const targetListItem = document.querySelector(`.nav-list__item[href="#${pageId}"]`)
- targetListItem?.classList.add('nav-list__item--active')
+ if (targetListItem)
+ targetListItem.classList.add('nav-list__item--active')
switch (pageId) {
case 'dashboard_page':
const frag = document.createDocumentFragment()
@@ -1588,7 +1675,7 @@
break;
case 'updates_page':
renderInternUpdates()
- if(!getRef('updates_page__project_selector').children.length){
+ if (!getRef('updates_page__project_selector').children.length) {
renderProjectSelectorOptions()
renderInternSelectorOptions()
}
@@ -1597,12 +1684,12 @@
renderAllInterns()
break;
case 'project_explorer':
- if(params){
- const {projectId, branch} = params
- if(lastParams.projectId !== projectId){
+ if (params) {
+ const { projectId, branch } = params
+ if (lastParams.projectId !== projectId) {
showProjectInfo(projectId)
}
- if(params.branch){
+ if (params.branch) {
const branchDetails = {
destination: 'project_explorer',
taskListContainer: 'explorer_task_list',
@@ -1610,20 +1697,20 @@
branch,
pageId
}
- showTasksOfBranch(branchDetails)
+ showTasksOfBranch(branchDetails)
}
getRef('project_explorer__left').classList.add('hide-on-mobile')
getRef('project_explorer__right').classList.remove('hide-on-mobile')
- }else{
+ } else {
getRef('project_explorer__left').classList.remove('hide-on-mobile')
getRef('project_explorer__right').classList.add('hide-on-mobile')
}
break;
case 'admin_page':
if (params) {
- const {projectId, branch} = params
+ const { projectId, branch } = params
editProjectInfo(projectId)
- if(params.branch){
+ if (params.branch) {
const branchDetails = {
destination: 'project_editing_panel',
taskListContainer: 'task_list',
@@ -1631,20 +1718,20 @@
branch,
pageId
}
- showTasksOfBranch(branchDetails)
+ showTasksOfBranch(branchDetails)
}
getRef('admin_page__left').classList.add('hide-on-mobile')
getRef('project_editing_panel').classList.remove('hide-on-mobile')
- }else{
+ } else {
getRef('admin_page__left').classList.remove('hide-on-mobile')
getRef('project_editing_panel').classList.add('hide-on-mobile')
}
break;
}
- if(pageId !== 'all_interns_page'){
+ if (pageId !== 'all_interns_page') {
getRef('all_interns_list').innerHTML = ''
}
- if(pageId !== 'dashboard_page'){
+ if (pageId !== 'dashboard_page') {
getRef('project_watchlist').innerHTML = ''
}
getRef(pageId).classList.remove('hide-completely')
@@ -1669,10 +1756,10 @@
},
taskCard(currentProject, currentBranch, taskNo) {
const card = getRef('timeline_task_card').content.cloneNode(true),
- assignedInterns = RIBC.getAssignedInterns(currentProject, currentBranch, taskNo),
- frag = document.createDocumentFragment();
+ assignedInterns = RIBC.getAssignedInterns(currentProject, currentBranch, taskNo),
+ frag = document.createDocumentFragment();
- if (RIBC.getTaskStatus(currentProject, currentBranch, taskNo) === 'completed'){
+ if (RIBC.getTaskStatus(currentProject, currentBranch, taskNo) === 'completed') {
card.firstElementChild.classList.add('completed-task')
}
if (assignedInterns || typeOfUser === 'general') {
@@ -1682,7 +1769,7 @@
card.querySelector('.assigned-interns').append(frag)
}
else {
- if(typeOfUser === 'intern'){
+ if (typeOfUser === 'intern') {
const applyButton = createElement('sm-button', {
textContent: 'Apply',
className: 'apply-button',
@@ -1700,13 +1787,13 @@
card.querySelector('.apply-container').append(applyButton)
}
}
- const {taskTitle, taskDescription} = RIBC.getTaskDetails(currentProject, currentBranch, taskNo)
+ const { taskTitle, taskDescription } = RIBC.getTaskDetails(currentProject, currentBranch, taskNo)
card.querySelector('.timeline-task__title').textContent = taskTitle;
card.querySelector('.timeline-task__description').textContent = taskDescription;
const branches = getAllBranches(currentProject)
- for(const branch of branches){
- const {branchName, parantBranch, startPoint, endPoint} = branch
- if(parantBranch === currentBranch && startPoint === taskNo){
+ for (const branch of branches) {
+ const { branchName, parantBranch, startPoint, endPoint } = branch
+ if (parantBranch === currentBranch && startPoint === taskNo) {
card.querySelector('.task__branch_container').append(
render.branchButton({
projectId: currentProject,
@@ -1739,10 +1826,10 @@
return card;
},
branchButton(obj = {}) {
- const {projectId, branch, page, innerHTML} = obj
+ const { projectId, branch, page, innerHTML } = obj
return createElement('a', {
className: 'branch-button',
- attributes: { href: `#${page}?projectId=${projectId}&branch=${branch}`},
+ attributes: { href: `#${page}?projectId=${projectId}&branch=${branch}` },
textContent: branch,
innerHTML
});
@@ -1781,9 +1868,9 @@
card.querySelector('.assigned-interns').append(frag)
}
const branches = getAllBranches(currentProject)
- for(const branch of branches){
- const {branchName, parantBranch, startPoint, endPoint} = branch
- if(parantBranch === currentBranch && startPoint === taskNo){
+ for (const branch of branches) {
+ const { branchName, parantBranch, startPoint, endPoint } = branch
+ if (parantBranch === currentBranch && startPoint === taskNo) {
card.querySelector('.task__branch_container').append(
render.branchButton({
projectId: currentProject,
@@ -1798,13 +1885,13 @@
projectMapCard(projectCode, page) {
const card = getRef('project_map_template').content.cloneNode(true)
const frag = document.createDocumentFragment()
- const {projectName, projectDescription} = RIBC.getProjectDetails(projectCode)
+ const { projectName, projectDescription } = RIBC.getProjectDetails(projectCode)
card.firstElementChild.id = `${projectCode}_map`;
card.querySelector('.project-map__title').textContent = projectName
card.querySelector('.project-map__description').textContent = projectDescription
card.querySelector('.project__branch_container').id = `${projectCode}_branch_container`;
RIBC.getProjectBranches(projectCode).forEach((branch) => {
- frag.append(render.branchButton({projectId: projectCode, branch, page}))
+ frag.append(render.branchButton({ projectId: projectCode, branch, page }))
})
card.querySelector('.project__branch_container').append(frag);
card.querySelector('.project-map__timeline').id = `${projectCode}_map_body`
@@ -1840,7 +1927,7 @@
const { taskTitle, taskDescription } = RIBC.getTaskDetails(projectId, projectBranch, task)
return createElement('li', {
className: "task-card",
- attributes: {'data-unique-id': uniqueId},
+ attributes: { 'data-unique-id': uniqueId },
innerHTML: `