sync: phase 1 backend + frontend from server
This commit is contained in:
@@ -16,10 +16,21 @@ interface ChannelApiResponse {
|
||||
position: number;
|
||||
}
|
||||
|
||||
const SLOWMODE_OPTIONS = [
|
||||
{ label: 'Off', value: 0 },
|
||||
{ label: '5 seconds', value: 5 },
|
||||
{ label: '10 seconds', value: 10 },
|
||||
{ label: '30 seconds', value: 30 },
|
||||
{ label: '1 minute', value: 60 },
|
||||
{ label: '2 minutes', value: 120 },
|
||||
{ label: '5 minutes', value: 300 },
|
||||
];
|
||||
|
||||
export function CreateChannelModal({ serverId, onClose }: CreateChannelModalProps) {
|
||||
const [name, setName] = useState('');
|
||||
const [type, setType] = useState<'text' | 'voice'>('text');
|
||||
const [category, setCategory] = useState('general');
|
||||
const [slowmodeSeconds, setSlowmodeSeconds] = useState(0);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
|
||||
@@ -41,10 +52,11 @@ export function CreateChannelModal({ serverId, onClose }: CreateChannelModalProp
|
||||
setLoading(true);
|
||||
setError(null);
|
||||
try {
|
||||
const result = await api.post<ChannelApiResponse>(`/servers/${serverId}/channels`, {
|
||||
const result = await api.post<ChannelApiResponse>("/servers/" + serverId + "/channels", {
|
||||
name: name.trim(),
|
||||
type,
|
||||
category: category.trim() || 'general',
|
||||
slowmode_seconds: slowmodeSeconds,
|
||||
});
|
||||
const newChannel = {
|
||||
id: result.id,
|
||||
@@ -110,6 +122,18 @@ export function CreateChannelModal({ serverId, onClose }: CreateChannelModalProp
|
||||
className="terminal-input w-full"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label className="text-xs text-gb-fg-f block mb-1">SLOWMODE:</label>
|
||||
<select
|
||||
value={slowmodeSeconds}
|
||||
onChange={(e) => setSlowmodeSeconds(parseInt(e.target.value, 10))}
|
||||
className="terminal-input w-full"
|
||||
>
|
||||
{SLOWMODE_OPTIONS.map((opt) => (
|
||||
<option key={opt.value} value={opt.value}>{opt.label}</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
{error && <div className="text-xs text-gb-red">{error}</div>}
|
||||
<button
|
||||
type="submit"
|
||||
|
||||
Reference in New Issue
Block a user