Small fixes

This commit is contained in:
crschnick 2024-10-02 14:35:03 +00:00
parent 09d7d6d0e7
commit a97fd10e9c
2 changed files with 8 additions and 2 deletions

View file

@ -127,11 +127,13 @@ public class AppLayoutModel {
// null) // null)
)); ));
var now = Instant.now();
var zone = ZoneId.of(ZoneId.SHORT_IDS.get("PST")); var zone = ZoneId.of(ZoneId.SHORT_IDS.get("PST"));
var now = Instant.now();
var phStart = ZonedDateTime.of(2024, 10, 22, 0, 1, 0, 0, zone).toInstant(); var phStart = ZonedDateTime.of(2024, 10, 22, 0, 1, 0, 0, zone).toInstant();
var phEnd = ZonedDateTime.of(2024, 10, 29, 0, 1, 0, 0, zone).toInstant();
var clicked = AppCache.get("phClicked",Boolean.class,() -> false); var clicked = AppCache.get("phClicked",Boolean.class,() -> false);
var phShow = now.isAfter(phStart) && !clicked; var phShow = now.isAfter(phStart) && now.isBefore(phEnd) && !clicked;
if (phShow) { if (phShow) {
l.add(new Entry( l.add(new Entry(
new SimpleStringProperty("Product Hunt"), new SimpleStringProperty("Product Hunt"),

View file

@ -43,6 +43,10 @@ public class ContextMenuHelper {
public static void toggleShow(ContextMenu contextMenu, Node ref, Side side) { public static void toggleShow(ContextMenu contextMenu, Node ref, Side side) {
if (!contextMenu.isShowing()) { if (!contextMenu.isShowing()) {
// Prevent NPE in show()
if (contextMenu.getScene() == null || ref == null || ref.getScene() == null) {
return;
}
contextMenu.show(ref, side, 0, 0); contextMenu.show(ref, side, 0, 0);
} else { } else {
contextMenu.hide(); contextMenu.hide();