chore: Review fix
This commit is contained in:
@@ -359,7 +359,7 @@ export const generateDateSuggestions = (
|
||||
const exact = directParse || parseDateFromText(englishInput, referenceDate);
|
||||
if (exact) {
|
||||
seen.add(exact.unix);
|
||||
results.push({ label: normalized, ...exact });
|
||||
results.push({ label: normalized, query: englishInput, ...exact });
|
||||
}
|
||||
|
||||
buildSuggestionCandidates(englishInput).some(candidate => {
|
||||
@@ -371,7 +371,7 @@ export const generateDateSuggestions = (
|
||||
!useEnglish && pairs.length
|
||||
? reverseTokens(candidate, pairs)
|
||||
: candidate;
|
||||
results.push({ label, ...result });
|
||||
results.push({ label, query: candidate, ...result });
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
@@ -13,7 +13,10 @@ import {
|
||||
setSeconds,
|
||||
} from 'date-fns';
|
||||
import wootConstants from 'dashboard/constants/globals';
|
||||
import { generateDateSuggestions } from 'dashboard/helper/snoozeDateParser';
|
||||
import {
|
||||
generateDateSuggestions,
|
||||
parseDateFromText,
|
||||
} from 'dashboard/helper/snoozeDateParser';
|
||||
|
||||
const SNOOZE_OPTIONS = wootConstants.SNOOZE_OPTIONS;
|
||||
|
||||
@@ -98,8 +101,10 @@ export const generateSnoozeSuggestions = (
|
||||
return suggestions.map(s => ({
|
||||
date: s.date,
|
||||
unixTime: s.unix,
|
||||
query: s.query,
|
||||
label: capitalizeLabel(s.label),
|
||||
formattedDate: formatSnoozeDate(s.date, currentDate, locale),
|
||||
resolve: () => parseDateFromText(s.query)?.unix ?? s.unix,
|
||||
}));
|
||||
};
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ import { useConversationHotKeys } from 'dashboard/composables/commands/useConver
|
||||
import wootConstants from 'dashboard/constants/globals';
|
||||
import { GENERAL_EVENTS } from 'dashboard/helper/AnalyticsHelper/events';
|
||||
import { generateSnoozeSuggestions } from 'dashboard/helper/snoozeHelpers';
|
||||
import { parseDateFromText } from 'dashboard/helper/snoozeDateParser';
|
||||
import { ICON_SNOOZE_CONVERSATION } from 'dashboard/helper/commandbar/icons';
|
||||
import {
|
||||
CMD_SNOOZE_CONVERSATION,
|
||||
@@ -108,10 +107,7 @@ const buildDynamicSnoozeActions = (search, parentId) => {
|
||||
section,
|
||||
icon: ICON_SNOOZE_CONVERSATION,
|
||||
keywords: search,
|
||||
handler: () => {
|
||||
const fresh = parseDateFromText(parsed.label.toLowerCase());
|
||||
emitter.emit(busEvent, fresh?.unix ?? parsed.unixTime);
|
||||
},
|
||||
handler: () => emitter.emit(busEvent, parsed.resolve()),
|
||||
}));
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user