From 9a7e8450106aa5f61db9e3360221bd8ac168daf6 Mon Sep 17 00:00:00 2001 From: Yossi Hillali Date: Mon, 21 Oct 2024 13:19:34 +0300 Subject: [PATCH] feat: RTL option to RSS widget (#1247) --- packages/old-import/src/widgets/definitions/rss.ts | 1 + packages/old-import/src/widgets/options.ts | 1 + packages/translation/src/lang/en.ts | 3 +++ packages/widgets/src/rssFeed/component.tsx | 6 ++++-- packages/widgets/src/rssFeed/index.ts | 3 +++ 5 files changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/old-import/src/widgets/definitions/rss.ts b/packages/old-import/src/widgets/definitions/rss.ts index 095b6c2fc..1dbf9d560 100644 --- a/packages/old-import/src/widgets/definitions/rss.ts +++ b/packages/old-import/src/widgets/definitions/rss.ts @@ -4,6 +4,7 @@ export type OldmarrRssDefinition = CommonOldmarrWidgetDefinition< "rss", { rssFeedUrl: string[]; + enableRtl: boolean; refreshInterval: number; dangerousAllowSanitizedItemContent: boolean; textLinesClamp: number; diff --git a/packages/old-import/src/widgets/options.ts b/packages/old-import/src/widgets/options.ts index dde760af2..badf31981 100644 --- a/packages/old-import/src/widgets/options.ts +++ b/packages/old-import/src/widgets/options.ts @@ -82,6 +82,7 @@ const optionMapping: OptionMapping = { }, rssFeed: { feedUrls: (oldOptions) => oldOptions.rssFeedUrl, + enableRtl: (oldOptions) => oldOptions.enableRtl, maximumAmountPosts: (oldOptions) => oldOptions.maximumAmountOfPosts, textLinesClamp: (oldOptions) => oldOptions.textLinesClamp, }, diff --git a/packages/translation/src/lang/en.ts b/packages/translation/src/lang/en.ts index 69ed66a7a..834326730 100644 --- a/packages/translation/src/lang/en.ts +++ b/packages/translation/src/lang/en.ts @@ -1351,6 +1351,9 @@ export default { feedUrls: { label: "Feed URLs", }, + enableRtl: { + label: "Enable RTL", + }, textLinesClamp: { label: "Description line clamp", }, diff --git a/packages/widgets/src/rssFeed/component.tsx b/packages/widgets/src/rssFeed/component.tsx index eb3780149..e1ce9efc9 100644 --- a/packages/widgets/src/rssFeed/component.tsx +++ b/packages/widgets/src/rssFeed/component.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { Card, Flex, Group, Image, ScrollArea, Stack, Text } from "@mantine/core"; import { IconClock } from "@tabler/icons-react"; import dayjs from "dayjs"; @@ -37,6 +36,8 @@ export default function RssFeed({ options, itemId }: WidgetComponentProps<"rssFe }) .slice(0, options.maximumAmountPosts as number); + const languageDir = options.enableRtl ? "RTL" : "LTR"; + return ( @@ -56,12 +57,13 @@ export default function RssFeed({ options, itemId }: WidgetComponentProps<"rssFe )} - + {feedEntry.title} {feedEntry.description && (