-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add task notes first attempt #72
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
module.exports = { | ||
up: async (queryInterface, Sequelize) => queryInterface.addColumn( | ||
'Tasks', | ||
'notes', | ||
{ | ||
type: Sequelize.STRING, | ||
allowNull: true, | ||
}, | ||
), | ||
|
||
down: async (queryInterface) => queryInterface.removeColumn( | ||
'Tasks', | ||
'notes', | ||
), | ||
}; |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,5 +1,6 @@ | ||||||
// added Blocks and Context blocks | ||||||
const { | ||||||
HomeTab, Header, Divider, Section, Actions, Elements, Input, Bits, | ||||||
HomeTab, Header, Divider, Section, Actions, Elements, Input, Bits, Context, Blocks, | ||||||
} = require('slack-block-builder'); | ||||||
const pluralize = require('pluralize'); | ||||||
const { DateTime } = require('luxon'); | ||||||
|
@@ -33,21 +34,47 @@ module.exports = (openTasks) => { | |||||
const end = openTasks.length; | ||||||
const maxOptionsLength = 10; | ||||||
|
||||||
// LEAVING THIS UNTOUCHED FOR NOW | ||||||
|
||||||
// for (start, end; start < end; start += maxOptionsLength) { | ||||||
// holdingArray = openTasks.slice(start, start + maxOptionsLength); | ||||||
// tasksInputsArray.push( | ||||||
// Input({ label: ' ', blockId: `open-task-status-change-${start}` }).dispatchAction().element(Elements.Checkboxes({ actionId: 'blockOpenTaskCheckboxClicked' }).options(holdingArray.map((task) => { | ||||||
// const option = { | ||||||
// text: `*${task.title}*`, | ||||||
// value: `open-task-${task.id}`, | ||||||
// }; | ||||||
// if (task.dueDate) { | ||||||
// option.description = `Due ${DateTime.fromJSDate(task.dueDate).toRelativeCalendar()}`; | ||||||
// } | ||||||
// return Bits.Option(option); | ||||||
// }))), | ||||||
// ); | ||||||
// } | ||||||
|
||||||
// SANDRA TESTING | ||||||
Comment on lines
+37
to
+55
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm assuming this is just the old code, so not looking at it. |
||||||
|
||||||
for (start, end; start < end; start += maxOptionsLength) { | ||||||
holdingArray = openTasks.slice(start, start + maxOptionsLength); | ||||||
tasksInputsArray.push( | ||||||
Input({ label: ' ', blockId: `open-task-status-change-${start}` }).dispatchAction().element(Elements.Checkboxes({ actionId: 'blockOpenTaskCheckboxClicked' }).options(holdingArray.map((task) => { | ||||||
// Below adding a context block as a variable and passed it Bits.Option | ||||||
// let context = Blocks.Context().elements([Elements.TextInput({text:"this is a context block"})],[Elements.TextInput({text:"this is another context block"})]) | ||||||
const option = { | ||||||
text: `*${task.title}*`, | ||||||
value: `open-task-${task.id}`, | ||||||
}; | ||||||
if (task.dueDate) { | ||||||
option.description = `Due ${DateTime.fromJSDate(task.dueDate).toRelativeCalendar()}`; | ||||||
option.description = `:spiral_calendar_pad:Due ${DateTime.fromJSDate(task.dueDate).toRelativeCalendar()}`; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
} | ||||||
// Tried adding this line with some hardcoded text for each element but that didn't work either. | ||||||
// I don't think TextInput can be passed in .elements but if that's the case documentation does not show how add mrkdwn elements to a Context block? | ||||||
// Context().elements([Elements.TextInput({text:`something`})],[Elements.TextInput({text:`something else`})]) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's two things here, which maybe because you haven't fully written out your thoughts, but as written
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here's the relevant docs on our side - https://api.slack.com/reference/block-kit/composition-objects#option There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, I did some digging in the BlockBuilder source code and I think I have it.
|
||||||
return Bits.Option(option); | ||||||
}))), | ||||||
); | ||||||
} | ||||||
|
||||||
homeTab.blocks( | ||||||
Header({ text: `You have ${openTasks.length} open ${pluralize('task', openTasks.length)}` }), | ||||||
Divider(), | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,5 +35,12 @@ module.exports = (prefilledTitle, currentUser) => { | |
actionId: 'taskDueTime', | ||
}), | ||
), | ||
Blocks.Input({ label: 'Notes', blockId: 'taskNotes', optional: true }).element( | ||
Elements.TextInput({ | ||
actionId: 'taskNotes', | ||
maxLength: 300, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did you pick 300 at random or was their a specific reason for it? |
||
}) | ||
.multiline(true), | ||
), | ||
).buildToJSON(); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You definitely need this