This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

feat: make description text universal and fix some time display bugs

+21 -18
+13 -14
src/features/takes/handlers/pause.ts
··· 8 8 import { 9 9 addNewPeriod, 10 10 getPausedTimeRemaining, 11 + getRemainingTime, 11 12 } from "../../../libs/time-periods"; 12 13 13 14 export default async function handlePause( ··· 31 32 ); 32 33 33 34 const pausedTime = getPausedTimeRemaining(newPeriods); 35 + const endTime = getRemainingTime( 36 + takeToUpdate.targetDurationMs, 37 + takeToUpdate.periods, 38 + ); 34 39 35 - if (pausedTime > TakesConfig.MAX_PAUSE_DURATION) { 40 + if (pausedTime > TakesConfig.MAX_PAUSE_DURATION * 60000) { 36 41 return { 37 42 text: `You can't pause for more than ${TakesConfig.MAX_PAUSE_DURATION} minutes!`, 38 43 response_type: "ephemeral", ··· 49 54 }) 50 55 .where(eq(takesTable.id, takeToUpdate.id)); 51 56 57 + const descriptionText = takeToUpdate.description 58 + ? `\n\n*Working on:* ${takeToUpdate.description}` 59 + : ""; 60 + 52 61 return { 53 - text: `⏸️ Session paused! You have ${prettyPrintTime(TakesConfig.MAX_PAUSE_DURATION * 60000 - pausedTime)} remaining. It will automatically finish at ${generateSlackDate(new Date(Date.now() + TakesConfig.MAX_PAUSE_DURATION * 60000))}`, 62 + text: `⏸️ Session paused! You have ${prettyPrintTime(endTime.remaining)} remaining. It will automatically finish at ${generateSlackDate(new Date(Date.now() + TakesConfig.MAX_PAUSE_DURATION * 60000))}`, 54 63 response_type: "ephemeral", 55 64 blocks: [ 56 65 { 57 66 type: "section", 58 67 text: { 59 68 type: "mrkdwn", 60 - text: `⏸️ Session paused! You have ${prettyPrintTime(TakesConfig.MAX_PAUSE_DURATION * 60000 - pausedTime)} remaining.`, 69 + text: `⏸️ Session paused! You have ${prettyPrintTime(endTime.remaining)} remaining.${descriptionText}`, 61 70 }, 62 71 }, 63 72 { ··· 68 77 elements: [ 69 78 { 70 79 type: "mrkdwn", 71 - text: `It will automatically finish at ${generateSlackDate(new Date(Date.now() + TakesConfig.MAX_PAUSE_DURATION * 60000))} if not resumed.`, 80 + text: `It will automatically finish in ${prettyPrintTime(pausedTime)} (by ${generateSlackDate(new Date(new Date().getTime() - pausedTime))}) if not resumed.`, 72 81 }, 73 82 ], 74 83 }, 75 84 { 76 85 type: "actions", 77 86 elements: [ 78 - { 79 - type: "button", 80 - text: { 81 - type: "plain_text", 82 - text: "✍️ edit", 83 - emoji: true, 84 - }, 85 - value: "edit", 86 - action_id: "takes_edit", 87 - }, 88 87 { 89 88 type: "button", 90 89 text: {
+5 -1
src/features/takes/handlers/resume.ts
··· 43 43 pausedSession.periods, 44 44 ); 45 45 46 + const descriptionText = pausedSession.description 47 + ? `\n\n*Working on:* ${pausedSession.description}` 48 + : ""; 49 + 46 50 return { 47 51 text: `▶️ Takes session resumed! You have ${prettyPrintTime(endTime.remaining)} remaining in your session.`, 48 52 response_type: "ephemeral", ··· 51 55 type: "section", 52 56 text: { 53 57 type: "mrkdwn", 54 - text: "▶️ Takes session resumed!", 58 + text: `▶️ Takes session resumed!${descriptionText}`, 55 59 }, 56 60 }, 57 61 {
+3 -3
src/features/takes/handlers/status.ts
··· 124 124 const pauseExpires = getPausedTimeRemaining(pausedTake.periods); 125 125 126 126 // Add notes to display if present 127 - const noteText = pausedTake.notes 128 - ? `\n\n*Working on:* ${pausedTake.notes}` 127 + const descriptionText = pausedTake.description 128 + ? `\n\n*Working on:* ${pausedTake.description}` 129 129 : ""; 130 130 131 131 return { ··· 136 136 type: "section", 137 137 text: { 138 138 type: "mrkdwn", 139 - text: `⏸️ Session paused! You have ${prettyPrintTime(endTime.remaining)} remaining.`, 139 + text: `⏸️ Session paused! You have ${prettyPrintTime(endTime.remaining)} remaining.${descriptionText}`, 140 140 }, 141 141 }, 142 142 {