-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Balint Dolla
committed
Nov 3, 2023
1 parent
46969db
commit bf16059
Showing
7 changed files
with
100 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 3 additions & 9 deletions
12
packages/core/services/slack/constructBirthdayConfirmedMessage.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,10 @@ | ||
import type { ChatReplaceMessageArguments } from "@/types/ChatReplaceMessageArguments"; | ||
|
||
import { makeTextBlock } from "./messageItems"; | ||
|
||
export const constructBirthdayConfirmedMessage = | ||
(): ChatReplaceMessageArguments => ({ | ||
replace_original: true, | ||
text: "Thanks for submitting your birthday! 🎉", | ||
blocks: [ | ||
{ | ||
type: "section", | ||
text: { | ||
type: "mrkdwn", | ||
text: `Thanks for submitting your birthday! 🎉`, | ||
}, | ||
}, | ||
], | ||
blocks: [makeTextBlock(`Thanks for submitting your birthday! 🎉`)], | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import type { ActionsBlock, SectionBlock } from "@slack/web-api"; | ||
|
||
export const makeTextBlock = (text: string): SectionBlock => ({ | ||
type: "section", | ||
text: { | ||
type: "mrkdwn", | ||
text, | ||
}, | ||
}); | ||
|
||
export const makeTextBlockWithDatepicker = ( | ||
text: string, | ||
actionId: string, | ||
): SectionBlock => ({ | ||
...makeTextBlock(text), | ||
accessory: { | ||
type: "datepicker", | ||
initial_date: "1995-01-01", | ||
placeholder: { | ||
type: "plain_text", | ||
text: "Select a date", | ||
emoji: true, | ||
}, | ||
action_id: actionId, | ||
}, | ||
}); | ||
|
||
export const makeActionsBlock = ( | ||
yesActionId: string, | ||
noActionId: string, | ||
yesValue: string, | ||
noValue: string, | ||
): ActionsBlock => ({ | ||
type: "actions", | ||
elements: [ | ||
{ | ||
type: "button", | ||
text: { | ||
type: "plain_text", | ||
emoji: true, | ||
text: "Yes", | ||
}, | ||
style: "primary", | ||
action_id: yesActionId, | ||
value: yesValue, | ||
}, | ||
{ | ||
type: "button", | ||
text: { | ||
type: "plain_text", | ||
emoji: true, | ||
text: "No", | ||
}, | ||
style: "danger", | ||
action_id: noActionId, | ||
value: noValue, | ||
}, | ||
], | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters