mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-20 14:39:06 +00:00
feat: goto with osc
This commit is contained in:
@@ -14,6 +14,8 @@ import style from './EventBlock.module.css';
|
|||||||
const ExpandedBlock = (props) => {
|
const ExpandedBlock = (props) => {
|
||||||
const { provided, data, next, delay, delayValue, actionHandler } = props;
|
const { provided, data, next, delay, delayValue, actionHandler } = props;
|
||||||
|
|
||||||
|
const oscid = data.id.length > 4 ? '...' : data.id;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<span className={style.drag} {...provided.dragHandleProps}>
|
<span className={style.drag} {...provided.dragHandleProps}>
|
||||||
@@ -69,6 +71,7 @@ const ExpandedBlock = (props) => {
|
|||||||
actionHandler('update', { field: 'note', value: v })
|
actionHandler('update', { field: 'note', value: v })
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
<span className={style.oscLabel}>{`OSC ID: ${oscid}`}</span>
|
||||||
</div>
|
</div>
|
||||||
<Icon
|
<Icon
|
||||||
className={style.more}
|
className={style.more}
|
||||||
|
|||||||
@@ -138,9 +138,6 @@
|
|||||||
|
|
||||||
.titleContainer {
|
.titleContainer {
|
||||||
grid-area: text;
|
grid-area: text;
|
||||||
display: inline-flex;
|
|
||||||
position: relative;
|
|
||||||
align-self: flex-start;
|
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
|
||||||
background-color: rgba(255, 255, 255, 0.03);
|
background-color: rgba(255, 255, 255, 0.03);
|
||||||
@@ -149,6 +146,14 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.oscLabel {
|
||||||
|
color: #4bffabcc;
|
||||||
|
font-size: 0.8em;
|
||||||
|
float: right;
|
||||||
|
padding-right: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
/* ================ MORE ================ */
|
/* ================ MORE ================ */
|
||||||
|
|
||||||
.more {
|
.more {
|
||||||
|
|||||||
@@ -14,11 +14,7 @@ import {
|
|||||||
Button,
|
Button,
|
||||||
Textarea,
|
Textarea,
|
||||||
} from '@chakra-ui/react';
|
} from '@chakra-ui/react';
|
||||||
import {
|
import { fetchEvent, postEvent, eventNamespace } from '../../app/api/eventApi';
|
||||||
fetchEvent,
|
|
||||||
postEvent,
|
|
||||||
eventNamespace,
|
|
||||||
} from '../../app/api/eventApi';
|
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import { useFetch } from '../../app/hooks/useFetch';
|
import { useFetch } from '../../app/hooks/useFetch';
|
||||||
|
|
||||||
|
|||||||
@@ -424,6 +424,22 @@ class EventTimer extends Timer {
|
|||||||
this.broadcastState();
|
this.broadcastState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
loadEventById(eventId) {
|
||||||
|
let eventIndex = this._eventlist.findIndex((e) => e.id === eventId);
|
||||||
|
|
||||||
|
console.log(
|
||||||
|
eventId,
|
||||||
|
this.selectedEventId,
|
||||||
|
eventIndex === this.selectedEventId
|
||||||
|
);
|
||||||
|
|
||||||
|
if (eventIndex === -1) return;
|
||||||
|
this.pause();
|
||||||
|
this.loadEvent(eventIndex);
|
||||||
|
|
||||||
|
this.broadcastState();
|
||||||
|
}
|
||||||
|
|
||||||
// Loads a given event
|
// Loads a given event
|
||||||
// load timers
|
// load timers
|
||||||
// load selectedEvent
|
// load selectedEvent
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ const initiateOSC = (config) => {
|
|||||||
break;
|
break;
|
||||||
case 'goto':
|
case 'goto':
|
||||||
console.log('calling goto with', args);
|
console.log('calling goto with', args);
|
||||||
|
global.timer.loadEventById(args.toLowerCase());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -2,7 +2,8 @@
|
|||||||
const db = require('../app.js').db;
|
const db = require('../app.js').db;
|
||||||
|
|
||||||
// utils
|
// utils
|
||||||
const { nanoid } = require('nanoid');
|
const customAlphabet = require('nanoid').customAlphabet;
|
||||||
|
const nanoid = customAlphabet('1234567890abcdef', 4);
|
||||||
const eventDefs = require('../data/eventsDefinition.js');
|
const eventDefs = require('../data/eventsDefinition.js');
|
||||||
|
|
||||||
function _getEventsCount() {
|
function _getEventsCount() {
|
||||||
@@ -85,7 +86,7 @@ exports.eventsPost = async (req, res) => {
|
|||||||
|
|
||||||
// ensure structure
|
// ensure structure
|
||||||
let newEvent = {};
|
let newEvent = {};
|
||||||
req.body.id = nanoid(6);
|
req.body.id = nanoid();
|
||||||
|
|
||||||
switch (req.body.type) {
|
switch (req.body.type) {
|
||||||
case 'event':
|
case 'event':
|
||||||
|
|||||||
Reference in New Issue
Block a user