diff --git a/src/components/journal/ConnectDialog.tsx b/src/components/journal/ConnectDialog.tsx
index 797737a..30612ec 100644
--- a/src/components/journal/ConnectDialog.tsx
+++ b/src/components/journal/ConnectDialog.tsx
@@ -1,27 +1,84 @@
/**
- * ConnectDialog — name + role picker to join a session
+ * ConnectDialog — broker connection + session lobby (list / create / join)
+ *
+ * The broker connection and the active session are decoupled: this dialog
+ * connects to the broker, which makes the session list available, and joining
+ * or creating a session is a separate step that reuses that connection.
*/
-import { Component, createSignal, onMount, Show } from "solid-js";
+import { Component, createSignal, For, onMount, Show } from "solid-js";
import {
- connectStream,
- hydrateFromServer,
- useJournalStream,
+ connectBroker,
+ createSession,
+ joinSession,
+ resolveBrokerUrl,
+ sessions,
setMyName,
setMyRole,
- setSessionId,
+ useJournalStream,
} from "../stores/journalStream";
export const ConnectDialog: Component = () => {
const stream = useJournalStream();
+ const manifest = sessions;
const [playerName, setPlayerName] = createSignal(stream.myName);
const [role, setRole] = createSignal<"gm" | "player" | "observer">(
stream.myRole,
);
- const [connecting, setConnecting] = createSignal(false);
+ const [newSessionName, setNewSessionName] = createSignal("");
+ const [busy, setBusy] = createSignal(false);
const [error, setError] = createSignal
- 请输入你的名字和角色来加入会话。
+ 输入你的名字和角色,选择或新建一个会话。
连接到 {window.location.host}
@@ -86,7 +118,7 @@ export const ConnectDialog: Component = () => {
type="text"
value={playerName()}
onInput={(e) => setPlayerName(e.currentTarget.value)}
- onKeyDown={(e) => e.key === "Enter" && handleConnect()}
+ onKeyDown={(e) => e.key === "Enter" && handleCreate()}
placeholder="你的名字"
class="w-full border border-gray-300 rounded px-3 py-1.5 text-sm"
autofocus
@@ -106,14 +138,52 @@ export const ConnectDialog: Component = () => {
))}
会话
++ {stream.connected ? "还没有会话" : "正在加载会话…"} +
+{error()}
{error()}
-