Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hourglass Simplification #15323

Draft
wants to merge 21 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion test/api/unit/libs/bug-report.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ describe('bug-report', () => {
USER_HOURGLASSES: 0,
USER_ID: userId,
USER_LEVEL: 1,
USER_OFFSET_MONTHS: 0,
USER_PAYMENT_PLATFORM: undefined,
USER_SUBSCRIPTION: undefined,
USER_TIMEZONE_OFFSET: 0,
Expand Down
515 changes: 52 additions & 463 deletions test/api/unit/libs/cron.test.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@ describe('Purchasing a group plan for group', () => {
const mysteryItem = { title: 'item' };
const mysteryItems = [mysteryItem];
const consecutive = {
trinkets: 3,
trinkets: 4,
gemCapExtra: 20,
offset: 1,
count: 13,
Expand Down
523 changes: 135 additions & 388 deletions test/api/unit/libs/payments/payments.test.js

Large diffs are not rendered by default.

51 changes: 8 additions & 43 deletions test/common/libs/cron.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,16 +183,14 @@ describe('cron utility functions', () => {
});

describe('getPlanContext', () => {
const now = new Date(2022, 5, 1);

function baseUserData (count, offset, planId) {
return {
purchased: {
plan: {
consecutive: {
count,
offset,
gemCapExtra: 25,
gemCapExtra: 26,
trinkets: 19,
},
quantity: 1,
Expand All @@ -213,52 +211,19 @@ describe('cron utility functions', () => {
};
}

it('monthly plan, next date in 3 months', () => {
it('elapsedMonths is 0 if its the same month', () => {
const user = baseUserData(60, 0, 'group_plan_auto');
user.purchased.plan.perkMonthCount = 0;

const planContext = getPlanContext(user, now);

expect(planContext.nextHourglassDate)
.to.be.sameMoment('2022-08-10T02:00:00.144Z');
});

it('monthly plan, next date in 1 month', () => {
const user = baseUserData(62, 0, 'group_plan_auto');
user.purchased.plan.perkMonthCount = 2;

const planContext = getPlanContext(user, now);

expect(planContext.nextHourglassDate)
.to.be.sameMoment('2022-06-10T02:00:00.144Z');
const planContext = getPlanContext(user, new Date(2022, 4, 20));
expect(planContext.elapsedMonths).to.equal(0);
});

it('multi-month plan, no offset', () => {
const user = baseUserData(60, 0, 'basic_3mo');

const planContext = getPlanContext(user, now);

expect(planContext.nextHourglassDate)
.to.be.sameMoment('2022-06-10T02:00:00.144Z');
});

it('multi-month plan with offset', () => {
const user = baseUserData(60, 1, 'basic_3mo');

const planContext = getPlanContext(user, now);

expect(planContext.nextHourglassDate)
.to.be.sameMoment('2022-07-10T02:00:00.144Z');
});

it('multi-month plan with perk count', () => {
const user = baseUserData(60, 1, 'basic_3mo');
user.purchased.plan.perkMonthCount = 2;
it('elapsedMonths is 1 after one month', () => {
const user = baseUserData(60, 0, 'group_plan_auto');

const planContext = getPlanContext(user, now);
const planContext = getPlanContext(user, new Date(2022, 5, 11));

expect(planContext.nextHourglassDate)
.to.be.sameMoment('2022-07-10T02:00:00.144Z');
expect(planContext.elapsedMonths).to.equal(1);
});
});
});
Binary file removed website/client/src/assets/images/subscriber-food.png
Binary file not shown.
12 changes: 0 additions & 12 deletions website/client/src/assets/scss/colors.scss
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,3 @@ $gold-color: #FFA624;
$hourglass-color: #2995CD;

$purple-task: #925cf3;

.gray-200 {
color: $gray-200 !important;
}

.purple-300 {
color: $purple-300 !important;
}

.white {
color: $white !important;
}
72 changes: 72 additions & 0 deletions website/client/src/assets/scss/typography.scss
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,75 @@ h4 {
.opacity-75 {
opacity: 0.75;
}

.bg-gray-300 {
background-color: $gray-300 !important;
}

.bg-gray-600 {
background-color: $gray-600 !important;
}

.bg-gray-700 {
background-color: $gray-700 !important;
}

.bg-green-10 {
background-color: $green-10 !important;
}

.bg-white {
background-color: $white !important;
}

.gray-10 {
color: $gray-10 !important;
}

.gray-50 {
color: $gray-50 !important;
}

.gray-200 {
color: $gray-200 !important;
}

.gray-300 {
color: $gray-300 !important;
}

.green-10 {
color: $green-10 !important;
}

.maroon-50 {
color: $maroon-50 !important;
}

.purple-200 {
color: $purple-200 !important;
}

.purple-300 {
color: $purple-300 !important;
}

.purple-600 {
color: $purple-600 !important;
}

.teal-1 {
color: $teal-1 !important;
}

.teal-10 {
color: $teal-10 !important;
}

.yellow-10 {
color: $yellow-10 !important;
}

.white {
color: $white !important;
}
32 changes: 32 additions & 0 deletions website/client/src/assets/svg/divider-stars.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 4 additions & 6 deletions website/client/src/assets/svg/habitica-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading