Skip to content

Conversation

@gregueiras
Copy link
Contributor

Description

Users can now schedule a theme to be applied
image
In this example, from 07:20 to 17:50 the theme to be used is Monokai, otherwise the Default theme is used

Issue fixed

Issue #2534 Scheduled themes or auto day/night mode

Type of changes

  • 🔘 Bug fix (Change that fixed an issue)
  • ⚪ Breaking change (Change that can cause existing functionality to change)
  • ⚪ Improvement (Change that improves the code. Maybe performance or development improvement)
  • 🔘 Feature (Change that adds new functionality)
  • ⚪ Documentation change (Change that modifies documentation. Maybe typo fixes)

Checklist:

  • 🔘 My code follows the project code style
  • ⚪ I have written test for my code and it has been tested
  • ⚪ All existing tests have been passed
  • 🔘 I have attached a screenshot/video to visualize my change if possible

Note: I couldn't run the tests

@ZeroX-DG
Copy link
Member

Wow @gregueiras It looks amazing!

@ZeroX-DG ZeroX-DG added the awaiting review ❇️ Pull request is awaiting a review. label Nov 29, 2018
@gregueiras
Copy link
Contributor Author

@ZeroX-DG Thank you 😄

@ZeroX-DG
Copy link
Member

@gregueiras can you resolve all the conflicts?

@gregueiras
Copy link
Contributor Author

@gregueiras can you resolve all the conflicts?

I've resolved all the conflicts and changed the scheduled theme dropdown options to be the same as the default theme one.

}

/**
* Gets the total number of minutes and returns a string in the HH:MM format
Copy link
Member

Choose a reason for hiding this comment

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

Can you remove this comment since it's not relevant anymore?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've removed that comment

if (rangeSlider && rangeBullet) {
const bulletPosition = rangeSlider.value / rangeSlider.max
rangeBullet.style.left =
bulletPosition * 574 + 6 * (1 - bulletPosition) + 'px'
Copy link
Member

Choose a reason for hiding this comment

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

Can you explain to me where the value 574 come from?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We thought that we needed to set the slider position, but I tried removing it and it is working as expected, so I've removed the handleSlider function and we can just use the handleUIChange

@gregueiras gregueiras requested a review from ZeroX-DG March 5, 2020 16:40
Copy link
Member

@ZeroX-DG ZeroX-DG left a comment

Choose a reason for hiding this comment

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

Everything works fine but somehow the theme doesn't automatically change when the time is out of the range. I'm currently pretty busy so I can't investigate this. Can you help me investigate it? probably a problem that cause the interval to stop working correctly

@ZeroX-DG ZeroX-DG added awaiting changes 🖊️ Pull request has been reviewed, but contributor needs to make changes. and removed awaiting review ❇️ Pull request is awaiting a review. labels Mar 7, 2020
Comment on lines +13 to +14
const isBetweenStartAndEnd = minutes >= start && minutes < end
const isBetweenEndAndStart = minutes >= start || minutes < end
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've fixed the problem. It was just the way I was comparing the dates. If you scheduled the change to happen at 15:30, it would change only at 15:31.

@ZeroX-DG
Copy link
Member

@gregueiras it's still not working for me. I'm not quite sure what is causing it because at first the setInterval doesn't work so I removed this.refreshTheme= and it start running but it still doesn't change the theme. I was on setting page the theme didn't change, not sure if it change on main page.

@gregueiras
Copy link
Contributor Author

gregueiras commented Mar 24, 2020

Hey, sorry about the delay.

I couldn't reproduce your problem...
I thought it could be some bug regarding timezone, but even after changing it, it's still working

Peek 2020-03-24 10-20

Do you have any other idea?

@ZeroX-DG
Copy link
Member

@gregueiras The problem that I'm having is the incorrect theme from config. I added this line in your refresh theme loop.
image
And this is what been logging to the terminal
Peek 2020-03-27 11-25
Do you have any idea for what is causing this issue?

@gregueiras
Copy link
Contributor Author

gregueiras commented Mar 27, 2020

I believe I've fixed it!

Previously, I was changing the instance returned from ConfigManager, but wasn't really setting it anywhere. I've changed ThemeManager to save the changes (using ConfigManager's set), so it should work correctly now.

Let me know if it's still not working for you!

Copy link
Member

@ZeroX-DG ZeroX-DG left a comment

Choose a reason for hiding this comment

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

Very cool, works perfectly now. Thank you for this PR 👍

@ZeroX-DG ZeroX-DG added approved 👍 Pull request has been approved by sufficient reviewers. and removed awaiting changes 🖊️ Pull request has been reviewed, but contributor needs to make changes. labels Mar 31, 2020
@Rokt33r Rokt33r merged commit 0d797ce into BoostIO:master Apr 6, 2020
@Rokt33r Rokt33r added this to the v0.15.3 milestone Apr 6, 2020
@gregueiras gregueiras deleted the fixIssue2534 branch April 6, 2020 10:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved 👍 Pull request has been approved by sufficient reviewers.

3 participants