From b45a614cd80cbc10f3b2fa016221430d5f8043ba Mon Sep 17 00:00:00 2001 From: ajnart Date: Mon, 10 Apr 2023 23:29:00 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=A1=20Address=20PR=20comments?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/locales/en/common.json | 1 + public/locales/en/modules/rss.json | 2 +- .../Dashboard/Tiles/Widgets/WidgetsEditModal.tsx | 4 ++-- src/pages/api/modules/rss/index.ts | 2 +- src/widgets/rss/RssWidgetTile.tsx | 9 ++++----- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 4f2e4f0ff..c62f22acf 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -10,6 +10,7 @@ "changePosition": "Change position", "remove": "Remove", "removeConfirm": "Are you sure that you want to remove {{item}}?", + "createItem": "+ create {{item}}", "sections": { "settings": "Settings", "dangerZone": "Danger zone" diff --git a/public/locales/en/modules/rss.json b/public/locales/en/modules/rss.json index 56a751750..3c50414d2 100644 --- a/public/locales/en/modules/rss.json +++ b/public/locales/en/modules/rss.json @@ -9,7 +9,7 @@ "description": "The urls of the RSS feeds you want to display from." }, "refreshInterval": { - "label": "Refresh interval (in seconds)" + "label": "Refresh interval (in minutes)" } }, "card": { diff --git a/src/components/Dashboard/Tiles/Widgets/WidgetsEditModal.tsx b/src/components/Dashboard/Tiles/Widgets/WidgetsEditModal.tsx index 805b7f805..03c2d6b34 100644 --- a/src/components/Dashboard/Tiles/Widgets/WidgetsEditModal.tsx +++ b/src/components/Dashboard/Tiles/Widgets/WidgetsEditModal.tsx @@ -247,14 +247,14 @@ const WidgetOptionTypeSwitch: FC<{ case 'multiple-text': return ( ({ value: v, label: v }))} + data={value.map((name: any) => ({ value: name, label: name }))} label={t(`descriptor.settings.${key}.label`)} description={t(`descriptor.settings.${key}.description`)} defaultValue={value as string[]} withinPortal searchable creatable - getCreateLabel={(query) => `+ Add ${query}`} + getCreateLabel={(query) => t('common:createItem', query)} onChange={(values) => handleChange( key, diff --git a/src/pages/api/modules/rss/index.ts b/src/pages/api/modules/rss/index.ts index 211e5bc37..9c4284356 100644 --- a/src/pages/api/modules/rss/index.ts +++ b/src/pages/api/modules/rss/index.ts @@ -50,7 +50,7 @@ export const Get = async (request: NextApiRequest, response: NextApiResponse) => return; } - Consola.info('Requesting RSS feed...'); + Consola.info(`Requesting RSS feed at url ${parseResult.data.feedUrl}`); const stopWatch = new Stopwatch(); const feed = await parser.parseURL(parseResult.data.feedUrl); Consola.info(`Retrieved RSS feed after ${stopWatch.getEllapsedMilliseconds()} milliseconds`); diff --git a/src/widgets/rss/RssWidgetTile.tsx b/src/widgets/rss/RssWidgetTile.tsx index d9dd597a9..132c07b81 100644 --- a/src/widgets/rss/RssWidgetTile.tsx +++ b/src/widgets/rss/RssWidgetTile.tsx @@ -33,10 +33,10 @@ const definition = defineWidget({ }, refreshInterval: { type: 'slider', - defaultValue: 60, - min: 30, + defaultValue: 30, + min: 15, max: 300, - step: 30, + step: 15, }, }, gridstack: { @@ -59,7 +59,7 @@ export const useGetRssFeeds = (feedUrls: string[], refreshInterval: number, widg queryKey: ['rss-feeds', feedUrls], // Cache the results for 24 hours cacheTime: 1000 * 60 * 60 * 24, - staleTime: 1000 * refreshInterval, + staleTime: 1000 * 60 * refreshInterval, queryFn: async () => { const responses = await Promise.all( feedUrls.map((feedUrl) => @@ -86,7 +86,6 @@ function RssTile({ widget }: RssTileProps) { try { const inputDate = dayjs(new Date(input)); const now = dayjs(); // Current date and time - // The difference between the input date and now const difference = now.diff(inputDate, 'ms'); const duration = dayjs.duration(difference, 'ms'); const humanizedDuration = duration.humanize();