💡 Address PR comments

This commit is contained in:
ajnart
2023-04-10 23:29:00 +09:00
parent 18c84e7e1e
commit b45a614cd8
5 changed files with 9 additions and 9 deletions

View File

@@ -10,6 +10,7 @@
"changePosition": "Change position", "changePosition": "Change position",
"remove": "Remove", "remove": "Remove",
"removeConfirm": "Are you sure that you want to remove {{item}}?", "removeConfirm": "Are you sure that you want to remove {{item}}?",
"createItem": "+ create {{item}}",
"sections": { "sections": {
"settings": "Settings", "settings": "Settings",
"dangerZone": "Danger zone" "dangerZone": "Danger zone"

View File

@@ -9,7 +9,7 @@
"description": "The urls of the RSS feeds you want to display from." "description": "The urls of the RSS feeds you want to display from."
}, },
"refreshInterval": { "refreshInterval": {
"label": "Refresh interval (in seconds)" "label": "Refresh interval (in minutes)"
} }
}, },
"card": { "card": {

View File

@@ -247,14 +247,14 @@ const WidgetOptionTypeSwitch: FC<{
case 'multiple-text': case 'multiple-text':
return ( return (
<MultiSelect <MultiSelect
data={value.map((v: any) => ({ value: v, label: v }))} data={value.map((name: any) => ({ value: name, label: name }))}
label={t(`descriptor.settings.${key}.label`)} label={t(`descriptor.settings.${key}.label`)}
description={t(`descriptor.settings.${key}.description`)} description={t(`descriptor.settings.${key}.description`)}
defaultValue={value as string[]} defaultValue={value as string[]}
withinPortal withinPortal
searchable searchable
creatable creatable
getCreateLabel={(query) => `+ Add ${query}`} getCreateLabel={(query) => t('common:createItem', query)}
onChange={(values) => onChange={(values) =>
handleChange( handleChange(
key, key,

View File

@@ -50,7 +50,7 @@ export const Get = async (request: NextApiRequest, response: NextApiResponse) =>
return; return;
} }
Consola.info('Requesting RSS feed...'); Consola.info(`Requesting RSS feed at url ${parseResult.data.feedUrl}`);
const stopWatch = new Stopwatch(); const stopWatch = new Stopwatch();
const feed = await parser.parseURL(parseResult.data.feedUrl); const feed = await parser.parseURL(parseResult.data.feedUrl);
Consola.info(`Retrieved RSS feed after ${stopWatch.getEllapsedMilliseconds()} milliseconds`); Consola.info(`Retrieved RSS feed after ${stopWatch.getEllapsedMilliseconds()} milliseconds`);

View File

@@ -33,10 +33,10 @@ const definition = defineWidget({
}, },
refreshInterval: { refreshInterval: {
type: 'slider', type: 'slider',
defaultValue: 60, defaultValue: 30,
min: 30, min: 15,
max: 300, max: 300,
step: 30, step: 15,
}, },
}, },
gridstack: { gridstack: {
@@ -59,7 +59,7 @@ export const useGetRssFeeds = (feedUrls: string[], refreshInterval: number, widg
queryKey: ['rss-feeds', feedUrls], queryKey: ['rss-feeds', feedUrls],
// Cache the results for 24 hours // Cache the results for 24 hours
cacheTime: 1000 * 60 * 60 * 24, cacheTime: 1000 * 60 * 60 * 24,
staleTime: 1000 * refreshInterval, staleTime: 1000 * 60 * refreshInterval,
queryFn: async () => { queryFn: async () => {
const responses = await Promise.all( const responses = await Promise.all(
feedUrls.map((feedUrl) => feedUrls.map((feedUrl) =>
@@ -86,7 +86,6 @@ function RssTile({ widget }: RssTileProps) {
try { try {
const inputDate = dayjs(new Date(input)); const inputDate = dayjs(new Date(input));
const now = dayjs(); // Current date and time const now = dayjs(); // Current date and time
// The difference between the input date and now
const difference = now.diff(inputDate, 'ms'); const difference = now.diff(inputDate, 'ms');
const duration = dayjs.duration(difference, 'ms'); const duration = dayjs.duration(difference, 'ms');
const humanizedDuration = duration.humanize(); const humanizedDuration = duration.humanize();