mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-21 06:59:09 +00:00
expand / collapse
This commit is contained in:
@@ -37,9 +37,9 @@ export default function Info() {
|
|||||||
|
|
||||||
// Handle selection data
|
// Handle selection data
|
||||||
socket.on('selected', (data) => {
|
socket.on('selected', (data) => {
|
||||||
const formatedCurrent = `${data.index != null ? data.index + 1 : '-'}/${
|
const formatedCurrent = `Event ${
|
||||||
data.total != null ? data.total : '-'
|
data.index != null ? data.index + 1 : '-'
|
||||||
}`;
|
}/${data.total != null ? data.total : '-'}`;
|
||||||
|
|
||||||
setSelected(formatedCurrent);
|
setSelected(formatedCurrent);
|
||||||
});
|
});
|
||||||
@@ -51,6 +51,7 @@ export default function Info() {
|
|||||||
};
|
};
|
||||||
}, [socket]);
|
}, [socket]);
|
||||||
|
|
||||||
|
// TODO: Put this in use effect
|
||||||
// prepare data
|
// prepare data
|
||||||
const titlesNow = {
|
const titlesNow = {
|
||||||
title: titles.titleNow,
|
title: titles.titleNow,
|
||||||
@@ -68,10 +69,10 @@ export default function Info() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className={style.main}>{`Event ${selected}`}</div>
|
<div className={style.main}>{selected}</div>
|
||||||
|
<InfoLogger logData={logData} />
|
||||||
<InfoTitle title={'Now'} data={titlesNow} />
|
<InfoTitle title={'Now'} data={titlesNow} />
|
||||||
<InfoTitle title={'Next'} data={titlesNext} />
|
<InfoTitle title={'Next'} data={titlesNext} />
|
||||||
<InfoLogger logData={logData} />
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
border: 1px solid rgba(0, 0, 0, 0.05);
|
border: 1px solid rgba(0, 0, 0, 0.05);
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
padding: 8px;
|
padding: 8px;
|
||||||
overflow-y: scroll;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.main {
|
.main {
|
||||||
@@ -36,6 +35,11 @@ ul > li {
|
|||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.log {
|
||||||
|
overflow-y: scroll;
|
||||||
|
height: 40vh;
|
||||||
|
}
|
||||||
|
|
||||||
.info {
|
.info {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
@@ -55,9 +59,11 @@ ul > li {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.moreExpanded {
|
.moreExpanded {
|
||||||
transform: rotate(0deg);
|
transform: scaleY(-1);
|
||||||
|
transition: transform 0.3s;
|
||||||
}
|
}
|
||||||
|
|
||||||
.moreCollapsed {
|
.moreCollapsed {
|
||||||
transform: rotate(180deg);
|
transform: scaleY(1);
|
||||||
|
transition: transform 0.3s;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,30 +1,35 @@
|
|||||||
import { Icon } from '@chakra-ui/react';
|
import { Icon } from '@chakra-ui/react';
|
||||||
|
import { useState } from 'react';
|
||||||
import { FiChevronUp } from 'react-icons/fi';
|
import { FiChevronUp } from 'react-icons/fi';
|
||||||
import style from './Info.module.css';
|
import style from './Info.module.css';
|
||||||
|
|
||||||
export default function InfoLogger(props) {
|
export default function InfoLogger(props) {
|
||||||
|
const [collapsed, setCollapsed] = useState(false);
|
||||||
|
|
||||||
const { logData } = props;
|
const { logData } = props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={style.container}>
|
<div className={style.container}>
|
||||||
<div className={style.header}>
|
<div className={style.header}>
|
||||||
Log
|
Log
|
||||||
<Icon
|
<Icon
|
||||||
className={style.moreCollapsed}
|
className={collapsed ? style.moreCollapsed : style.moreExpanded}
|
||||||
as={FiChevronUp}
|
as={FiChevronUp}
|
||||||
marginTop='-0.5em'
|
onClick={() => setCollapsed((c) => !c)}
|
||||||
// onClick={() => props.setCollapsed(true)}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<ul className={style.log}>
|
{!collapsed && (
|
||||||
<li className={style.info}>10:35:23 [PLAYBACK] Next</li>
|
<ul className={style.log}>
|
||||||
<li className={style.client}>
|
<li className={style.info}>10:35:23 [PLAYBACK] Next</li>
|
||||||
10:32:10 [CLIENT] New Socket client (Total now 3)
|
<li className={style.client}>
|
||||||
</li>
|
10:32:10 [CLIENT] New socket client (total: 3)
|
||||||
<li className={style.info}>10:28:23 [PLAYBACK] Next</li>
|
</li>
|
||||||
<li className={style.info}>10:25:23 [PLAYBACK] Play</li>
|
<li className={style.info}>10:28:23 [PLAYBACK] Next</li>
|
||||||
<li className={style.info}>10:23:13 [SERVER] Server Reconnected</li>
|
<li className={style.info}>10:25:23 [PLAYBACK] Play</li>
|
||||||
<li className={style.error}>10:23:10 [SERVER] Server Disconnected</li>
|
<li className={style.info}>10:23:13 [SERVER] Server Reconnected</li>
|
||||||
</ul>
|
<li className={style.error}>10:23:10 [SERVER] Server Disconnected</li>
|
||||||
|
</ul>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,37 +1,43 @@
|
|||||||
import { Icon } from '@chakra-ui/react';
|
import { Icon } from '@chakra-ui/react';
|
||||||
|
import { useState } from 'react';
|
||||||
import { FiChevronUp } from 'react-icons/fi';
|
import { FiChevronUp } from 'react-icons/fi';
|
||||||
import style from './Info.module.css';
|
import style from './Info.module.css';
|
||||||
|
|
||||||
export default function InfoTitle(props) {
|
export default function InfoTitle(props) {
|
||||||
|
const [collapsed, setCollapsed] = useState(false);
|
||||||
|
|
||||||
const { title, data } = props;
|
const { title, data } = props;
|
||||||
return (
|
return (
|
||||||
<div className={style.container}>
|
<div className={style.container}>
|
||||||
<div className={style.header}>
|
<div className={style.header}>
|
||||||
{title}
|
{title}
|
||||||
<Icon
|
<Icon
|
||||||
className={style.moreExpanded}
|
className={collapsed ? style.moreCollapsed : style.moreExpanded}
|
||||||
as={FiChevronUp}
|
as={FiChevronUp}
|
||||||
marginTop='-0.5em'
|
onClick={() => setCollapsed((c) => !c)}
|
||||||
// onClick={() => props.setCollapsed(true)}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
{!collapsed && (
|
||||||
<span className={style.label}>Title: </span>
|
<>
|
||||||
{data.title}
|
<div>
|
||||||
</div>
|
<span className={style.label}>Title: </span>
|
||||||
<div>
|
{data.title}
|
||||||
<span className={style.label}>Subtitle: </span>
|
</div>
|
||||||
{data.subtitle}
|
<div>
|
||||||
</div>
|
<span className={style.label}>Presenter: </span>
|
||||||
<div>
|
{data.presenter}
|
||||||
<span className={style.label}>Presenter: </span>
|
</div>
|
||||||
{data.presenter}
|
<div>
|
||||||
</div>
|
<span className={style.label}>Subtitle: </span>
|
||||||
<div>
|
{data.subtitle}
|
||||||
<span className={style.label}>Notes: </span>
|
</div>
|
||||||
{data.note}
|
<div>
|
||||||
</div>
|
<span className={style.label}>Notes: </span>
|
||||||
|
{data.note}
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user