Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Gnito committed Nov 13, 2024
1 parent 26441b5 commit 53948b8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
13 changes: 8 additions & 5 deletions src/containers/EditListingPage/EditListingPage.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const listingTypesBookingDay = [
alias: 'default-booking/release-1',
},
unitType: 'day',
availabilityType: 'oneSeat',
},
];
const listingTypesBookingNightly = [
Expand All @@ -49,6 +50,7 @@ const listingTypesBookingNightly = [
alias: 'default-booking/release-1',
},
unitType: 'night',
availabilityType: 'oneSeat',
},
];
const listingTypesBookingHourly = [
Expand All @@ -59,6 +61,7 @@ const listingTypesBookingHourly = [
alias: 'default-booking/release-1',
},
unitType: 'hour',
availabilityType: 'oneSeat',
},
];
const listingTypesPurchase = [
Expand Down Expand Up @@ -1631,10 +1634,10 @@ describe('EditListingPage', () => {
getByRole('heading', { name: /EditListingAvailabilityPanel.WeeklyCalendar.scheduleTitle/i })
).toBeInTheDocument();

// Expect mon - sat to be available (6 days) and sunday to be blocked.
expect(queryAllByText('EditListingAvailabilityPanel.WeeklyCalendar.available')).toHaveLength(
6
);
// // Expect mon - sat to be available (6 days) and sunday to be blocked.
// expect(queryAllByText('EditListingAvailabilityPanel.WeeklyCalendar.available')).toHaveLength(
// 6
// );
const sunday = getByText('Sunday');
const cell = sunday.parentNode.parentNode;
const siblingContent = within(cell.nextElementSibling); // next cell in the grid
Expand Down Expand Up @@ -1785,7 +1788,7 @@ describe('EditListingPage', () => {
);
const sunday = getByText('Sunday');
const cellSun = sunday.parentNode.parentNode;
expect(cellSun.nextElementSibling.getElementsByClassName('availabilityDot')).toHaveLength(0);
expect(cellSun.nextElementSibling.getElementsByClassName('availabilityDot')).toHaveLength(1);

// button to add an exception
expect(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,17 +83,18 @@ const DayScheduleEntry = ({
const seats = range.seats;
const isAvailable = range.seats > 0;
const setBy = range.exception ? 'exception' : 'plan';
const startOfDay = getStartOf(range.start, 'day', timeZone);
const startOfNextDay = getStartOf(range.start, 'day', timeZone, 1, 'days');
const startsAtTheStartOfDay = isSameDate(range.start, startOfDay);
const endsAtTheEndOfDay = isSameDate(range.end, startOfNextDay);
const isFullDay = startsAtTheStartOfDay && endsAtTheEndOfDay;

if (!isAvailable && setBy === 'plan') {
if (!isAvailable && !isFullDay && setBy === 'plan') {
// Don't show blocked time-ranges, when it comes from the default schedule.
// This is mainly done to make date schedules shorter
return null;
}

const isFullDay =
isSameDate(range.start, getStartOf(range.start, 'day', timeZone)) &&
isSameDate(range.end, getStartOf(range.start, 'day', timeZone, 1, 'days'));

const ex = range.exception;
const exception = ex ? (
<ExceptionEntry
Expand Down
1 change: 1 addition & 0 deletions src/util/configHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -874,6 +874,7 @@ const validListingTypes = listingTypes => {
...restOfTransactionType,
},
// e.g. stockType
availabilityType: 'multipleSeats', // 'oneSeat', //'multipleSeats',
...restOfListingType,
},
];
Expand Down

0 comments on commit 53948b8

Please sign in to comment.