Skip to content

Commit 53810ba

Browse files
committed
feat: add entry conditions for actions
1 parent febc678 commit 53810ba

File tree

23 files changed

+79
-310
lines changed

23 files changed

+79
-310
lines changed

apps/renderer/src/modules/settings/action-card.tsx

Lines changed: 35 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -211,58 +211,49 @@ export function ActionCard({
211211
}) {
212212
const { t } = useTranslation("settings")
213213

214-
const EntryOptions = useMemo(() => {
214+
const FeedOptions = useMemo(() => {
215215
return [
216216
{
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",
219220
},
220221
{
221-
name: t("actions.action_card.entry_options.title"),
222+
name: t("actions.action_card.feed_options.feed_title"),
222223
value: "title",
223224
},
224225
{
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",
231228
},
232229
{
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",
235232
},
236233
{
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",
240236
},
241-
]
242-
}, [t])
243-
244-
const FeedOptions = useMemo(() => {
245-
return [
246237
{
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",
250240
},
251241
{
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",
254244
},
255245
{
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",
258248
},
259249
{
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",
262252
},
263253
{
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",
266257
},
267258
]
268259
}, [t])
@@ -527,6 +518,19 @@ export function ActionCard({
527518
</div>
528519
<Divider />
529520

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+
530534
<SettingCollapsible
531535
title={t("actions.action_card.rewrite_rules")}
532536
onOpenChange={(open) => {
@@ -609,90 +613,6 @@ export function ActionCard({
609613
/>
610614
</SettingCollapsible>
611615
<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-
696616
<SettingCollapsible
697617
title={t("actions.action_card.webhooks")}
698618
onOpenChange={(open) => {

locales/settings/ar-DZ.json

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,8 @@
1111
"actions.action_card.block_rules": "قواعد الحظر",
1212
"actions.action_card.custom_filters": "مرشحات مخصصة",
1313
"actions.action_card.enable_readability": "تمكين الوضوح",
14-
"actions.action_card.entry_options.all": "الكل",
15-
"actions.action_card.entry_options.author": "المؤلف",
16-
"actions.action_card.entry_options.content": "المحتوى",
17-
"actions.action_card.entry_options.order": "الترتيب",
18-
"actions.action_card.entry_options.title": "العنوان",
19-
"actions.action_card.entry_options.url": "رابط URL",
20-
"actions.action_card.feed_options.category": "الفئة",
2114
"actions.action_card.feed_options.feed_url": "رابط التغذية",
2215
"actions.action_card.feed_options.site_url": "رابط الموقع",
23-
"actions.action_card.feed_options.title": "العنوان",
24-
"actions.action_card.feed_options.view": "عرض",
2516
"actions.action_card.field": "حقل",
2617
"actions.action_card.from": "من",
2718
"actions.action_card.generate_summary": "توليد ملخص باستخدام الذكاء الاصطناعي",

locales/settings/ar-IQ.json

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,8 @@
1111
"actions.action_card.block_rules": "قواعد الحظر",
1212
"actions.action_card.custom_filters": "مرشحات مخصصة",
1313
"actions.action_card.enable_readability": "تمكين الوضوح",
14-
"actions.action_card.entry_options.all": "الكل",
15-
"actions.action_card.entry_options.author": "المؤلف",
16-
"actions.action_card.entry_options.content": "المحتوى",
17-
"actions.action_card.entry_options.order": "الترتيب",
18-
"actions.action_card.entry_options.title": "العنوان",
19-
"actions.action_card.entry_options.url": "رابط URL",
20-
"actions.action_card.feed_options.category": "الفئة",
2114
"actions.action_card.feed_options.feed_url": "رابط التغذية",
2215
"actions.action_card.feed_options.site_url": "رابط الموقع",
23-
"actions.action_card.feed_options.title": "العنوان",
24-
"actions.action_card.feed_options.view": "عرض",
2516
"actions.action_card.field": "حقل",
2617
"actions.action_card.from": "من",
2718
"actions.action_card.generate_summary": "توليد ملخص باستخدام الذكاء الاصطناعي",

locales/settings/ar-KW.json

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,8 @@
1111
"actions.action_card.block_rules": "قواعد الحظر",
1212
"actions.action_card.custom_filters": "مرشحات مخصصة",
1313
"actions.action_card.enable_readability": "تمكين القراءة الواضحة",
14-
"actions.action_card.entry_options.all": "الكل",
15-
"actions.action_card.entry_options.author": "المؤلف",
16-
"actions.action_card.entry_options.content": "المحتوى",
17-
"actions.action_card.entry_options.order": "الترتيب",
18-
"actions.action_card.entry_options.title": "العنوان",
19-
"actions.action_card.entry_options.url": "رابط",
20-
"actions.action_card.feed_options.category": "الفئة",
2114
"actions.action_card.feed_options.feed_url": "رابط التغذية",
2215
"actions.action_card.feed_options.site_url": "رابط الموقع",
23-
"actions.action_card.feed_options.title": "العنوان",
24-
"actions.action_card.feed_options.view": "عرض",
2516
"actions.action_card.field": "الحقل",
2617
"actions.action_card.from": "من",
2718
"actions.action_card.generate_summary": "إنشاء ملخص باستخدام الذكاء الاصطناعي",

locales/settings/ar-MA.json

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,8 @@
1111
"actions.action_card.block_rules": "قواعد الحظر",
1212
"actions.action_card.custom_filters": "فلاتر مخصصة",
1313
"actions.action_card.enable_readability": "تشغيل القراية المريحة",
14-
"actions.action_card.entry_options.all": "الكل",
15-
"actions.action_card.entry_options.author": "المؤلف",
16-
"actions.action_card.entry_options.content": "المحتوى",
17-
"actions.action_card.entry_options.order": "الترتيب",
18-
"actions.action_card.entry_options.title": "العنوان",
19-
"actions.action_card.entry_options.url": "رابط URL",
20-
"actions.action_card.feed_options.category": "الفئة",
2114
"actions.action_card.feed_options.feed_url": "رابط التغذية",
2215
"actions.action_card.feed_options.site_url": "رابط الموقع",
23-
"actions.action_card.feed_options.title": "العنوان",
24-
"actions.action_card.feed_options.view": "عرض",
2516
"actions.action_card.field": "حقل",
2617
"actions.action_card.from": "من",
2718
"actions.action_card.generate_summary": "توليد ملخص باستخدام الذكاء الاصطناعي",

locales/settings/ar-SA.json

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,8 @@
1111
"actions.action_card.block_rules": "قواعد الحظر",
1212
"actions.action_card.custom_filters": "مرشحات مخصصة",
1313
"actions.action_card.enable_readability": "تمكين قابلية القراءة",
14-
"actions.action_card.entry_options.all": "الكل",
15-
"actions.action_card.entry_options.author": "المؤلف",
16-
"actions.action_card.entry_options.content": "المحتوى",
17-
"actions.action_card.entry_options.order": "الترتيب",
18-
"actions.action_card.entry_options.title": "العنوان",
19-
"actions.action_card.entry_options.url": "الرابط",
20-
"actions.action_card.feed_options.category": "الفئة",
2114
"actions.action_card.feed_options.feed_url": "رابط الخلاصة",
2215
"actions.action_card.feed_options.site_url": "رابط الموقع",
23-
"actions.action_card.feed_options.title": "العنوان",
24-
"actions.action_card.feed_options.view": "عرض",
2516
"actions.action_card.field": "الحقل",
2617
"actions.action_card.from": "من",
2718
"actions.action_card.generate_summary": "توليد ملخص باستخدام الذكاء الاصطناعي",

locales/settings/ar-TN.json

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,8 @@
1111
"actions.action_card.block_rules": "قواعد الحظر",
1212
"actions.action_card.custom_filters": "مرشحات مخصصة",
1313
"actions.action_card.enable_readability": "تمكين إمكانية القراءة",
14-
"actions.action_card.entry_options.all": "الكل",
15-
"actions.action_card.entry_options.author": "المؤلف",
16-
"actions.action_card.entry_options.content": "المحتوى",
17-
"actions.action_card.entry_options.order": "الترتيب",
18-
"actions.action_card.entry_options.title": "العنوان",
19-
"actions.action_card.entry_options.url": "الرابط",
20-
"actions.action_card.feed_options.category": "الفئة",
2114
"actions.action_card.feed_options.feed_url": "رابط التغذية",
2215
"actions.action_card.feed_options.site_url": "رابط الموقع",
23-
"actions.action_card.feed_options.title": "العنوان",
24-
"actions.action_card.feed_options.view": "عرض",
2516
"actions.action_card.field": "الحقل",
2617
"actions.action_card.from": "من",
2718
"actions.action_card.generate_summary": "توليد ملخص باستخدام الذكاء الاصطناعي",

locales/settings/de.json

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,8 @@
1111
"actions.action_card.block_rules": "Blockregeln",
1212
"actions.action_card.custom_filters": "Benutzerdefinierte Filter",
1313
"actions.action_card.enable_readability": "Lesbarkeit aktivieren",
14-
"actions.action_card.entry_options.all": "Alle",
15-
"actions.action_card.entry_options.author": "Autor",
16-
"actions.action_card.entry_options.content": "Inhalt",
17-
"actions.action_card.entry_options.order": "Reihenfolge",
18-
"actions.action_card.entry_options.title": "Titel",
19-
"actions.action_card.entry_options.url": "URL",
20-
"actions.action_card.feed_options.category": "Kategorie",
2114
"actions.action_card.feed_options.feed_url": "Feed-URL",
2215
"actions.action_card.feed_options.site_url": "Website-URL",
23-
"actions.action_card.feed_options.title": "Titel",
24-
"actions.action_card.feed_options.view": "Ansicht",
2516
"actions.action_card.field": "Feld",
2617
"actions.action_card.from": "Von",
2718
"actions.action_card.generate_summary": "Zusammenfassung mit KI erstellen",

locales/settings/en.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,20 @@
88
"actions.actionName": "Action {{number}}",
99
"actions.action_card.add": "Add",
1010
"actions.action_card.all": "All",
11+
"actions.action_card.block": "Block",
1112
"actions.action_card.block_rules": "Block Rules",
1213
"actions.action_card.custom_filters": "Custom filters",
1314
"actions.action_card.enable_readability": "Enable readability",
14-
"actions.action_card.entry_options.all": "All",
15-
"actions.action_card.entry_options.author": "Author",
16-
"actions.action_card.entry_options.content": "Content",
17-
"actions.action_card.entry_options.order": "Order",
18-
"actions.action_card.entry_options.title": "Title",
19-
"actions.action_card.entry_options.url": "Url",
20-
"actions.action_card.feed_options.category": "Category",
15+
"actions.action_card.feed_options.entry_author": "Entry Author",
16+
"actions.action_card.feed_options.entry_content": "Entry Content",
17+
"actions.action_card.feed_options.entry_media_length": "Entry Media Length",
18+
"actions.action_card.feed_options.entry_title": "Entry Title",
19+
"actions.action_card.feed_options.entry_url": "Entry URL",
20+
"actions.action_card.feed_options.feed_category": "Feed Category",
21+
"actions.action_card.feed_options.feed_title": "Feed Title",
2122
"actions.action_card.feed_options.feed_url": "Feed URL",
2223
"actions.action_card.feed_options.site_url": "Site URL",
23-
"actions.action_card.feed_options.title": "Title",
24-
"actions.action_card.feed_options.view": "View",
24+
"actions.action_card.feed_options.subscription_view": "Subscription View",
2525
"actions.action_card.field": "Field",
2626
"actions.action_card.from": "From",
2727
"actions.action_card.generate_summary": "Generate summary using AI",

locales/settings/es.json

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,8 @@
1111
"actions.action_card.block_rules": "Reglas de bloqueo",
1212
"actions.action_card.custom_filters": "Filtros personalizados",
1313
"actions.action_card.enable_readability": "Habilitar legibilidad",
14-
"actions.action_card.entry_options.all": "Todos",
15-
"actions.action_card.entry_options.author": "Autor",
16-
"actions.action_card.entry_options.content": "Contenido",
17-
"actions.action_card.entry_options.order": "Orden",
18-
"actions.action_card.entry_options.title": "Título",
19-
"actions.action_card.entry_options.url": "URL",
20-
"actions.action_card.feed_options.category": "Categoría",
2114
"actions.action_card.feed_options.feed_url": "URL del feed",
2215
"actions.action_card.feed_options.site_url": "URL del sitio",
23-
"actions.action_card.feed_options.title": "Título",
24-
"actions.action_card.feed_options.view": "Vista",
2516
"actions.action_card.field": "Campo",
2617
"actions.action_card.from": "Desde",
2718
"actions.action_card.generate_summary": "Generar resumen usando IA",

0 commit comments

Comments
 (0)