Skip to content

Commit ef149bd

Browse files
authored
Merge pull request #25 from triggerdotdev/dev
Dev
2 parents 56e5a5c + d8ef6be commit ef149bd

3 files changed

Lines changed: 23 additions & 3 deletions

File tree

apps/docs/integrations/apis/slack/actions/post-message.mdx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,12 @@ In this examples there are two workflows:
127127
1. Messages your team every minute (!) and asks them how they're doing.
128128
2. Receives the interaction from users. It adds reactions when the buttons are pressed and posts a message when a user selects from the dropdown menu.
129129

130+
Please note, that to use `jsx-slack` you will need to add the `jsxImportSource` pragma to the top of your file. This is because `jsx-slack` is not a React library, but it uses the same syntax as React. Also, you might need to add `"jsx": "react-jsx"` to your `compilerOption` in `tsconfig.json`. The workflow file needs to be a `.jsx` or `.tsx` file (like when you use React).
131+
130132
<CodeGroup>
131133

132-
```typescript Blocks with interactivity
134+
```typescript workflow.tsx
135+
/** @jsxImportSource jsx-slack */
133136
import { slack } from "@trigger.dev/integrations";
134137
import JSXSlack, {
135138
Actions,
@@ -207,6 +210,7 @@ new Trigger({
207210
channelId: event.channel.id,
208211
});
209212
}
213+
break;
210214
}
211215
case "status-help": {
212216
//the user needs help so add an 🆘 emoji as a reaction
@@ -217,6 +221,7 @@ new Trigger({
217221
channelId: event.channel.id,
218222
});
219223
}
224+
break;
220225
}
221226
case "rating": {
222227
if (action.type != "static_select") {
@@ -244,4 +249,14 @@ new Trigger({
244249
}).listen();
245250
```
246251
252+
```json tsconfig.json
253+
{
254+
//other options
255+
"compilerOptions": {
256+
"jsx": "react-jsx"
257+
//other options
258+
}
259+
}
260+
```
261+
247262
</CodeGroup>

apps/webapp/app/routes/__app/orgs/$organizationSlug/__org/index.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,15 +184,18 @@ function WorkflowList({
184184
}
185185

186186
function lastRunDescription(lastRun: WorkflowListItem["lastRun"]) {
187-
if (lastRun === undefined) {
187+
if (lastRun === null || lastRun === undefined) {
188188
return "Never";
189189
}
190+
190191
if (lastRun.status === "SUCCESS") {
191192
if (lastRun.finishedAt) {
192193
return formatDateTime(lastRun.finishedAt);
194+
} else {
195+
return "Unknown";
193196
}
194-
throw new Error("lastRun.finishedAt is undefined");
195197
}
198+
196199
return runStatusLabel(lastRun.status);
197200
}
198201

examples/send-to-slack/src/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ new Trigger({
221221
channelId: event.channel.id,
222222
});
223223
}
224+
break;
224225
}
225226
case "status-help": {
226227
//the user needs help so add an 🆘 emoji as a reaction
@@ -231,6 +232,7 @@ new Trigger({
231232
channelId: event.channel.id,
232233
});
233234
}
235+
break;
234236
}
235237
case "rating": {
236238
if (action.type != "static_select") {

0 commit comments

Comments
 (0)