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

Added editing cycle history #95

Merged
merged 14 commits into from
Aug 24, 2023
Merged

Added editing cycle history #95

merged 14 commits into from
Aug 24, 2023

Conversation

IraSoro
Copy link
Owner

@IraSoro IraSoro commented Aug 21, 2023

Closed #87

I added an edit that is in the menu.

Editing is done by adding or deleting marked days in the calendar. You can edit only up to the possible finish day of the current cycle.

I also added a native back button for it. But it only goes to the home tab. But I think it will be enough for this version.

Screenshots here:
image
image

@IraSoro IraSoro added this to the v2.2.1 milestone Aug 21, 2023
@IraSoro IraSoro self-assigned this Aug 21, 2023
src/data/Storage.ts Outdated Show resolved Hide resolved
src/modals/EditModal.tsx Outdated Show resolved Hide resolved
src/modals/EditModal.tsx Outdated Show resolved Hide resolved
src/modals/EditModal.tsx Outdated Show resolved Hide resolved
src/modals/EditModal.tsx Outdated Show resolved Hide resolved
src/modals/EditModal.tsx Outdated Show resolved Hide resolved
src/modals/EditModal.tsx Outdated Show resolved Hide resolved
src/modals/EditModal.tsx Outdated Show resolved Hide resolved
src/modals/EditModal.tsx Outdated Show resolved Hide resolved
slot="start"
icon={createOutline}
<>
<EditModal
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a my opinion, but you don't need to create separated file with EditModal component it you'll shorten the code and separate the logic between СalculationLogic and the component

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this modal should be left in a separate file. It has a lot of calculations, large code and has its own design.
Even after moving logic calculations.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We discussed offline that you'll better to move all calc logic in the CalculationLogic file, making EditModal short enough to leave it inside Menu.tsx

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

@IraSoro
Copy link
Owner Author

IraSoro commented Aug 22, 2023

I moved the calculations in the CalculationsLogic. Also added tests for this function.

Also I added the following:
if the user marks cycles like this
image

then it counts as one cycle. After calculations and writing to the storage, it will look like this.
image

Let's leave it that way for this version.


return (
date.getTime() < lastCycleFinish.getTime() ||
date.getTime() <= nowDate.getTime()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this expression always will be truebecause any date will be lesser than now date

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, because it is a condition for all calendar dates

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Understand, then could you please rename lastCycleFinish? Because now this variable looks like last cycle until today, but you mean that this cycle the end of the next expected cycle, which is calculated for the calendar

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed

src/modals/EditModal.tsx Outdated Show resolved Hide resolved
src/tests/CalculationLogic.test.ts Show resolved Hide resolved
@IraSoro IraSoro merged commit 4c4ff17 into master Aug 24, 2023
2 checks passed
@IraSoro IraSoro deleted the 87-add-editing branch August 24, 2023 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Add cycle history editing
2 participants