Skip to content

Commit 9781c38

Browse files
authored
Merge pull request #17 from litencatt/update-modal-style
Update modal style
2 parents b346e84 + 92ecc93 commit 9781c38

File tree

1 file changed

+53
-50
lines changed

1 file changed

+53
-50
lines changed

src/slack.ts

+53-50
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,10 @@ export const searchDbView = (metaData: any, data: any[]) => {
4646
},
4747
blocks: [
4848
{
49+
type: "input",
4950
block_id: "select_db",
50-
type: "section",
51-
text: {
52-
type: "mrkdwn",
53-
text: "DB選択",
54-
},
55-
accessory: {
51+
dispatch_action: true,
52+
element: {
5653
type: "static_select",
5754
placeholder: {
5855
type: "plain_text",
@@ -62,12 +59,17 @@ export const searchDbView = (metaData: any, data: any[]) => {
6259
options: dbOptions,
6360
action_id: "select_db-action",
6461
},
62+
label: {
63+
type: "plain_text",
64+
text: "DB選択",
65+
},
6566
},
6667
],
6768
}
6869
}
6970

7071
export const searchPagesResultView = (metaData: any, urls: any[]) => {
72+
const dbId = metaData.selected_db_id.replace(/-/g, "")
7173
let view = {
7274
private_metadata: JSON.stringify(metaData),
7375
type: "modal",
@@ -82,10 +84,20 @@ export const searchPagesResultView = (metaData: any, urls: any[]) => {
8284
},
8385
blocks: [
8486
{
85-
type: "header",
87+
type: "section",
8688
text: {
87-
type: "plain_text",
88-
text: `DB: ${metaData.selected_db_name}`,
89+
type: "mrkdwn",
90+
text: `*DB: <https://www.notion.so/${dbId}|${metaData.selected_db_name}>*`,
91+
},
92+
accessory: {
93+
type: "button",
94+
text: {
95+
type: "plain_text",
96+
text: "Change database",
97+
},
98+
style: "primary",
99+
action_id: "change_db-action",
100+
value: "click_change_db",
89101
},
90102
},
91103
{
@@ -106,19 +118,10 @@ export const searchPagesResultView = (metaData: any, urls: any[]) => {
106118
type: "plain_text",
107119
text: "Clear filter",
108120
},
121+
style: "danger",
109122
action_id: "clear_filter-action",
110123
value: "click_clear_filter",
111124
},
112-
{
113-
type: "button",
114-
text: {
115-
type: "plain_text",
116-
text: "Change database",
117-
},
118-
style: "primary",
119-
action_id: "change_db-action",
120-
value: "click_change_db",
121-
},
122125
],
123126
},
124127
{
@@ -186,31 +189,31 @@ export const selectFilterPropertyView = (metaData: any, propOptions: any[]) => {
186189
},
187190
blocks: [
188191
{
189-
block_id: "selected_db",
190192
type: "section",
193+
block_id: "selected_db",
191194
text: {
192195
type: "plain_text",
193196
text: `DB: ${metaData.selected_db_name}`,
194197
emoji: true,
195198
},
196199
},
197200
{
201+
type: "input",
198202
block_id: "select_prop",
199-
type: "section",
200-
text: {
201-
type: "mrkdwn",
202-
text: "フィルター用プロパティ選択",
203-
},
204-
accessory: {
203+
dispatch_action: true,
204+
element: {
205205
type: "static_select",
206206
placeholder: {
207207
type: "plain_text",
208208
text: "Select a property",
209-
emoji: true,
210209
},
211210
options: propOptions,
212211
action_id: "select_prop-action",
213212
},
213+
label: {
214+
type: "plain_text",
215+
text: "フィルター用プロパティ選択",
216+
},
214217
},
215218
],
216219
}
@@ -235,40 +238,40 @@ export const selectFilterPropertyFieldView = (
235238
},
236239
blocks: [
237240
{
238-
block_id: "select_db",
239241
type: "section",
242+
block_id: "select_db",
240243
text: {
241244
type: "plain_text",
242245
text: `DB: ${metaData.selected_db_name}`,
243246
emoji: true,
244247
},
245248
},
246249
{
247-
block_id: "set_prop",
248250
type: "section",
251+
block_id: "set_prop",
249252
text: {
250253
type: "plain_text",
251254
text: `Property: ${selectedPropNameAndType}`,
252255
emoji: true,
253256
},
254257
},
255258
{
259+
type: "input",
256260
block_id: "select_prop_field",
257-
type: "section",
258-
text: {
259-
type: "mrkdwn",
260-
text: "フィルタープロパティのフィールド選択",
261-
},
262-
accessory: {
261+
dispatch_action: true,
262+
element: {
263263
type: "static_select",
264264
placeholder: {
265265
type: "plain_text",
266266
text: "Select a field",
267-
emoji: true,
268267
},
269268
options: filterFieldOptions,
270269
action_id: "select_prop_field-action",
271270
},
271+
label: {
272+
type: "plain_text",
273+
text: "フィルタープロパティのフィールド選択",
274+
},
272275
},
273276
],
274277
}
@@ -293,35 +296,35 @@ export const selectFilterValueInputView = (
293296
},
294297
blocks: [
295298
{
296-
block_id: "select_db",
297299
type: "section",
300+
block_id: "select_db",
298301
text: {
299302
type: "plain_text",
300303
text: `DB: ${metaData.selected_db_name}`,
301304
emoji: true,
302305
},
303306
},
304307
{
305-
block_id: "set_prop",
306308
type: "section",
309+
block_id: "set_prop",
307310
text: {
308311
type: "plain_text",
309312
text: `Property: ${selectedPropName}`,
310313
emoji: true,
311314
},
312315
},
313316
{
314-
block_id: "select_prop_field",
315317
type: "section",
318+
block_id: "select_prop_field",
316319
text: {
317320
type: "plain_text",
318321
text: `field: ${selectedPropertyField}`,
319322
emoji: true,
320323
},
321324
},
322325
{
323-
block_id: "select_prop_value_input",
324326
type: "input",
327+
block_id: "select_prop_value_input",
325328
dispatch_action: true,
326329
element: {
327330
type: "plain_text_input",
@@ -369,49 +372,49 @@ export const selectFilterValueView = (
369372
},
370373
blocks: [
371374
{
372-
block_id: "select_db",
373375
type: "section",
376+
block_id: "select_db",
374377
text: {
375378
type: "plain_text",
376379
text: `DB: ${metaData.selected_db_name}`,
377380
emoji: true,
378381
},
379382
},
380383
{
381-
block_id: "set_prop",
382384
type: "section",
385+
block_id: "set_prop",
383386
text: {
384387
type: "plain_text",
385388
text: `Property: ${selectedProp.prop_name}`,
386389
emoji: true,
387390
},
388391
},
389392
{
390-
block_id: "select_prop_field",
391393
type: "section",
394+
block_id: "select_prop_field",
392395
text: {
393396
type: "plain_text",
394397
text: `field: ${selectedProp.prop_field}`,
395398
emoji: true,
396399
},
397400
},
398401
{
402+
type: "input",
399403
block_id: "select_prop_value",
400-
type: "section",
401-
text: {
402-
type: "mrkdwn",
403-
text: "フィルター値選択",
404-
},
405-
accessory: {
404+
dispatch_action: true,
405+
element: {
406406
type: selectPropValueType,
407407
placeholder: {
408408
type: "plain_text",
409409
text: "Select a value",
410-
emoji: true,
411410
},
412411
options: selectDbPropValueOptions,
413412
action_id: selectPropValueAction,
414413
},
414+
label: {
415+
type: "plain_text",
416+
text: "フィルター値選択",
417+
},
415418
},
416419
],
417420
}

0 commit comments

Comments
 (0)