diff --git a/index.html b/index.html index 12bb48e..2d9ed3a 100644 --- a/index.html +++ b/index.html @@ -55,20 +55,21 @@ ) floDapps.launchStartUp().then(result => { console.log(result) - let floId = floDapps.user.id - if (!floCrypto.validateFloID(floId)) { - const type = coinjs.addressDecode(floId).type + if (!floCrypto.validateFloID(floDapps.user.id)) { + floGlobals.myBtcID = floDapps.user.id + const type = coinjs.addressDecode(floGlobals.myBtcID).type if (type === 'standard') { - floId = btcOperator.convert.legacy2legacy(floId, 0x23); + floGlobals.myFloID = btcOperator.convert.legacy2legacy(floGlobals.myBtcID, 0x23); } else if (type === 'bech32') { - floId = btcOperator.convert.bech2legacy(floId, 0x23); + floGlobals.myFloID = btcOperator.convert.bech2legacy(floGlobals.myBtcID, 0x23); } else { notify(`Multisig address can't be used to sign in`, 'error'); return; } + } else { + floGlobals.myFloID = floDapps.user.id + floGlobals.myBtcID = btcOperator.convert.legacy2bech(floDapps.user.id) } - floGlobals.myFloID = floId - floGlobals.myBtcID = btcOperator.convert.legacy2bech(floId) getRef('user_profile_id').textContent = floGlobals.myFloID let showingFloID = true // alternating between floID and btcID every 10 seconds @@ -77,7 +78,7 @@ showingFloID = !showingFloID }, 10000) floGlobals.loaded = true - RIBC.init(floGlobals.subAdmins.includes(myFloID)).then(result => { + RIBC.init(floGlobals.subAdmins.includes(floGlobals.myFloID)).then(result => { console.log(result) renderAllElements() routeTo(window.location.hash, { firstLoad: true }) @@ -1154,13 +1155,14 @@ getRef('generated_flo_address').value = floID getRef('generated_private_key').value = privKey break; - case 'dashboard_page': - let renderedAssignedTasks + case 'dashboard_page': { + let renderedAssignedTasks = [] if (userType === 'intern') { // Render assigned task cards - if (floGlobals.assignedTasks.size) { - renderedAssignedTasks = filterMap(floGlobals.assignedTasks, id => render.internTaskCard(id)) - } else { + const { assignedTasks } = RIBC.getInternRecord(floGlobals.myFloID) + for (const taskId in assignedTasks) + renderedAssignedTasks.push(render.internTaskCard(taskId)) + if (renderedAssignedTasks.length === 0) { renderedAssignedTasks = html`No task assigned yet.`; } } @@ -1201,6 +1203,7 @@ showTaskDetails(params.taskId) } else hideTaskDetails() + } break; case 'updates_page': { closePopup() @@ -1814,7 +1817,7 @@ const assignedInterns = RIBC.getAssignedInterns(projectCode, branch, task); if (assignedInterns.length >= allTasks[taskId].maxSlots) continue; availableCategories.add(allTasks[taskId].category) - if (userType && userType === 'intern' && floDapps.user.id && assignedInterns.includes(floDapps.user.id)) continue; + if (userType && userType === 'intern' && floGlobals.myFloID && assignedInterns.includes(floGlobals.myFloID)) continue; if (filterCategory && allTasks[taskId].category !== filterCategory) continue; if (searchQuery && searchQuery !== '') { if (!allTasks[taskId].title.toLowerCase().includes(searchQuery.toLowerCase()) && !floGlobals.taskCategories[allTasks[taskId].category].toLowerCase().includes(searchQuery.toLowerCase())) continue; @@ -1882,7 +1885,7 @@ const assignedInternsCards = assignedInterns.map(internFloId => render.assignedInternCard(internFloId)); const status = RIBC.getTaskStatus(appState.params.id, appState.params.branch, task) let applyButton - if (!assignedInterns.includes(myFloID) && userType !== 'admin') { + if (!assignedInterns.includes(floGlobals.myFloID) && userType !== 'admin') { const hasApplied = [...RIBC.getTaskRequests(false), ...sessionTaskRequests].find(({ details }) => { return `${appState.params.id}_${appState.params.branch}_${task}` === details.taskId }) @@ -2244,7 +2247,7 @@ const [projectCode, branch, task] = uniqueId.split('_'); const { title, description, duration, durationType } = RIBC.getTaskDetails(projectCode, branch, task) const projectName = RIBC.getProjectDetails(projectCode).projectName - const { assignedTasks } = RIBC.getInternRecord(floDapps.user.id) + const { assignedTasks } = RIBC.getInternRecord(floGlobals.myFloID) const linkifyDescription = createElement('p', { innerHTML: DOMPurify.sanitize(linkify(description)), className: `timeline-task__description ws-pre-line wrap-around` @@ -2546,15 +2549,17 @@ -
- You can set a password to secure your private key and use the password instead of private key. This is applied to this browser only. -
+ ${!floGlobals.isPrivKeySecured ? html` ++ You can set a password to secure your private key and use the password instead of private key. This is applied to this browser only. +
+