Skip to content

Commit

Permalink
Extende exibição para eventos de vários dias
Browse files Browse the repository at this point in the history
  • Loading branch information
emmenezes committed Nov 4, 2024
1 parent ab76987 commit cde4084
Showing 1 changed file with 18 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,33 @@ import withQuerystringResults from './withQuerystringResults';

const groupByDate = (items) => {
return items.reduce((map, obj) => {
const key = obj.start ? parseDate(obj.start.slice(0, 10)).toString() : null;
if (key) {
if (map[key] === undefined) {
map[key] = [];
if (!obj.start) return;

Check warning on line 9 in frontend/packages/portalbrasil-intranet/src/components/Blocks/Calendario/View.jsx

View workflow job for this annotation

GitHub Actions / frontend / code-analysis

Array.prototype.reduce() expects a return value from arrow function

let start = obj.start ? parseDate(obj.start.slice(0, 10)) : null;
const end = obj.end ? parseDate(obj.end.slice(0, 10)) : start;

while (start < end) {
const key = start.toString();

Check failure on line 15 in frontend/packages/portalbrasil-intranet/src/components/Blocks/Calendario/View.jsx

View workflow job for this annotation

GitHub Actions / frontend / code-analysis

Delete `·`

if (key) {
if (map[key] === undefined) {
map[key] = [];
}
map[key].push(obj);
}
map[key].push(obj);

start = start.add({days: 1})

Check failure on line 24 in frontend/packages/portalbrasil-intranet/src/components/Blocks/Calendario/View.jsx

View workflow job for this annotation

GitHub Actions / frontend / code-analysis

Replace `days:·1})` with `·days:·1·});`
}
return map;

Check failure on line 26 in frontend/packages/portalbrasil-intranet/src/components/Blocks/Calendario/View.jsx

View workflow job for this annotation

GitHub Actions / frontend / code-analysis

Delete `⏎····⏎`


}, {});
};

const CalendarioBlockView = withQuerystringResults((props) => {
const { data, isEditMode, path, pathname, className, listingItems } = props;
const items = listingItems ? groupByDate(listingItems) : {};

Check failure on line 35 in frontend/packages/portalbrasil-intranet/src/components/Blocks/Calendario/View.jsx

View workflow job for this annotation

GitHub Actions / frontend / code-analysis

Delete `··`
return (
<CalendarioView
data={data}
Expand Down

0 comments on commit cde4084

Please sign in to comment.