@@ -211,58 +211,49 @@ export function ActionCard({
211
211
} ) {
212
212
const { t } = useTranslation ( "settings" )
213
213
214
- const EntryOptions = useMemo ( ( ) => {
214
+ const FeedOptions = useMemo ( ( ) => {
215
215
return [
216
216
{
217
- name : t ( "actions.action_card.entry_options.all" ) ,
218
- value : "all" ,
217
+ name : t ( "actions.action_card.feed_options.subscription_view" ) ,
218
+ value : "view" ,
219
+ type : "view" ,
219
220
} ,
220
221
{
221
- name : t ( "actions.action_card.entry_options.title " ) ,
222
+ name : t ( "actions.action_card.feed_options.feed_title " ) ,
222
223
value : "title" ,
223
224
} ,
224
225
{
225
- name : t ( "actions.action_card.entry_options.content" ) ,
226
- value : "content" ,
227
- } ,
228
- {
229
- name : t ( "actions.action_card.entry_options.author" ) ,
230
- value : "author" ,
226
+ name : t ( "actions.action_card.feed_options.feed_category" ) ,
227
+ value : "category" ,
231
228
} ,
232
229
{
233
- name : t ( "actions.action_card.entry_options.url " ) ,
234
- value : "url " ,
230
+ name : t ( "actions.action_card.feed_options.site_url " ) ,
231
+ value : "site_url " ,
235
232
} ,
236
233
{
237
- name : t ( "actions.action_card.entry_options.order" ) ,
238
- value : "order" ,
239
- type : "number" ,
234
+ name : t ( "actions.action_card.feed_options.feed_url" ) ,
235
+ value : "feed_url" ,
240
236
} ,
241
- ]
242
- } , [ t ] )
243
-
244
- const FeedOptions = useMemo ( ( ) => {
245
- return [
246
237
{
247
- name : t ( "actions.action_card.feed_options.view" ) ,
248
- value : "view" ,
249
- type : "view" ,
238
+ name : t ( "actions.action_card.feed_options.entry_title" ) ,
239
+ value : "entry_title" ,
250
240
} ,
251
241
{
252
- name : t ( "actions.action_card.feed_options.title " ) ,
253
- value : "title " ,
242
+ name : t ( "actions.action_card.feed_options.entry_content " ) ,
243
+ value : "entry_content " ,
254
244
} ,
255
245
{
256
- name : t ( "actions.action_card.feed_options.category " ) ,
257
- value : "category " ,
246
+ name : t ( "actions.action_card.feed_options.entry_url " ) ,
247
+ value : "entry_url " ,
258
248
} ,
259
249
{
260
- name : t ( "actions.action_card.feed_options.site_url " ) ,
261
- value : "site_url " ,
250
+ name : t ( "actions.action_card.feed_options.entry_author " ) ,
251
+ value : "entry_author " ,
262
252
} ,
263
253
{
264
- name : t ( "actions.action_card.feed_options.feed_url" ) ,
265
- value : "feed_url" ,
254
+ name : t ( "actions.action_card.feed_options.entry_media_length" ) ,
255
+ value : "entry_media_length" ,
256
+ type : "number" ,
266
257
} ,
267
258
]
268
259
} , [ t ] )
@@ -527,6 +518,19 @@ export function ActionCard({
527
518
</ div >
528
519
< Divider />
529
520
521
+ < div className = "flex w-full items-center justify-between" >
522
+ < span className = "w-0 shrink grow truncate" > { t ( "actions.action_card.block" ) } </ span >
523
+ < Switch
524
+ disabled = { disabled }
525
+ checked = { data . result . block }
526
+ onCheckedChange = { ( checked ) => {
527
+ data . result . block = checked
528
+ onChange ( data )
529
+ } }
530
+ />
531
+ </ div >
532
+ < Divider />
533
+
530
534
< SettingCollapsible
531
535
title = { t ( "actions.action_card.rewrite_rules" ) }
532
536
onOpenChange = { ( open ) => {
@@ -609,90 +613,6 @@ export function ActionCard({
609
613
/>
610
614
</ SettingCollapsible >
611
615
< Divider />
612
- < SettingCollapsible
613
- title = { t ( "actions.action_card.block_rules" ) }
614
- onOpenChange = { ( open ) => {
615
- if ( open && ( ! data . result . blockRules || data . result . blockRules ?. length === 0 ) ) {
616
- data . result . blockRules = [ { } ]
617
- }
618
- onChange ( data )
619
- } }
620
- >
621
- { data . result . blockRules && data . result . blockRules . length > 0 && (
622
- < Table >
623
- < FieldTableHeader />
624
- < TableBody >
625
- { data . result . blockRules . map ( ( rule , index ) => {
626
- const change = ( key : string , value : string | number ) => {
627
- data . result . blockRules ! [ index ] [ key ] = value
628
- onChange ( data )
629
- }
630
- const type =
631
- EntryOptions . find ( ( option ) => option . value === rule . field ) ?. type ||
632
- "text"
633
- return (
634
- < TableRow key = { index } >
635
- < DeleteTableCell
636
- disabled = { disabled }
637
- onClick = { ( ) => {
638
- if ( data . result . blockRules ?. length === 1 ) {
639
- delete data . result . blockRules
640
- } else {
641
- data . result . blockRules ?. splice ( index , 1 )
642
- }
643
- onChange ( data )
644
- } }
645
- />
646
- < TableCell size = "sm" >
647
- < Select
648
- disabled = { disabled }
649
- value = { rule . field }
650
- onValueChange = { ( value ) => change ( "field" , value ) }
651
- >
652
- < CommonSelectTrigger />
653
- < SelectContent >
654
- { EntryOptions . map ( ( option ) => (
655
- < SelectItem key = { option . value } value = { option . value } >
656
- { option . name }
657
- </ SelectItem >
658
- ) ) }
659
- </ SelectContent >
660
- </ Select >
661
- </ TableCell >
662
- < OperationTableCell
663
- disabled = { disabled }
664
- type = { type }
665
- value = { rule . operator }
666
- onValueChange = { ( value ) => change ( "operator" , value ) }
667
- />
668
- < TableCell size = "sm" >
669
- < Input
670
- disabled = { disabled }
671
- type = { type }
672
- value = { rule . value }
673
- className = "h-8"
674
- onChange = { ( e ) => change ( "value" , e . target . value ) }
675
- />
676
- </ TableCell >
677
- </ TableRow >
678
- )
679
- } ) }
680
- </ TableBody >
681
- </ Table >
682
- ) }
683
- < AddTableRow
684
- disabled = { disabled }
685
- onClick = { ( ) => {
686
- if ( ! data . result . blockRules ) {
687
- data . result . blockRules = [ ]
688
- }
689
- data . result . blockRules ! . push ( { } )
690
- onChange ( data )
691
- } }
692
- />
693
- </ SettingCollapsible >
694
- < Divider />
695
-
696
616
< SettingCollapsible
697
617
title = { t ( "actions.action_card.webhooks" ) }
698
618
onOpenChange = { ( open ) => {
0 commit comments