mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-22 15:39:11 +00:00
feat: end message
- set end message in settings
This commit is contained in:
@@ -110,26 +110,6 @@ export default function AppSettingsModal() {
|
|||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<FormControl id='endMessage'>
|
|
||||||
<FormLabel htmlFor='endMessage'>
|
|
||||||
End Message
|
|
||||||
<span className={style.notes}>
|
|
||||||
Message shown in timer when time is finished
|
|
||||||
</span>
|
|
||||||
</FormLabel>
|
|
||||||
<Input
|
|
||||||
size='sm'
|
|
||||||
name='endMessage'
|
|
||||||
placeholder='Time Out'
|
|
||||||
autoComplete='off'
|
|
||||||
value={'TIME UP'}
|
|
||||||
onChange={(event) => {
|
|
||||||
// Nothing here yet
|
|
||||||
}}
|
|
||||||
isDisabled={true}
|
|
||||||
/>
|
|
||||||
</FormControl>
|
|
||||||
</>
|
</>
|
||||||
<Button
|
<Button
|
||||||
colorScheme='blue'
|
colorScheme='blue'
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ export default function SettingsModal() {
|
|||||||
url: '',
|
url: '',
|
||||||
publicInfo: '',
|
publicInfo: '',
|
||||||
backstageInfo: '',
|
backstageInfo: '',
|
||||||
|
endMessage: '',
|
||||||
});
|
});
|
||||||
const [changed, setChanged] = useState(false);
|
const [changed, setChanged] = useState(false);
|
||||||
const [submitting, setSubmitting] = useState(false);
|
const [submitting, setSubmitting] = useState(false);
|
||||||
@@ -31,9 +32,12 @@ export default function SettingsModal() {
|
|||||||
url: data.url,
|
url: data.url,
|
||||||
publicInfo: data.publicInfo,
|
publicInfo: data.publicInfo,
|
||||||
backstageInfo: data.backstageInfo,
|
backstageInfo: data.backstageInfo,
|
||||||
|
endMessage: data.endMessage,
|
||||||
});
|
});
|
||||||
}, [data]);
|
}, [data]);
|
||||||
|
|
||||||
|
console.log(`formData.endMessage`, formData.endMessage);
|
||||||
|
|
||||||
const submitHandler = async (event) => {
|
const submitHandler = async (event) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
setSubmitting(true);
|
setSubmitting(true);
|
||||||
@@ -60,6 +64,7 @@ export default function SettingsModal() {
|
|||||||
<FormLabel htmlFor='title'>Event Title</FormLabel>
|
<FormLabel htmlFor='title'>Event Title</FormLabel>
|
||||||
<Input
|
<Input
|
||||||
size='sm'
|
size='sm'
|
||||||
|
maxLength={35}
|
||||||
name='title'
|
name='title'
|
||||||
placeholder='Event Title'
|
placeholder='Event Title'
|
||||||
autoComplete='off'
|
autoComplete='off'
|
||||||
@@ -131,6 +136,31 @@ export default function SettingsModal() {
|
|||||||
isDisabled={submitting}
|
isDisabled={submitting}
|
||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
|
<FormControl id='endMessage'>
|
||||||
|
<FormLabel htmlFor='endMessage'>
|
||||||
|
End Message
|
||||||
|
<span className={style.notes}>
|
||||||
|
Shown on presenter view when time is finished
|
||||||
|
</span>
|
||||||
|
</FormLabel>
|
||||||
|
<Input
|
||||||
|
size='sm'
|
||||||
|
maxLength={30}
|
||||||
|
name='endMessage'
|
||||||
|
placeholder='Empty message shows elapsed time'
|
||||||
|
autoComplete='off'
|
||||||
|
value={formData.endMessage}
|
||||||
|
onChange={(event) => {
|
||||||
|
setChanged(true);
|
||||||
|
setFormData({
|
||||||
|
...formData,
|
||||||
|
endMessage: event.target.value,
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
isDisabled={submitting}
|
||||||
|
/>
|
||||||
|
</FormControl>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ const withSocket = (Component) => {
|
|||||||
url: '',
|
url: '',
|
||||||
publicInfo: '',
|
publicInfo: '',
|
||||||
backstageInfo: '',
|
backstageInfo: '',
|
||||||
|
endMessage: '',
|
||||||
});
|
});
|
||||||
const [playback, setPlayback] = useState(null);
|
const [playback, setPlayback] = useState(null);
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import TitleCard from 'common/components/views/TitleCard';
|
|||||||
import style from './PresenterView.module.css';
|
import style from './PresenterView.module.css';
|
||||||
|
|
||||||
export default function PresenterView(props) {
|
export default function PresenterView(props) {
|
||||||
const { pres, title, time } = props;
|
const { general, pres, title, time } = props;
|
||||||
|
|
||||||
// Set window title
|
// Set window title
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -18,6 +18,14 @@ export default function PresenterView(props) {
|
|||||||
const isPlaying = time.playstate !== 'pause';
|
const isPlaying = time.playstate !== 'pause';
|
||||||
const normalisedTime = Math.max(time.running, 0);
|
const normalisedTime = Math.max(time.running, 0);
|
||||||
|
|
||||||
|
// show timer if end message is empty
|
||||||
|
const endMessage =
|
||||||
|
general.endMessage == null || general.endMessage === '' ? (
|
||||||
|
<Countdown time={time.running} hideZeroHours negative />
|
||||||
|
) : (
|
||||||
|
general.endMessage
|
||||||
|
);
|
||||||
|
|
||||||
// motion
|
// motion
|
||||||
const titleVariants = {
|
const titleVariants = {
|
||||||
hidden: {
|
hidden: {
|
||||||
@@ -57,7 +65,7 @@ export default function PresenterView(props) {
|
|||||||
|
|
||||||
<div className={style.timerContainer}>
|
<div className={style.timerContainer}>
|
||||||
{time.finished ? (
|
{time.finished ? (
|
||||||
<div className={style.finished}>TIME UP</div>
|
<div className={style.finished}>{endMessage}</div>
|
||||||
) : (
|
) : (
|
||||||
<div className={isPlaying ? style.countdown : style.countdownPaused}>
|
<div className={isPlaying ? style.countdown : style.countdownPaused}>
|
||||||
<Countdown time={normalisedTime} hideZeroHours />
|
<Countdown time={normalisedTime} hideZeroHours />
|
||||||
|
|||||||
@@ -66,7 +66,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.finished {
|
.finished {
|
||||||
font-size: 18vw;
|
text-align: center;
|
||||||
|
font-size: 12vw;
|
||||||
line-height: 18vw;
|
line-height: 18vw;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
color: #ff6969;
|
color: #ff6969;
|
||||||
|
|||||||
Reference in New Issue
Block a user