feat: add readability action rules
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
"actions.action_card.all": "All",
|
||||
"actions.action_card.block_rules": "Block Rules",
|
||||
"actions.action_card.custom_filters": "Custom filters",
|
||||
"actions.action_card.enable_readability": "Enable readability",
|
||||
"actions.action_card.entry_options.all": "All",
|
||||
"actions.action_card.entry_options.author": "Author",
|
||||
"actions.action_card.entry_options.content": "Content",
|
||||
|
||||
+16
@@ -59,6 +59,7 @@ declare const actions: drizzle_orm_pg_core.PgTableWithColumns<{
|
||||
result: {
|
||||
translation?: z.infer<typeof languageSchema>
|
||||
summary?: boolean
|
||||
readability?: boolean
|
||||
rewriteRules?: {
|
||||
from: string
|
||||
to: string
|
||||
@@ -115,6 +116,7 @@ declare const actionsItemOpenAPISchema: z.ZodObject<
|
||||
{
|
||||
translation: z.ZodOptional<z.ZodEnum<["en", "ja", "zh-CN", "zh-TW"]>>
|
||||
summary: z.ZodOptional<z.ZodBoolean>
|
||||
readability: z.ZodOptional<z.ZodBoolean>
|
||||
rewriteRules: z.ZodOptional<
|
||||
z.ZodArray<
|
||||
z.ZodObject<
|
||||
@@ -168,6 +170,7 @@ declare const actionsItemOpenAPISchema: z.ZodObject<
|
||||
{
|
||||
summary?: boolean | undefined
|
||||
translation?: "en" | "ja" | "zh-CN" | "zh-TW" | undefined
|
||||
readability?: boolean | undefined
|
||||
rewriteRules?:
|
||||
| {
|
||||
from: string
|
||||
@@ -185,6 +188,7 @@ declare const actionsItemOpenAPISchema: z.ZodObject<
|
||||
{
|
||||
summary?: boolean | undefined
|
||||
translation?: "en" | "ja" | "zh-CN" | "zh-TW" | undefined
|
||||
readability?: boolean | undefined
|
||||
rewriteRules?:
|
||||
| {
|
||||
from: string
|
||||
@@ -213,6 +217,7 @@ declare const actionsItemOpenAPISchema: z.ZodObject<
|
||||
result: {
|
||||
summary?: boolean | undefined
|
||||
translation?: "en" | "ja" | "zh-CN" | "zh-TW" | undefined
|
||||
readability?: boolean | undefined
|
||||
rewriteRules?:
|
||||
| {
|
||||
from: string
|
||||
@@ -238,6 +243,7 @@ declare const actionsItemOpenAPISchema: z.ZodObject<
|
||||
result: {
|
||||
summary?: boolean | undefined
|
||||
translation?: "en" | "ja" | "zh-CN" | "zh-TW" | undefined
|
||||
readability?: boolean | undefined
|
||||
rewriteRules?:
|
||||
| {
|
||||
from: string
|
||||
@@ -652,6 +658,7 @@ declare const actionsOpenAPISchema: z.ZodObject<
|
||||
{
|
||||
translation: z.ZodOptional<z.ZodEnum<["en", "ja", "zh-CN", "zh-TW"]>>
|
||||
summary: z.ZodOptional<z.ZodBoolean>
|
||||
readability: z.ZodOptional<z.ZodBoolean>
|
||||
rewriteRules: z.ZodOptional<
|
||||
z.ZodArray<
|
||||
z.ZodObject<
|
||||
@@ -719,6 +726,7 @@ declare const actionsOpenAPISchema: z.ZodObject<
|
||||
{
|
||||
summary?: boolean | undefined
|
||||
translation?: "en" | "ja" | "zh-CN" | "zh-TW" | undefined
|
||||
readability?: boolean | undefined
|
||||
rewriteRules?:
|
||||
| {
|
||||
from: string
|
||||
@@ -743,6 +751,7 @@ declare const actionsOpenAPISchema: z.ZodObject<
|
||||
{
|
||||
summary?: boolean | undefined
|
||||
translation?: "en" | "ja" | "zh-CN" | "zh-TW" | undefined
|
||||
readability?: boolean | undefined
|
||||
rewriteRules?:
|
||||
| {
|
||||
from: string
|
||||
@@ -778,6 +787,7 @@ declare const actionsOpenAPISchema: z.ZodObject<
|
||||
result: {
|
||||
summary?: boolean | undefined
|
||||
translation?: "en" | "ja" | "zh-CN" | "zh-TW" | undefined
|
||||
readability?: boolean | undefined
|
||||
rewriteRules?:
|
||||
| {
|
||||
from: string
|
||||
@@ -810,6 +820,7 @@ declare const actionsOpenAPISchema: z.ZodObject<
|
||||
result: {
|
||||
summary?: boolean | undefined
|
||||
translation?: "en" | "ja" | "zh-CN" | "zh-TW" | undefined
|
||||
readability?: boolean | undefined
|
||||
rewriteRules?:
|
||||
| {
|
||||
from: string
|
||||
@@ -854,6 +865,7 @@ declare const actionsOpenAPISchema: z.ZodObject<
|
||||
result: {
|
||||
summary?: boolean | undefined
|
||||
translation?: "en" | "ja" | "zh-CN" | "zh-TW" | undefined
|
||||
readability?: boolean | undefined
|
||||
rewriteRules?:
|
||||
| {
|
||||
from: string
|
||||
@@ -885,6 +897,7 @@ declare const actionsOpenAPISchema: z.ZodObject<
|
||||
result: {
|
||||
summary?: boolean | undefined
|
||||
translation?: "en" | "ja" | "zh-CN" | "zh-TW" | undefined
|
||||
readability?: boolean | undefined
|
||||
rewriteRules?:
|
||||
| {
|
||||
from: string
|
||||
@@ -5117,6 +5130,7 @@ declare const _routes: hono_hono_base.HonoBase<
|
||||
| {
|
||||
summary?: boolean | undefined
|
||||
translation?: "en" | "ja" | "zh-CN" | "zh-TW" | undefined
|
||||
readability?: boolean | undefined
|
||||
rewriteRules?:
|
||||
| {
|
||||
from: string
|
||||
@@ -5571,6 +5585,7 @@ declare const _routes: hono_hono_base.HonoBase<
|
||||
result: {
|
||||
summary?: boolean | undefined
|
||||
translation?: "en" | "ja" | "zh-CN" | "zh-TW" | undefined
|
||||
readability?: boolean | undefined
|
||||
rewriteRules?:
|
||||
| {
|
||||
from: string
|
||||
@@ -5615,6 +5630,7 @@ declare const _routes: hono_hono_base.HonoBase<
|
||||
result: {
|
||||
summary?: boolean | undefined
|
||||
translation?: "en" | "ja" | "zh-CN" | "zh-TW" | undefined
|
||||
readability?: boolean | undefined
|
||||
rewriteRules?:
|
||||
| {
|
||||
from: string
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { repository } from "@pkg"
|
||||
import {
|
||||
ReadabilityStatus,
|
||||
setReadabilityStatus,
|
||||
useEntryInReadabilityStatus,
|
||||
useEntryIsInReadability,
|
||||
useEntryReadabilityContent,
|
||||
@@ -266,6 +267,10 @@ export const EntryContentRender: Component<{ entryId: string }> = ({ entryId, cl
|
||||
</div>
|
||||
</WrappedElementProvider>
|
||||
|
||||
{entry.settings?.readability && (
|
||||
<ReadabilityAutoToggle id={entry.entries.id} url={entry.entries.url ?? ""} />
|
||||
)}
|
||||
|
||||
{!content && (
|
||||
<div className="center mt-16 min-w-0">
|
||||
{isPending ? (
|
||||
@@ -398,6 +403,9 @@ const ReadabilityAutoToggle = ({ url, id }: { url: string; id: string }) => {
|
||||
useEffect(() => {
|
||||
if (!onceRef.current) {
|
||||
onceRef.current = true
|
||||
setReadabilityStatus({
|
||||
[id]: ReadabilityStatus.INITIAL,
|
||||
})
|
||||
toggle()
|
||||
}
|
||||
}, [toggle])
|
||||
|
||||
@@ -43,6 +43,7 @@ type ActionsInput = {
|
||||
result: {
|
||||
translation?: string
|
||||
summary?: boolean
|
||||
readability?: boolean
|
||||
rewriteRules?: {
|
||||
from: string
|
||||
to: string
|
||||
@@ -446,7 +447,20 @@ export function ActionCard({
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
<Divider />
|
||||
|
||||
<div className="flex w-full items-center justify-between">
|
||||
<span className="w-0 shrink grow truncate">
|
||||
{t("actions.action_card.enable_readability")}
|
||||
</span>
|
||||
<Switch
|
||||
checked={data.result.readability}
|
||||
onCheckedChange={(checked) => {
|
||||
data.result.readability = checked
|
||||
onChange(data)
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<Divider />
|
||||
|
||||
<SettingCollapsible
|
||||
|
||||
Reference in New Issue
Block a user