|
| 1 | +import { css } from "../../../styled-system/css"; |
| 2 | +import { Icon } from "../icon/icon"; |
| 3 | + |
| 4 | +// The authenticate beat for clients with an explicit control — after the server is added, the client shows a |
| 5 | +// "Needs authentication" state and a glowing Connect / Authenticate button. We draw that pane: the server, the |
| 6 | +// warn cue, and the control the reader taps. (Cursor, Claude, Cline, Zed.) |
| 7 | + |
| 8 | +const frame = css({ |
| 9 | + display: "flex", |
| 10 | + flexDirection: "column", |
| 11 | + alignItems: "center", |
| 12 | + justifyContent: "center", |
| 13 | + gap: "[9px]", |
| 14 | + padding: "[26px 18px]", |
| 15 | + textAlign: "center", |
| 16 | + background: "bg.inset", |
| 17 | + minHeight: "[190px]", |
| 18 | +}); |
| 19 | + |
| 20 | +const glyph = css({ |
| 21 | + display: "inline-flex", |
| 22 | + alignItems: "center", |
| 23 | + justifyContent: "center", |
| 24 | + width: "[46px]", |
| 25 | + height: "[46px]", |
| 26 | + borderRadius: "md", |
| 27 | + background: "accent.soft", |
| 28 | + borderWidth: "hairline", |
| 29 | + borderStyle: "solid", |
| 30 | + borderColor: "accent.line", |
| 31 | + color: "accent.text", |
| 32 | + fontFamily: "mono", |
| 33 | + fontSize: "h3", |
| 34 | + fontWeight: "semibold", |
| 35 | +}); |
| 36 | + |
| 37 | +const nameClass = css({ fontSize: "body", fontWeight: "semibold", color: "text.primary" }); |
| 38 | + |
| 39 | +const urlClass = css({ |
| 40 | + display: "inline-flex", |
| 41 | + alignItems: "center", |
| 42 | + gap: "[7px]", |
| 43 | + fontFamily: "mono", |
| 44 | + fontSize: "xs", |
| 45 | + color: "text.muted", |
| 46 | +}); |
| 47 | + |
| 48 | +const statusClass = css({ |
| 49 | + display: "inline-flex", |
| 50 | + alignItems: "center", |
| 51 | + gap: "[6px]", |
| 52 | + fontSize: "sm", |
| 53 | + fontWeight: "semibold", |
| 54 | + color: "state.warn.text", |
| 55 | +}); |
| 56 | + |
| 57 | +const buttonClass = css({ |
| 58 | + display: "inline-flex", |
| 59 | + alignItems: "center", |
| 60 | + gap: "[7px]", |
| 61 | + marginTop: "[4px]", |
| 62 | + padding: "[9px 22px]", |
| 63 | + borderRadius: "md", |
| 64 | + background: "accent.base", |
| 65 | + color: "accent.fg", |
| 66 | + fontSize: "sm", |
| 67 | + fontWeight: "semibold", |
| 68 | + boxShadow: "glow", |
| 69 | +}); |
| 70 | + |
| 71 | +export interface AuthSceneProps { |
| 72 | + /** The connector's display name in the client's list. */ |
| 73 | + name: string; |
| 74 | + /** The remote URL, shown small under the name. */ |
| 75 | + url?: string; |
| 76 | + /** The client's not-yet-authed status line. */ |
| 77 | + status?: string; |
| 78 | + /** The control the reader taps — "Connect" or "Authenticate". */ |
| 79 | + button?: string; |
| 80 | +} |
| 81 | + |
| 82 | +/** The explicit-control authenticate pane — a glowing Connect / Authenticate button on a "needs auth" row. */ |
| 83 | +export function AuthScene({ |
| 84 | + name, |
| 85 | + url, |
| 86 | + status = "Needs authentication", |
| 87 | + button = "Connect", |
| 88 | +}: AuthSceneProps) { |
| 89 | + return ( |
| 90 | + <div className={frame}> |
| 91 | + <span className={glyph} aria-hidden="true"> |
| 92 | + {"{·}"} |
| 93 | + </span> |
| 94 | + <div className={nameClass}>{name}</div> |
| 95 | + {url ? ( |
| 96 | + <div className={urlClass}> |
| 97 | + {url} |
| 98 | + <Icon name="external-link" size={12} /> |
| 99 | + </div> |
| 100 | + ) : null} |
| 101 | + <div className={statusClass}> |
| 102 | + <Icon name="alert-triangle" size={13} /> |
| 103 | + {status} |
| 104 | + </div> |
| 105 | + <span className={buttonClass}> |
| 106 | + {button} |
| 107 | + <Icon name="arrow-right" size={14} /> |
| 108 | + </span> |
| 109 | + </div> |
| 110 | + ); |
| 111 | +} |
0 commit comments