mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-07 16:33:51 +00:00
Feat/mac (#109)
* chore: upgrade dependencies * feat/mac: draft pipeline * feat/mac: use public folder for transient files * feat/mac: set app fullscreen * feat/mac: cmd + , toggles menu * feat/mac: update readme * refact: easier login process * refact prevent style issues with safari * refact reduce css download * style: cleanup paginator design * style: studio clock is responsive * style: fix spacing style issues with safari
This commit is contained in:
@@ -5,8 +5,8 @@ import { OSCIntegration } from './integrations/Osc.js';
|
||||
import { HTTPIntegration } from './integrations/Http.js';
|
||||
import { cleanURL } from '../utils/url.js';
|
||||
import getRandomName from '../utils/getRandomName.js';
|
||||
import { stringFromMillis } from 'ontime-utils/time.js';
|
||||
import { generateId } from 'ontime-utils/generate_id.js';
|
||||
import { generateId } from '../utils/generate_id.js';
|
||||
import { stringFromMillis } from '../utils/time.js';
|
||||
|
||||
/*
|
||||
* Class EventTimer adds functions specific to APP
|
||||
@@ -764,7 +764,7 @@ export class EventTimer extends Timer {
|
||||
const numEvents = events.length;
|
||||
|
||||
// is this the first event
|
||||
let first = this.numEvents === 0;
|
||||
const first = this.numEvents === 0;
|
||||
|
||||
// set general
|
||||
this._eventlist = events;
|
||||
@@ -822,7 +822,7 @@ export class EventTimer extends Timer {
|
||||
if (e.id === this.selectedEventId) {
|
||||
// handle reload selected
|
||||
// Reload data if running
|
||||
let type = this.selectedEventId === id && this._startedAt != null ? 'reload' : 'load';
|
||||
const type = this.selectedEventId === id && this._startedAt != null ? 'reload' : 'load';
|
||||
this.loadEvent(this.selectedEventIndex, type);
|
||||
} else if (e.id === this.nextEventId) {
|
||||
// roll needs to recalculate
|
||||
@@ -1178,7 +1178,7 @@ export class EventTimer extends Timer {
|
||||
|
||||
rollLoad() {
|
||||
const now = this._getCurrentTime();
|
||||
let prevLoaded = this.selectedEventId;
|
||||
const prevLoaded = this.selectedEventId;
|
||||
|
||||
// maybe roll has already been loaded
|
||||
if (this.secondaryTimer === null) {
|
||||
@@ -1428,7 +1428,7 @@ export class EventTimer extends Timer {
|
||||
* @param {string} message
|
||||
* @param {any} [payload]
|
||||
*/
|
||||
async sendOsc(message, payload = undefined) {
|
||||
async sendOsc(message, payload) {
|
||||
// Todo: add disabled osc check
|
||||
const reply = await this.osc.send(message, payload);
|
||||
if (!reply.success) {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { stringFromMillis } from '../utils/time.js';
|
||||
|
||||
/*
|
||||
* Timer implements simple countdown timer functions
|
||||
* User needs to use setup function to be able to use
|
||||
*
|
||||
*/
|
||||
|
||||
import { stringFromMillis } from 'ontime-utils/time.js';
|
||||
|
||||
export class Timer {
|
||||
constructor() {
|
||||
this.clock = null;
|
||||
@@ -62,11 +62,7 @@ export class Timer {
|
||||
if (this._startedAt != null) {
|
||||
// update current timer
|
||||
this.current =
|
||||
this._startedAt +
|
||||
this.duration +
|
||||
this._pausedTotal +
|
||||
this._pausedInterval -
|
||||
now;
|
||||
this._startedAt + this.duration + this._pausedTotal + this._pausedInterval - now;
|
||||
}
|
||||
|
||||
// enable flag
|
||||
@@ -114,10 +110,7 @@ export class Timer {
|
||||
if (this._finishedAt) return this._finishedAt;
|
||||
|
||||
return Math.max(
|
||||
this._startedAt +
|
||||
this.duration +
|
||||
this._pausedInterval +
|
||||
this._pausedTotal,
|
||||
this._startedAt + this.duration + this._pausedInterval + this._pausedTotal,
|
||||
this._startedAt
|
||||
);
|
||||
}
|
||||
|
||||
@@ -10,8 +10,7 @@ export const DAY_TO_MS = 86400000;
|
||||
* @param {number} end - When does the event end
|
||||
* @returns {number} normalised time
|
||||
*/
|
||||
export const normaliseEndTime = (start, end) =>
|
||||
end < start ? end + DAY_TO_MS : end;
|
||||
export const normaliseEndTime = (start, end) => (end < start ? end + DAY_TO_MS : end);
|
||||
|
||||
/**
|
||||
* @description Sorts an array of objects by given property
|
||||
@@ -34,7 +33,7 @@ export const sortArrayByProperty = (arr, property) => {
|
||||
*/
|
||||
|
||||
export const replacePlaceholder = (str, values) => {
|
||||
for (let [k, v] of Object.entries(values)) {
|
||||
for (const [k, v] of Object.entries(values)) {
|
||||
str = str.replace(k, v);
|
||||
}
|
||||
return str;
|
||||
@@ -71,10 +70,7 @@ export const getSelectionByRoll = (arr, now) => {
|
||||
|
||||
// exit early if we are past the events
|
||||
const lastEvent = orderedEvents[orderedEvents.length - 1];
|
||||
const lastNormalEnd = normaliseEndTime(
|
||||
lastEvent.timeStart,
|
||||
lastEvent.timeEnd
|
||||
);
|
||||
const lastNormalEnd = normaliseEndTime(lastEvent.timeStart, lastEvent.timeEnd);
|
||||
if (now > lastNormalEnd) {
|
||||
return {
|
||||
nowIndex,
|
||||
@@ -163,14 +159,8 @@ export const getSelectionByRoll = (arr, now) => {
|
||||
* @returns {object} object with selection variables
|
||||
*/
|
||||
export const updateRoll = (currentTimers) => {
|
||||
const {
|
||||
selectedEventId,
|
||||
current,
|
||||
_finishAt,
|
||||
clock,
|
||||
secondaryTimer,
|
||||
_secondaryTarget,
|
||||
} = currentTimers;
|
||||
const { selectedEventId, current, _finishAt, clock, secondaryTimer, _secondaryTarget } =
|
||||
currentTimers;
|
||||
|
||||
// timers
|
||||
let updatedTimer = current;
|
||||
@@ -200,8 +190,7 @@ export const updateRoll = (currentTimers) => {
|
||||
// a) we just finished an event (finished was set to true)
|
||||
// b) we need to look for events
|
||||
// this could be caused by a secondary timer or event finished
|
||||
const secondaryRunning =
|
||||
updatedSecondaryTimer <= 0 && updatedSecondaryTimer != null;
|
||||
const secondaryRunning = updatedSecondaryTimer <= 0 && updatedSecondaryTimer != null;
|
||||
|
||||
if (isFinished || secondaryRunning) {
|
||||
// look for events
|
||||
|
||||
Reference in New Issue
Block a user