({
communityId,
currentUser,
currentChannel,
channels = [],
open,
close,
onSend,
uploadFiles,
progress,
uploading,
uploads,
api,
}: Props)
| 53 | } |
| 54 | |
| 55 | export default function AddThreadModal({ |
| 56 | communityId, |
| 57 | currentUser, |
| 58 | currentChannel, |
| 59 | channels = [], |
| 60 | open, |
| 61 | close, |
| 62 | onSend, |
| 63 | uploadFiles, |
| 64 | progress, |
| 65 | uploading, |
| 66 | uploads, |
| 67 | api, |
| 68 | }: Props) { |
| 69 | const [message, setMessage] = useState(''); |
| 70 | const [allUsers] = useUsersContext(); |
| 71 | const [channelId, setChannelId] = useState<string>( |
| 72 | currentChannel ? currentChannel.id : findDefaultChannel(channels)?.id |
| 73 | ); |
| 74 | const [title, setTitle] = useState<string>(''); |
| 75 | return ( |
| 76 | <Modal open={open} close={close} size="xl"> |
| 77 | <div className={styles.grid}> |
| 78 | <div className={styles.column}> |
| 79 | <div className={styles.header}> |
| 80 | <H3 className={styles.h3}>New Thread</H3> |
| 81 | </div> |
| 82 | {!currentChannel && ( |
| 83 | <Field> |
| 84 | <NativeSelect |
| 85 | id="new-thread-channel" |
| 86 | label="Channel" |
| 87 | options={channels.map((channel) => ({ |
| 88 | label: channel.channelName, |
| 89 | value: channel.id, |
| 90 | }))} |
| 91 | icon={<FiHash />} |
| 92 | theme="gray" |
| 93 | value={channelId} |
| 94 | onChange={(event: React.ChangeEvent<HTMLSelectElement>) => |
| 95 | setChannelId(event.target.value) |
| 96 | } |
| 97 | /> |
| 98 | </Field> |
| 99 | )} |
| 100 | <Field> |
| 101 | <TextInput |
| 102 | id="new-thread-title" |
| 103 | label="Title" |
| 104 | value={title} |
| 105 | onChange={(event: React.ChangeEvent<HTMLInputElement>) => |
| 106 | setTitle(event.target.value) |
| 107 | } |
| 108 | onKeyUp={(event: React.KeyboardEvent<HTMLInputElement>) => { |
| 109 | event.stopPropagation(); |
| 110 | event.preventDefault(); |
| 111 | }} |
| 112 | /> |
nothing calls this directly
no test coverage detected