Skip to content

Commit

Permalink
Fixed: broadcasting filters
Browse files Browse the repository at this point in the history
  • Loading branch information
Rajat Saxena committed Nov 16, 2024
1 parent f3783b2 commit 7108f7e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 34 deletions.
42 changes: 9 additions & 33 deletions apps/web/components/admin/mails/broadcast-editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -402,15 +402,19 @@ function MailEditor({ id, address, dispatch, prefix }: MailEditorProps) {
};

const onFilterChange = ({
filters: inputFilters,
filters: newFilters,
aggregator,
segmentId,
count,
count: filteredCount,
}) => {
if (JSON.stringify(filters) !== JSON.stringify(inputFilters)) {
setFilters(filters);
if (
JSON.stringify(filters) !== JSON.stringify(newFilters) ||
filtersAggregator !== aggregator ||
filteredUsersCount !== filteredCount
) {
setFilters(newFilters);
setFiltersAggregator(aggregator);
setFilteredUsersCount(count);
setFilteredUsersCount(filteredCount);
}
};

Expand Down Expand Up @@ -457,17 +461,6 @@ function MailEditor({ id, address, dispatch, prefix }: MailEditorProps) {
setSubject(e.target.value)
}
/>
{/* <FormField
component="textarea"
value={content}
disabled={isPublished}
multiline="true"
rows={5}
label={MAIL_BODY_PLACEHOLDER}
onChange={(e: ChangeEvent<HTMLInputElement>) =>
setContent(e.target.value)
}
/> */}
<MailEditorAndPreview
content={content}
onChange={setContent}
Expand All @@ -489,23 +482,6 @@ function MailEditor({ id, address, dispatch, prefix }: MailEditorProps) {
setDelay(selectedDate.getTime());
}}
/>
/*
<FormField
value={
new Date(delay || new Date().getTime())
.toISOString()
.slice(0, 16)
}
type="datetime-local"
label={FORM_MAIL_SCHEDULE_TIME_LABEL}
min={new Date().toISOString().slice(0, 16)}
onChange={(e: ChangeEvent<HTMLInputElement>) => {
const selectedDate = new Date(e.target.value);
const utcDate = new Date(Date.UTC(selectedDate.getFullYear(), selectedDate.getMonth(), selectedDate.getDate(), selectedDate.getHours(), selectedDate.getMinutes()));
setDelay(utcDate.getTime());
}}
/>
*/
)}
{[
Constants.sequenceStatus[0],
Expand Down
2 changes: 1 addition & 1 deletion apps/web/components/admin/users/filter-container/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -175,13 +175,13 @@ export default function FilterContainer({
setCountLoading(true);
const response = await fetch.exec();
if (typeof response.count !== "undefined") {
setCount(response.count);
onChange({
filters: [...internalFilters],
aggregator: internalAggregator,
segmentId: activeSegment,
count: response.count,
});
setCount(response.count);
}
} catch (err) {
dispatch && dispatch(setAppMessage(new AppMessage(err.message)));
Expand Down

0 comments on commit 7108f7e

Please sign in to comment.