Small fixes (#1345)

* cleanup: remove console log

* use UI Index
This commit is contained in:
Alex Christoffer Rasmussen
2024-11-30 10:11:36 +01:00
committed by GitHub
parent f561e52bb5
commit 0f5c47bc82
2 changed files with 8 additions and 9 deletions
@@ -1,7 +1,7 @@
import { KeyboardEvent, useState } from 'react'; import { KeyboardEvent, useState } from 'react';
import { Input, Modal, ModalBody, ModalContent, ModalFooter, ModalOverlay } from '@chakra-ui/react'; import { Input, Modal, ModalBody, ModalContent, ModalFooter, ModalOverlay } from '@chakra-ui/react';
import { useDebouncedCallback } from '@mantine/hooks'; import { useDebouncedCallback } from '@mantine/hooks';
import { isOntimeEvent, SupportedEvent } from 'ontime-types'; import { SupportedEvent } from 'ontime-types';
import { useEventSelection } from '../../rundown/useEventSelection'; import { useEventSelection } from '../../rundown/useEventSelection';
@@ -65,14 +65,15 @@ export default function Finder(props: FinderProps) {
{error && <li className={style.error}>{error}</li>} {error && <li className={style.error}>{error}</li>}
{results.length === 0 && <li className={style.empty}>No results</li>} {results.length === 0 && <li className={style.empty}>No results</li>}
{results.length > 0 && {results.length > 0 &&
results.map((event, index) => { results.map((entry, index) => {
const isSelected = selected === index; const isSelected = selected === index;
const displayIndex = event.type === SupportedEvent.Block ? '-' : event.index; const displayIndex = entry.type === SupportedEvent.Event ? entry.eventIndex : '-';
const colour = event.type === SupportedEvent.Event ? event.colour : ''; const displayCue = entry.type === SupportedEvent.Event ? entry.cue : '';
const colour = entry.type === SupportedEvent.Event ? entry.colour : '';
return ( return (
<li <li
key={event.id} key={entry.id}
className={style.entry} className={style.entry}
data-selected={isSelected} data-selected={isSelected}
data-index={index} data-index={index}
@@ -82,8 +83,8 @@ export default function Finder(props: FinderProps) {
<div className={style.index} style={{ '--color': colour }}> <div className={style.index} style={{ '--color': colour }}>
{displayIndex} {displayIndex}
</div> </div>
{isOntimeEvent(event) && <div className={style.cue}>{event.cue}</div>} <div className={style.cue}>{displayCue}</div>
<div className={style.title}>{event.title}</div> <div className={style.title}>{entry.title}</div>
</div> </div>
{isSelected && <span>Go </span>} {isSelected && <span>Go </span>}
</li> </li>
@@ -39,8 +39,6 @@ export const TranslationContext = createContext<TranslationContextValue>({
export const TranslationProvider = ({ children }: PropsWithChildren) => { export const TranslationProvider = ({ children }: PropsWithChildren) => {
const { data } = useSettings(); const { data } = useSettings();
console.log('....', data.language)
const getLocalizedString = useCallback( const getLocalizedString = useCallback(
(key: keyof typeof langEn, lang = data?.language || 'en'): string => { (key: keyof typeof langEn, lang = data?.language || 'en'): string => {
if (lang in translationsList) { if (lang in translationsList) {