( host: SlashCommandHost, selectedGoalId?: string, )
| 212 | } |
| 213 | |
| 214 | async function showGoalQueueManager( |
| 215 | host: SlashCommandHost, |
| 216 | selectedGoalId?: string, |
| 217 | ): Promise<void> { |
| 218 | let snapshot: GoalQueueSnapshot; |
| 219 | try { |
| 220 | snapshot = await readGoalQueue(host.requireSession()); |
| 221 | } catch (error) { |
| 222 | host.showError(`Failed to load upcoming goals: ${formatErrorMessage(error)}`); |
| 223 | return; |
| 224 | } |
| 225 | |
| 226 | host.track('goal_queue_manage'); |
| 227 | host.mountEditorReplacement( |
| 228 | new GoalQueueManagerComponent({ |
| 229 | goals: snapshot.goals, |
| 230 | selectedGoalId, |
| 231 | onAction: async (action) => { |
| 232 | try { |
| 233 | return await handleGoalQueueManagerAction(host, action); |
| 234 | } catch (error) { |
| 235 | host.showError(`Failed to update upcoming goals: ${formatErrorMessage(error)}`); |
| 236 | return undefined; |
| 237 | } |
| 238 | }, |
| 239 | onCancel: () => { |
| 240 | host.restoreEditor(); |
| 241 | }, |
| 242 | }), |
| 243 | ); |
| 244 | } |
| 245 | |
| 246 | async function handleGoalQueueManagerAction( |
| 247 | host: SlashCommandHost, |
no test coverage detected