codehost 0.22.0 → 0.22.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [0.22.1](https://github.com/snomiao/codehost/compare/v0.22.0...v0.22.1) (2026-06-15)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **web:** stack the setup-card command rows on narrow screens ([4348ef7](https://github.com/snomiao/codehost/commit/4348ef72d766aba4254ecf693277a6064b06d333))
7
+
1
8
  # [0.22.0](https://github.com/snomiao/codehost/compare/v0.21.0...v0.22.0) (2026-06-14)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codehost",
3
- "version": "0.22.0",
3
+ "version": "0.22.1",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -196,9 +196,28 @@ function RoomClient(props: {
196
196
  return null;
197
197
  }
198
198
 
199
- /** A copy-to-clipboard command row: label, the command, and a Copy button. */
199
+ /** Track a `(max-width: …)` media query so inline-styled components can go
200
+ * responsive without a stylesheet. SSR-safe and listener-cleaned. */
201
+ function useNarrow(maxWidth = 560): boolean {
202
+ const [narrow, setNarrow] = useState(
203
+ () => typeof window !== "undefined" && window.matchMedia(`(max-width:${maxWidth}px)`).matches,
204
+ );
205
+ useEffect(() => {
206
+ const mq = window.matchMedia(`(max-width:${maxWidth}px)`);
207
+ const on = () => setNarrow(mq.matches);
208
+ on();
209
+ mq.addEventListener("change", on);
210
+ return () => mq.removeEventListener("change", on);
211
+ }, [maxWidth]);
212
+ return narrow;
213
+ }
214
+
215
+ /** A copy-to-clipboard command row: label, the command, and a Copy button. On
216
+ * narrow screens the three stack vertically so the long command doesn't get
217
+ * crushed between a fixed label and the button. */
200
218
  function CopyCommand({ label, command }: { label: string; command: string }) {
201
219
  const [copied, setCopied] = useState(false);
220
+ const narrow = useNarrow();
202
221
  const copy = async () => {
203
222
  try {
204
223
  await navigator.clipboard.writeText(command);
@@ -210,10 +229,10 @@ function CopyCommand({ label, command }: { label: string; command: string }) {
210
229
  setTimeout(() => setCopied(false), 1500);
211
230
  };
212
231
  return (
213
- <div style={styles.cmdRow}>
214
- <span style={styles.cmdLabel}>{label}</span>
232
+ <div style={{ ...styles.cmdRow, ...(narrow ? styles.cmdRowNarrow : null) }}>
233
+ <span style={{ ...styles.cmdLabel, ...(narrow ? styles.cmdLabelNarrow : null) }}>{label}</span>
215
234
  <code style={styles.cmdCode}>{command}</code>
216
- <button style={styles.cmdCopy} onClick={copy}>
235
+ <button style={{ ...styles.cmdCopy, ...(narrow ? styles.cmdCopyNarrow : null) }} onClick={copy}>
217
236
  {copied ? "Copied!" : "Copy"}
218
237
  </button>
219
238
  </div>
@@ -1362,9 +1381,12 @@ const styles: Record<string, React.CSSProperties> = {
1362
1381
  setupHead: { fontSize: 15, color: "#fff", fontWeight: 600, marginBottom: 6 },
1363
1382
  setupSub: { fontSize: 13, color: "#aaa", margin: "0 0 14px", lineHeight: 1.5 },
1364
1383
  cmdRow: { display: "flex", alignItems: "center", gap: 10, marginTop: 8 },
1384
+ cmdRowNarrow: { flexDirection: "column", alignItems: "stretch", gap: 6, marginTop: 12 },
1365
1385
  cmdLabel: { fontSize: 11, color: "#888", width: 88, flexShrink: 0 },
1386
+ cmdLabelNarrow: { width: "auto" },
1366
1387
  cmdCode: { flex: 1, minWidth: 0, background: "#1b1b1b", border: "1px solid #3d3d3d", borderRadius: 6, padding: "8px 10px", fontFamily: "monospace", fontSize: 12.5, color: "#dcdcaa", overflow: "auto", whiteSpace: "nowrap" },
1367
1388
  cmdCopy: { flexShrink: 0, background: "#0e639c", border: "none", color: "#fff", padding: "8px 12px", borderRadius: 6, cursor: "pointer", fontSize: 12 },
1389
+ cmdCopyNarrow: { width: "100%", padding: "10px 12px" },
1368
1390
  rosterHint: { margin: "10px 0 0", fontSize: 12, color: "#888" },
1369
1391
  personRow: { display: "flex", alignItems: "center", gap: 10, background: "#252525", border: "1px solid #3d3d3d", borderRadius: 8, padding: "8px 14px", fontSize: 13 },
1370
1392
  personDot: { color: "#4ec9b0", fontSize: 10 },