2022-11-23 22:47:18 -07:00
|
|
|
import { NextComponentType } from 'next'
|
2022-11-30 17:30:52 -07:00
|
|
|
import { PlayingState } from '../types'
|
2022-11-23 22:47:18 -07:00
|
|
|
|
|
|
|
interface PromptEntryProps {
|
|
|
|
prompt: string
|
2022-11-24 19:32:39 -07:00
|
|
|
index: number
|
2022-11-24 00:23:34 -07:00
|
|
|
className: string
|
2022-11-30 17:30:52 -07:00
|
|
|
playingState: PlayingState
|
2022-11-23 22:47:18 -07:00
|
|
|
}
|
|
|
|
|
2022-11-24 13:39:30 -07:00
|
|
|
export default function PromptEntry({
|
|
|
|
prompt,
|
2022-11-24 19:32:39 -07:00
|
|
|
index,
|
2022-11-24 13:39:30 -07:00
|
|
|
className,
|
2022-11-30 17:30:52 -07:00
|
|
|
playingState,
|
|
|
|
}: PromptEntryProps) {
|
|
|
|
|
|
|
|
const getPromptCopy = (prompt: string) => {
|
|
|
|
switch (playingState) {
|
|
|
|
case PlayingState.UNINITIALIZED:
|
|
|
|
case PlayingState.SAME_PROMPT:
|
|
|
|
switch (index) {
|
|
|
|
case 0:
|
|
|
|
return prompt
|
|
|
|
case 1:
|
|
|
|
return prompt
|
|
|
|
case 2:
|
|
|
|
return prompt
|
|
|
|
case 3:
|
|
|
|
if (prompt == " " || prompt == "") {
|
|
|
|
return "..."
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return prompt
|
|
|
|
}
|
|
|
|
case 4:
|
|
|
|
if (prompt == " " || prompt == "") {
|
|
|
|
return "UP NEXT: Anything you want"
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return "UP NEXT: " + prompt
|
|
|
|
}
|
|
|
|
default: {
|
|
|
|
console.log("UNHANDLED default")
|
|
|
|
return prompt
|
|
|
|
}
|
|
|
|
}
|
|
|
|
case PlayingState.TRANSITION:
|
|
|
|
switch (index) {
|
|
|
|
case 0:
|
|
|
|
return prompt
|
|
|
|
case 1:
|
|
|
|
return prompt
|
|
|
|
case 2:
|
|
|
|
return prompt
|
|
|
|
case 3:
|
|
|
|
return prompt
|
|
|
|
case 4:
|
|
|
|
if (prompt == " " || prompt == "") {
|
|
|
|
return "..."
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return prompt
|
|
|
|
}
|
|
|
|
case 5:
|
|
|
|
if (prompt == " " || prompt == "") {
|
|
|
|
return "UP NEXT: Anything you want"
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return "UP NEXT: " + prompt
|
|
|
|
}
|
|
|
|
default: {
|
|
|
|
console.log("UNHANDLED default")
|
|
|
|
return prompt
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-11-24 13:39:30 -07:00
|
|
|
|
2022-11-23 22:47:18 -07:00
|
|
|
return (
|
2022-11-30 17:30:52 -07:00
|
|
|
<>
|
|
|
|
<p className={className}>
|
|
|
|
{getPromptCopy(prompt)}
|
|
|
|
</p>
|
|
|
|
</>
|
2022-11-23 22:47:18 -07:00
|
|
|
)
|
2022-11-30 17:30:52 -07:00
|
|
|
}
|