Author SHA1 Message Date
sneak 38d222f6a7 Merge branch 'main' into fix/irc-numeric-replies
check / check (push) Successful in 57s
2026-03-09 22:12:43 +01:00
clawbotanduser 8e3166969e Redesign SPA to look like a proper IRC client (closes #50) (#53)
check / check (push) Successful in 6s
## Summary

Complete UI overhaul of the embedded web SPA to look and feel like a proper IRC client.

## Changes

### Layout & Structure
- **Tab bar** at top with channel/DM/server tabs and unread indicators
- **Topic bar** below tabs for channel windows
- **Messages panel** with classic IRC message formatting
- **User list** on right side for channels with @/+/regular prefixes
- **Persistent input line** at bottom with IRC-style prompt `[nick] #channel >`

### IRC Commands
Full command support in the input line:
- `/join #channel` — Join a channel
- `/part [reason]` — Part the current channel
- `/msg nick message` — Send a private message
- `/me action` — Send a CTCP ACTION
- `/nick newnick` — Change nickname
- `/topic [text]` — View or set channel topic
- `/mode +/-flags` — Set channel modes
- `/quit [reason]` — Disconnect
- `/help` — Show available commands

### Message Display
- Messages on the **same line** as the nick: `[HH:MM:SS] <nick> message text`
- System messages: `[HH:MM:SS] * alice has parted #channel (reason)`
- Actions: `[HH:MM:SS] * alice waves hello`
- IRC vocabulary throughout ("parted" not "left", etc.)

### User List
- Right-side panel showing channel members
- Sorted by mode: `@operators` first, then `+voiced`, then regular users
- Click to open DM
- Parses RPL_NAMREPLY (353) for mode prefixes when available

### Other
- Input history with up/down arrow keys
- Dark theme with monospace font (classic IRC aesthetic)
- CTCP ACTION support (`/me`)
- RPL_TOPIC (332) parsing for server-sent topics
- Responsive: user list hidden on narrow screens

closes #50

Co-authored-by: user <user@Mac.lan guest wan>
Reviewed-on: sneak/chat#53
Co-authored-by: clawbot <clawbot@noreply.example.org>
Co-committed-by: clawbot <clawbot@noreply.example.org>
2026-03-09 22:12:34 +01:00
user 8d91ad852c Replace HTTP status codes with IRC numeric replies in command handlers (closes #54)
check / check (push) Successful in 2m17s
IRC command handlers now return proper IRC numeric reply codes per
RFC 1459/2812 instead of HTTP status codes:

- 401 ERR_NOSUCHNICK for unknown DM targets
- 403 ERR_NOSUCHCHANNEL for invalid/missing channels
- 411 ERR_NORECIPIENT for missing message recipients
- 412 ERR_NOTEXTTOSEND for missing message body
- 421 ERR_UNKNOWNCOMMAND for unknown/empty commands
- 431 ERR_NONICKNAMEGIVEN for missing nick in NICK command
- 432 ERR_ERRONEUSNICKNAME for invalid nick format
- 433 ERR_NICKNAMEINUSE for taken nicks
- 442 ERR_NOTONCHANNEL for non-member channel actions
- 461 ERR_NEEDMOREPARAMS for missing required parameters

Error responses use the IRC numeric format:
  {"command":"4xx","from":"server","to":"nick","body":["..."],"params":[...]}

HTTP status codes are now reserved for transport-level concerns:
- 400 for malformed HTTP requests (bad JSON)
- 401 for authentication failures
- 500 for internal server errors

Successful message sends changed from 201 to 200 since HTTP
status codes should not encode IRC-level semantics.
2026-03-08 01:16:04 -08:00
6 changed files with 1243 additions and 960 deletions

No files matched your search

+116 -58
View File
@@ -28,6 +28,18 @@ const (
defaultHistLimit = 50 defaultHistLimit = 50
maxHistLimit = 500 maxHistLimit = 500
cmdPrivmsg = "PRIVMSG" cmdPrivmsg = "PRIVMSG"
// IRC numeric reply codes per RFC 1459/2812.
ircErrNoSuchNick = "401"
ircErrNoSuchChannel = "403"
ircErrNoRecipient = "411"
ircErrNoTextToSend = "412"
ircErrUnknownCommand = "421"
ircErrNoNicknameGiven = "431"
ircErrErroneusNickname = "432"
ircErrNicknameInUse = "433"
ircErrNotOnChannel = "442"
ircErrNeedMoreParams = "461"
) )
func (hdlr *Handlers) maxBodySize() int64 { func (hdlr *Handlers) maxBodySize() int64 {
@@ -63,6 +75,43 @@ func (hdlr *Handlers) authSession(
return sessionID, clientID, nick, nil return sessionID, clientID, nick, nil
} }
// serverName returns the configured server name or the
// default "neoirc".
func (hdlr *Handlers) serverName() string {
if hdlr.params.Config.ServerName != "" {
return hdlr.params.Config.ServerName
}
return "neoirc"
}
// respondIRCError sends an IRC numeric error reply as a
// JSON response with HTTP 200 OK. This is used for errors
// in IRC command processing (as opposed to HTTP transport
// errors). The params slice contains IRC-style positional
// parameters (e.g. the target nick or channel).
func (hdlr *Handlers) respondIRCError(
writer http.ResponseWriter,
request *http.Request,
nick, numeric, msg string,
params ...string,
) {
resp := map[string]any{
"command": numeric,
"from": hdlr.serverName(),
"to": nick,
"body": []string{msg},
}
if len(params) > 0 {
resp["params"] = params
}
hdlr.respondJSON(
writer, request, resp, http.StatusOK,
)
}
func (hdlr *Handlers) requireAuth( func (hdlr *Handlers) requireAuth(
writer http.ResponseWriter, writer http.ResponseWriter,
request *http.Request, request *http.Request,
@@ -226,11 +275,7 @@ func (hdlr *Handlers) deliverMOTD(
clientID, sessionID int64, clientID, sessionID int64,
) { ) {
motd := hdlr.params.Config.MOTD motd := hdlr.params.Config.MOTD
serverName := hdlr.params.Config.ServerName serverName := hdlr.serverName()
if serverName == "" {
serverName = "neoirc"
}
if motd == "" { if motd == "" {
return return
@@ -557,10 +602,10 @@ func (hdlr *Handlers) HandleSendCommand() http.HandlerFunc {
payload.To = strings.TrimSpace(payload.To) payload.To = strings.TrimSpace(payload.To)
if payload.Command == "" { if payload.Command == "" {
hdlr.respondError( hdlr.respondIRCError(
writer, request, writer, request,
"command required", nick, ircErrUnknownCommand,
http.StatusBadRequest, "No command given",
) )
return return
@@ -631,10 +676,11 @@ func (hdlr *Handlers) dispatchCommand(
}, },
http.StatusOK) http.StatusOK)
default: default:
hdlr.respondError( hdlr.respondIRCError(
writer, request, writer, request,
"unknown command: "+command, nick, ircErrUnknownCommand,
http.StatusBadRequest, command+" :Unknown command",
command,
) )
} }
} }
@@ -648,10 +694,10 @@ func (hdlr *Handlers) handlePrivmsg(
bodyLines func() []string, bodyLines func() []string,
) { ) {
if target == "" { if target == "" {
hdlr.respondError( hdlr.respondIRCError(
writer, request, writer, request,
"to field required", nick, ircErrNoRecipient,
http.StatusBadRequest, "No recipient given ("+command+")",
) )
return return
@@ -659,10 +705,10 @@ func (hdlr *Handlers) handlePrivmsg(
lines := bodyLines() lines := bodyLines()
if len(lines) == 0 { if len(lines) == 0 {
hdlr.respondError( hdlr.respondIRCError(
writer, request, writer, request,
"body required", nick, ircErrNoTextToSend,
http.StatusBadRequest, "No text to send",
) )
return return
@@ -694,10 +740,11 @@ func (hdlr *Handlers) handleChannelMsg(
request.Context(), target, request.Context(), target,
) )
if err != nil { if err != nil {
hdlr.respondError( hdlr.respondIRCError(
writer, request, writer, request,
"channel not found", nick, ircErrNoSuchChannel,
http.StatusNotFound, "No such channel",
target,
) )
return return
@@ -720,10 +767,11 @@ func (hdlr *Handlers) handleChannelMsg(
} }
if !isMember { if !isMember {
hdlr.respondError( hdlr.respondIRCError(
writer, request, writer, request,
"not a member of this channel", nick, ircErrNotOnChannel,
http.StatusForbidden, "You're not on that channel",
target,
) )
return return
@@ -761,7 +809,7 @@ func (hdlr *Handlers) handleChannelMsg(
hdlr.respondJSON(writer, request, hdlr.respondJSON(writer, request,
map[string]string{"id": msgUUID, "status": "sent"}, map[string]string{"id": msgUUID, "status": "sent"},
http.StatusCreated) http.StatusOK)
} }
func (hdlr *Handlers) handleDirectMsg( func (hdlr *Handlers) handleDirectMsg(
@@ -775,10 +823,11 @@ func (hdlr *Handlers) handleDirectMsg(
request.Context(), target, request.Context(), target,
) )
if err != nil { if err != nil {
hdlr.respondError( hdlr.respondIRCError(
writer, request, writer, request,
"user not found", nick, ircErrNoSuchNick,
http.StatusNotFound, "No such nick/channel",
target,
) )
return return
@@ -805,7 +854,7 @@ func (hdlr *Handlers) handleDirectMsg(
hdlr.respondJSON(writer, request, hdlr.respondJSON(writer, request,
map[string]string{"id": msgUUID, "status": "sent"}, map[string]string{"id": msgUUID, "status": "sent"},
http.StatusCreated) http.StatusOK)
} }
func (hdlr *Handlers) handleJoin( func (hdlr *Handlers) handleJoin(
@@ -815,10 +864,11 @@ func (hdlr *Handlers) handleJoin(
nick, target string, nick, target string,
) { ) {
if target == "" { if target == "" {
hdlr.respondError( hdlr.respondIRCError(
writer, request, writer, request,
"to field required", nick, ircErrNeedMoreParams,
http.StatusBadRequest, "Not enough parameters",
"JOIN",
) )
return return
@@ -830,10 +880,11 @@ func (hdlr *Handlers) handleJoin(
} }
if !validChannelRe.MatchString(channel) { if !validChannelRe.MatchString(channel) {
hdlr.respondError( hdlr.respondIRCError(
writer, request, writer, request,
"invalid channel name", nick, ircErrNoSuchChannel,
http.StatusBadRequest, "No such channel",
channel,
) )
return return
@@ -895,10 +946,11 @@ func (hdlr *Handlers) handlePart(
body json.RawMessage, body json.RawMessage,
) { ) {
if target == "" { if target == "" {
hdlr.respondError( hdlr.respondIRCError(
writer, request, writer, request,
"to field required", nick, ircErrNeedMoreParams,
http.StatusBadRequest, "Not enough parameters",
"PART",
) )
return return
@@ -913,10 +965,11 @@ func (hdlr *Handlers) handlePart(
request.Context(), channel, request.Context(), channel,
) )
if err != nil { if err != nil {
hdlr.respondError( hdlr.respondIRCError(
writer, request, writer, request,
"channel not found", nick, ircErrNoSuchChannel,
http.StatusNotFound, "No such channel",
channel,
) )
return return
@@ -967,10 +1020,10 @@ func (hdlr *Handlers) handleNick(
) { ) {
lines := bodyLines() lines := bodyLines()
if len(lines) == 0 { if len(lines) == 0 {
hdlr.respondError( hdlr.respondIRCError(
writer, request, writer, request,
"body required (new nick)", nick, ircErrNoNicknameGiven,
http.StatusBadRequest, "No nickname given",
) )
return return
@@ -979,10 +1032,11 @@ func (hdlr *Handlers) handleNick(
newNick := strings.TrimSpace(lines[0]) newNick := strings.TrimSpace(lines[0])
if !validNickRe.MatchString(newNick) { if !validNickRe.MatchString(newNick) {
hdlr.respondError( hdlr.respondIRCError(
writer, request, writer, request,
"invalid nick", nick, ircErrErroneusNickname,
http.StatusBadRequest, "Erroneous nickname",
newNick,
) )
return return
@@ -1003,10 +1057,11 @@ func (hdlr *Handlers) handleNick(
) )
if err != nil { if err != nil {
if strings.Contains(err.Error(), "UNIQUE") { if strings.Contains(err.Error(), "UNIQUE") {
hdlr.respondError( hdlr.respondIRCError(
writer, request, writer, request,
"nick already in use", nick, ircErrNicknameInUse,
http.StatusConflict, "Nickname is already in use",
newNick,
) )
return return
@@ -1093,10 +1148,11 @@ func (hdlr *Handlers) handleTopic(
bodyLines func() []string, bodyLines func() []string,
) { ) {
if target == "" { if target == "" {
hdlr.respondError( hdlr.respondIRCError(
writer, request, writer, request,
"to field required", nick, ircErrNeedMoreParams,
http.StatusBadRequest, "Not enough parameters",
"TOPIC",
) )
return return
@@ -1104,10 +1160,11 @@ func (hdlr *Handlers) handleTopic(
lines := bodyLines() lines := bodyLines()
if len(lines) == 0 { if len(lines) == 0 {
hdlr.respondError( hdlr.respondIRCError(
writer, request, writer, request,
"body required (topic text)", nick, ircErrNeedMoreParams,
http.StatusBadRequest, "Not enough parameters",
"TOPIC",
) )
return return
@@ -1140,10 +1197,11 @@ func (hdlr *Handlers) handleTopic(
request.Context(), channel, request.Context(), channel,
) )
if err != nil { if err != nil {
hdlr.respondError( hdlr.respondIRCError(
writer, request, writer, request,
"channel not found", nick, ircErrNoSuchChannel,
http.StatusNotFound, "No such channel",
channel,
) )
return return
+124 -40
View File
@@ -668,11 +668,18 @@ func TestJoinMissingTo(t *testing.T) {
tserver := newTestServer(t) tserver := newTestServer(t)
token := tserver.createSession("joiner3") token := tserver.createSession("joiner3")
status, _ := tserver.sendCommand( status, result := tserver.sendCommand(
token, map[string]any{commandKey: joinCmd}, token, map[string]any{commandKey: joinCmd},
) )
if status != http.StatusBadRequest { if status != http.StatusOK {
t.Fatalf("expected 400, got %d", status) t.Fatalf("expected 200, got %d", status)
}
if result[commandKey] != "461" {
t.Fatalf(
"expected IRC 461, got %v",
result[commandKey],
)
} }
} }
@@ -699,9 +706,9 @@ func TestChannelMessage(t *testing.T) {
bodyKey: []string{"hello world"}, bodyKey: []string{"hello world"},
}, },
) )
if status != http.StatusCreated { if status != http.StatusOK {
t.Fatalf( t.Fatalf(
"expected 201, got %d: %v", status, result, "expected 200, got %d: %v", status, result,
) )
} }
@@ -728,11 +735,18 @@ func TestMessageMissingBody(t *testing.T) {
commandKey: joinCmd, toKey: "#test", commandKey: joinCmd, toKey: "#test",
}) })
status, _ := tserver.sendCommand(token, map[string]any{ status, result := tserver.sendCommand(token, map[string]any{
commandKey: privmsgCmd, toKey: "#test", commandKey: privmsgCmd, toKey: "#test",
}) })
if status != http.StatusBadRequest { if status != http.StatusOK {
t.Fatalf("expected 400, got %d", status) t.Fatalf("expected 200, got %d", status)
}
if result[commandKey] != "412" {
t.Fatalf(
"expected IRC 412, got %v",
result[commandKey],
)
} }
} }
@@ -740,12 +754,19 @@ func TestMessageMissingTo(t *testing.T) {
tserver := newTestServer(t) tserver := newTestServer(t)
token := tserver.createSession("noto") token := tserver.createSession("noto")
status, _ := tserver.sendCommand(token, map[string]any{ status, result := tserver.sendCommand(token, map[string]any{
commandKey: privmsgCmd, commandKey: privmsgCmd,
bodyKey: []string{"hello"}, bodyKey: []string{"hello"},
}) })
if status != http.StatusBadRequest { if status != http.StatusOK {
t.Fatalf("expected 400, got %d", status) t.Fatalf("expected 200, got %d", status)
}
if result[commandKey] != "411" {
t.Fatalf(
"expected IRC 411, got %v",
result[commandKey],
)
} }
} }
@@ -760,7 +781,7 @@ func TestNonMemberCannotSend(t *testing.T) {
}) })
// Alice tries to send without joining. // Alice tries to send without joining.
status, _ := tserver.sendCommand( status, result := tserver.sendCommand(
aliceToken, aliceToken,
map[string]any{ map[string]any{
commandKey: privmsgCmd, commandKey: privmsgCmd,
@@ -768,8 +789,15 @@ func TestNonMemberCannotSend(t *testing.T) {
bodyKey: []string{"sneaky"}, bodyKey: []string{"sneaky"},
}, },
) )
if status != http.StatusForbidden { if status != http.StatusOK {
t.Fatalf("expected 403, got %d", status) t.Fatalf("expected 200, got %d", status)
}
if result[commandKey] != "442" {
t.Fatalf(
"expected IRC 442, got %v",
result[commandKey],
)
} }
} }
@@ -786,9 +814,9 @@ func TestDirectMessage(t *testing.T) {
bodyKey: []string{"hey bob"}, bodyKey: []string{"hey bob"},
}, },
) )
if status != http.StatusCreated { if status != http.StatusOK {
t.Fatalf( t.Fatalf(
"expected 201, got %d: %v", status, result, "expected 200, got %d: %v", status, result,
) )
} }
@@ -818,13 +846,20 @@ func TestDMToNonexistentUser(t *testing.T) {
tserver := newTestServer(t) tserver := newTestServer(t)
token := tserver.createSession("dmsender") token := tserver.createSession("dmsender")
status, _ := tserver.sendCommand(token, map[string]any{ status, result := tserver.sendCommand(token, map[string]any{
commandKey: privmsgCmd, commandKey: privmsgCmd,
toKey: "nobody", toKey: "nobody",
bodyKey: []string{"hello?"}, bodyKey: []string{"hello?"},
}) })
if status != http.StatusNotFound { if status != http.StatusOK {
t.Fatalf("expected 404, got %d", status) t.Fatalf("expected 200, got %d", status)
}
if result[commandKey] != "401" {
t.Fatalf(
"expected IRC 401, got %v",
result[commandKey],
)
} }
} }
@@ -871,12 +906,19 @@ func TestNickCollision(t *testing.T) {
tserver.createSession("taken_nick") tserver.createSession("taken_nick")
status, _ := tserver.sendCommand(token, map[string]any{ status, result := tserver.sendCommand(token, map[string]any{
commandKey: "NICK", commandKey: "NICK",
bodyKey: []string{"taken_nick"}, bodyKey: []string{"taken_nick"},
}) })
if status != http.StatusConflict { if status != http.StatusOK {
t.Fatalf("expected 409, got %d", status) t.Fatalf("expected 200, got %d", status)
}
if result[commandKey] != "433" {
t.Fatalf(
"expected IRC 433, got %v",
result[commandKey],
)
} }
} }
@@ -884,12 +926,19 @@ func TestNickInvalid(t *testing.T) {
tserver := newTestServer(t) tserver := newTestServer(t)
token := tserver.createSession("nickval") token := tserver.createSession("nickval")
status, _ := tserver.sendCommand(token, map[string]any{ status, result := tserver.sendCommand(token, map[string]any{
commandKey: "NICK", commandKey: "NICK",
bodyKey: []string{"bad nick!"}, bodyKey: []string{"bad nick!"},
}) })
if status != http.StatusBadRequest { if status != http.StatusOK {
t.Fatalf("expected 400, got %d", status) t.Fatalf("expected 200, got %d", status)
}
if result[commandKey] != "432" {
t.Fatalf(
"expected IRC 432, got %v",
result[commandKey],
)
} }
} }
@@ -897,11 +946,18 @@ func TestNickEmptyBody(t *testing.T) {
tserver := newTestServer(t) tserver := newTestServer(t)
token := tserver.createSession("nicknobody") token := tserver.createSession("nicknobody")
status, _ := tserver.sendCommand( status, result := tserver.sendCommand(
token, map[string]any{commandKey: "NICK"}, token, map[string]any{commandKey: "NICK"},
) )
if status != http.StatusBadRequest { if status != http.StatusOK {
t.Fatalf("expected 400, got %d", status) t.Fatalf("expected 200, got %d", status)
}
if result[commandKey] != "431" {
t.Fatalf(
"expected IRC 431, got %v",
result[commandKey],
)
} }
} }
@@ -938,12 +994,19 @@ func TestTopicMissingTo(t *testing.T) {
tserver := newTestServer(t) tserver := newTestServer(t)
token := tserver.createSession("topicnoto") token := tserver.createSession("topicnoto")
status, _ := tserver.sendCommand(token, map[string]any{ status, result := tserver.sendCommand(token, map[string]any{
commandKey: "TOPIC", commandKey: "TOPIC",
bodyKey: []string{"topic"}, bodyKey: []string{"topic"},
}) })
if status != http.StatusBadRequest { if status != http.StatusOK {
t.Fatalf("expected 400, got %d", status) t.Fatalf("expected 200, got %d", status)
}
if result[commandKey] != "461" {
t.Fatalf(
"expected IRC 461, got %v",
result[commandKey],
)
} }
} }
@@ -955,11 +1018,18 @@ func TestTopicMissingBody(t *testing.T) {
commandKey: joinCmd, toKey: "#topictest", commandKey: joinCmd, toKey: "#topictest",
}) })
status, _ := tserver.sendCommand(token, map[string]any{ status, result := tserver.sendCommand(token, map[string]any{
commandKey: "TOPIC", toKey: "#topictest", commandKey: "TOPIC", toKey: "#topictest",
}) })
if status != http.StatusBadRequest { if status != http.StatusOK {
t.Fatalf("expected 400, got %d", status) t.Fatalf("expected 200, got %d", status)
}
if result[commandKey] != "461" {
t.Fatalf(
"expected IRC 461, got %v",
result[commandKey],
)
} }
} }
@@ -1027,11 +1097,18 @@ func TestUnknownCommand(t *testing.T) {
tserver := newTestServer(t) tserver := newTestServer(t)
token := tserver.createSession("cmdtest") token := tserver.createSession("cmdtest")
status, _ := tserver.sendCommand( status, result := tserver.sendCommand(
token, map[string]any{commandKey: "BOGUS"}, token, map[string]any{commandKey: "BOGUS"},
) )
if status != http.StatusBadRequest { if status != http.StatusOK {
t.Fatalf("expected 400, got %d", status) t.Fatalf("expected 200, got %d", status)
}
if result[commandKey] != "421" {
t.Fatalf(
"expected IRC 421, got %v",
result[commandKey],
)
} }
} }
@@ -1039,11 +1116,18 @@ func TestEmptyCommand(t *testing.T) {
tserver := newTestServer(t) tserver := newTestServer(t)
token := tserver.createSession("emptycmd") token := tserver.createSession("emptycmd")
status, _ := tserver.sendCommand( status, result := tserver.sendCommand(
token, map[string]any{commandKey: ""}, token, map[string]any{commandKey: ""},
) )
if status != http.StatusBadRequest { if status != http.StatusOK {
t.Fatalf("expected 400, got %d", status) t.Fatalf("expected 200, got %d", status)
}
if result[commandKey] != "421" {
t.Fatalf(
"expected IRC 421, got %v",
result[commandKey],
)
} }
} }
+2 -2
View File
@@ -1,2 +1,2 @@
var ae,S,He,ht,K,Ae,Re,De,Le,he,de,pe,yt,X={},je=[],vt=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,_e=Array.isArray;function J(e,t){for(var n in t)e[n]=t[n];return e}function ye(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function y(e,t,n){var r,a,s,c={};for(s in t)s=="key"?r=t[s]:s=="ref"?a=t[s]:c[s]=t[s];if(arguments.length>2&&(c.children=arguments.length>3?ae.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(s in e.defaultProps)c[s]===void 0&&(c[s]=e.defaultProps[s]);return oe(e,c,r,a,null)}function oe(e,t,n,r,a){var s={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:a??++He,__i:-1,__u:0};return a==null&&S.vnode!=null&&S.vnode(s),s}function ce(e){return e.children}function re(e,t){this.props=e,this.context=t}function Q(e,t){if(t==null)return e.__?Q(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?Q(e):null}function We(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=e.__c.base=n.__e;break}return We(e)}}function Oe(e){(!e.__d&&(e.__d=!0)&&K.push(e)&&!se.__r++||Ae!=S.debounceRendering)&&((Ae=S.debounceRendering)||Re)(se)}function se(){for(var e,t,n,r,a,s,c,u=1;K.length;)K.length>u&&K.sort(De),e=K.shift(),u=K.length,e.__d&&(n=void 0,r=void 0,a=(r=(t=e).__v).__e,s=[],c=[],t.__P&&((n=J({},r)).__v=r.__v+1,S.vnode&&S.vnode(n),ve(t.__P,n,r,t.__n,t.__P.namespaceURI,32&r.__u?[a]:null,s,a??Q(r),!!(32&r.__u),c),n.__v=r.__v,n.__.__k[n.__i]=n,Be(s,n,c),r.__e=r.__=null,n.__e!=a&&We(n)));se.__r=0}function Fe(e,t,n,r,a,s,c,u,v,l,b){var _,m,h,T,A,x,g,k=r&&r.__k||je,O=t.length;for(v=bt(n,t,k,v,O),_=0;_<O;_++)(h=n.__k[_])!=null&&(m=h.__i==-1?X:k[h.__i]||X,h.__i=_,x=ve(e,h,m,a,s,c,u,v,l,b),T=h.__e,h.ref&&m.ref!=h.ref&&(m.ref&&be(m.ref,null,h),b.push(h.ref,h.__c||T,h)),A==null&&T!=null&&(A=T),(g=!!(4&h.__u))||m.__k===h.__k?v=Je(h,v,e,g):typeof h.type=="function"&&x!==void 0?v=x:T&&(v=T.nextSibling),h.__u&=-7);return n.__e=A,v}function bt(e,t,n,r,a){var s,c,u,v,l,b=n.length,_=b,m=0;for(e.__k=new Array(a),s=0;s<a;s++)(c=t[s])!=null&&typeof c!="boolean"&&typeof c!="function"?(typeof c=="string"||typeof c=="number"||typeof c=="bigint"||c.constructor==String?c=e.__k[s]=oe(null,c,null,null,null):_e(c)?c=e.__k[s]=oe(ce,{children:c},null,null,null):c.constructor===void 0&&c.__b>0?c=e.__k[s]=oe(c.type,c.props,c.key,c.ref?c.ref:null,c.__v):e.__k[s]=c,v=s+m,c.__=e,c.__b=e.__b+1,u=null,(l=c.__i=kt(c,n,v,_))!=-1&&(_--,(u=n[l])&&(u.__u|=2)),u==null||u.__v==null?(l==-1&&(a>b?m--:a<b&&m++),typeof c.type!="function"&&(c.__u|=4)):l!=v&&(l==v-1?m--:l==v+1?m++:(l>v?m--:m++,c.__u|=4))):e.__k[s]=null;if(_)for(s=0;s<b;s++)(u=n[s])!=null&&(2&u.__u)==0&&(u.__e==r&&(r=Q(u)),qe(u,u));return r}function Je(e,t,n,r){var a,s;if(typeof e.type=="function"){for(a=e.__k,s=0;a&&s<a.length;s++)a[s]&&(a[s].__=e,t=Je(a[s],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=Q(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function kt(e,t,n,r){var a,s,c,u=e.key,v=e.type,l=t[n],b=l!=null&&(2&l.__u)==0;if(l===null&&u==null||b&&u==l.key&&v==l.type)return n;if(r>(b?1:0)){for(a=n-1,s=n+1;a>=0||s<t.length;)if((l=t[c=a>=0?a--:s++])!=null&&(2&l.__u)==0&&u==l.key&&v==l.type)return c}return-1}function $e(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||vt.test(t)?n:n+"px"}function ne(e,t,n,r,a){var s,c;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||$e(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||$e(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")s=t!=(t=t.replace(Le,"$1")),c=t.toLowerCase(),t=c in e||t=="onFocusOut"||t=="onFocusIn"?c.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+s]=n,n?r?n.u=r.u:(n.u=he,e.addEventListener(t,s?pe:de,s)):e.removeEventListener(t,s?pe:de,s);else{if(a=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function Ue(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t.t==null)t.t=he++;else if(t.t<n.u)return;return n(S.event?S.event(t):t)}}}function ve(e,t,n,r,a,s,c,u,v,l){var b,_,m,h,T,A,x,g,k,O,j,V,H,te,B,R,q,$=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(v=!!(32&n.__u),s=[u=t.__e=n.__e]),(b=S.__b)&&b(t);e:if(typeof $=="function")try{if(g=t.props,k="prototype"in $&&$.prototype.render,O=(b=$.contextType)&&r[b.__c],j=b?O?O.props.value:b.__:r,n.__c?x=(_=t.__c=n.__c).__=_.__E:(k?t.__c=_=new $(g,j):(t.__c=_=new re(g,j),_.constructor=$,_.render=St),O&&O.sub(_),_.state||(_.state={}),_.__n=r,m=_Line truncated var ie,w,Ue,pt,K,Ee,He,Re,De,he,de,pe,mt,Z={},Le=[],ht=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,ce=Array.isArray;function W(e,t){for(var n in t)e[n]=t[n];return e}function ye(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function p(e,t,n){var o,a,s,c={};for(s in t)s=="key"?o=t[s]:s=="ref"?a=t[s]:c[s]=t[s];if(arguments.length>2&&(c.children=arguments.length>3?ie.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(s in e.defaultProps)c[s]===void 0&&(c[s]=e.defaultProps[s]);return oe(e,c,o,a,null)}function oe(e,t,n,o,a){var s={type:e,props:t,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:a??++Ue,__i:-1,__u:0};return a==null&&w.vnode!=null&&w.vnode(s),s}function _e(e){return e.children}function se(e,t){this.props=e,this.context=t}function Y(e,t){if(t==null)return e.__?Y(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?Y(e):null}function Fe(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=e.__c.base=n.__e;break}return Fe(e)}}function Me(e){(!e.__d&&(e.__d=!0)&&K.push(e)&&!ae.__r++||Ee!=w.debounceRendering)&&((Ee=w.debounceRendering)||He)(ae)}function ae(){for(var e,t,n,o,a,s,c,_=1;K.length;)K.length>_&&K.sort(Re),e=K.shift(),_=K.length,e.__d&&(n=void 0,o=void 0,a=(o=(t=e).__v).__e,s=[],c=[],t.__P&&((n=W({},o)).__v=o.__v+1,w.vnode&&w.vnode(n),ve(t.__P,n,o,t.__n,t.__P.namespaceURI,32&o.__u?[a]:null,s,a??Y(o),!!(32&o.__u),c),n.__v=o.__v,n.__.__k[n.__i]=n,Je(s,n,c),o.__e=o.__=null,n.__e!=a&&Fe(n)));ae.__r=0}function We(e,t,n,o,a,s,c,_,h,u,b){var i,m,y,C,M,I,k,g=o&&o.__k||Le,U=t.length;for(h=yt(n,t,g,h,U),i=0;i<U;i++)(y=n.__k[i])!=null&&(m=y.__i==-1?Z:g[y.__i]||Z,y.__i=i,I=ve(e,y,m,a,s,c,_,h,u,b),C=y.__e,y.ref&&m.ref!=y.ref&&(m.ref&&be(m.ref,null,y),b.push(y.ref,y.__c||C,y)),M==null&&C!=null&&(M=C),(k=!!(4&y.__u))||m.__k===y.__k?h=je(y,h,e,k):typeof y.type=="function"&&I!==void 0?h=I:C&&(h=C.nextSibling),y.__u&=-7);return n.__e=M,h}function yt(e,t,n,o,a){var s,c,_,h,u,b=n.length,i=b,m=0;for(e.__k=new Array(a),s=0;s<a;s++)(c=t[s])!=null&&typeof c!="boolean"&&typeof c!="function"?(typeof c=="string"||typeof c=="number"||typeof c=="bigint"||c.constructor==String?c=e.__k[s]=oe(null,c,null,null,null):ce(c)?c=e.__k[s]=oe(_e,{children:c},null,null,null):c.constructor===void 0&&c.__b>0?c=e.__k[s]=oe(c.type,c.props,c.key,c.ref?c.ref:null,c.__v):e.__k[s]=c,h=s+m,c.__=e,c.__b=e.__b+1,_=null,(u=c.__i=vt(c,n,h,i))!=-1&&(i--,(_=n[u])&&(_.__u|=2)),_==null||_.__v==null?(u==-1&&(a>b?m--:a<b&&m++),typeof c.type!="function"&&(c.__u|=4)):u!=h&&(u==h-1?m--:u==h+1?m++:(u>h?m--:m++,c.__u|=4))):e.__k[s]=null;if(i)for(s=0;s<b;s++)(_=n[s])!=null&&(2&_.__u)==0&&(_.__e==o&&(o=Y(_)),Be(_,_));return o}function je(e,t,n,o){var a,s;if(typeof e.type=="function"){for(a=e.__k,s=0;a&&s<a.length;s++)a[s]&&(a[s].__=e,t=je(a[s],t,n,o));return t}e.__e!=t&&(o&&(t&&e.type&&!t.parentNode&&(t=Y(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function vt(e,t,n,o){var a,s,c,_=e.key,h=e.type,u=t[n],b=u!=null&&(2&u.__u)==0;if(u===null&&_==null||b&&_==u.key&&h==u.type)return n;if(o>(b?1:0)){for(a=n-1,s=n+1;a>=0||s<t.length;)if((u=t[c=a>=0?a--:s++])!=null&&(2&u.__u)==0&&_==u.key&&h==u.type)return c}return-1}function Oe(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||ht.test(t)?n:n+"px"}function re(e,t,n,o,a){var s,c;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof o=="string"&&(e.style.cssText=o=""),o)for(t in o)n&&t in n||Oe(e.style,t,"");if(n)for(t in n)o&&n[t]==o[t]||Oe(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")s=t!=(t=t.replace(De,"$1")),c=t.toLowerCase(),t=c in e||t=="onFocusOut"||t=="onFocusIn"?c.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+s]=n,n?o?n.u=o.u:(n.u=he,e.addEventListener(t,s?pe:de,s)):e.removeEventListener(t,s?pe:de,s);else{if(a=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function $e(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t.t==null)t.t=he++;else if(t.t<n.u)return;return n(w.event?w.event(t):t)}}}function ve(e,t,n,o,a,s,c,_,h,u){var b,i,m,y,C,M,I,k,g,U,O,z,R,B,j,J,Q,P=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(h=!!(32&n.__u),s=[_=t.__e=n.__e]),(b=w.__b)&&b(t);e:if(typeof P=="function")try{if(k=t.props,g="prototype"in P&&P.prototype.render,U=(b=P.contextType)&&o[b.__c],O=b?U?U.props.value:b.__:o,n.__c?I=(i=t.__c=n.__c).__=i.__E:(g?t.__c=i=new P(k,O):(t.__c=i=new se(k,O),i.constructor=P,i.render=kt),U&&U.sub(i),i.state||(i.state={}),i.__n=o,m=i.Line truncated
`):"",f={id:o.id,ts:o.ts,from:o.from,to:o.to,command:o.command},d=o.meta&&o.meta.action;switch(o.command){case"PRIVMSG":case"NOTICE":{let p={...f,text:i,system:!1,action:d},w=o.to;if(w&&w.startsWith("#"))D(w,p);else{let N=o.from===le.current?o.to:o.from;s(fe=>fe.find(Ne=>Ne.type==="dm"&&Ne.name===N)?fe:[...fe,{type:"dm",name:N}]),D(N,p)}break}case"JOIN":{let p=`${o.from} has joined ${o.to}`;o.to&&D(o.to,{...f,text:p,system:!0}),o.to&&o.to.startsWith("#")&&G(o.to);break}case"PART":{let p=i?": "+i:"",w=`${o.from} has parted ${o.to}${p}`;o.to&&D(o.to,{...f,text:w,system:!0}),o.to&&o.to.startsWith("#")&&G(o.to);break}case"QUIT":{let p=i?": "+i:"",w=`${o.from} has quit${p}`;Y.current.forEach(N=>{N.type==="channel"&&D(N.name,{...f,text:w,system:!0})});break}case"NICK":{let p=Array.isArray(o.body)?o.body[0]:i,w=`${o.from} is now known as ${p}`;Y.current.forEach(N=>{N.type==="channel"&&D(N.name,{...f,text:w,system:!0})}),o.from===le.current&&p&&r(p),Y.current.forEach(N=>{N.type==="channel"&&G(N.name)});break}case"TOPIC":{let p=`${o.from} set the topic: ${i}`;o.to&&(D(o.to,{...f,text:p,system:!0}),A(w=>({...w,[o.to]:i})));break}case"332":{let p=Array.isArray(o.params)&&o.params.length>0?o.params[0]:o.to;p&&A(w=>({...w,[p]:i}));break}case"353":{let p=Array.isArray(o.params)&&o.params.length>1?o.params[1]:o.to;p&&i&&Ie(p,i);break}case"366":break;case"375":case"372":case"376":D("Server",{...f,text:i,system:!0});break;default:D("Server",{...f,text:i||o.command,system:!0})}},[D,G,Ie]);U(()=>{if(!e)return;let o=!0;return(async()=>{for(;o;)try{let f=new AbortController;W.current=f;let d=await M(`/messages?after=${q.current}&timeout=${It}`,{signal:f.signal});if(!o)break;if(V(!0),d.messages)for(let p of d.messages)ue(p);d.last_id>q.current&&(q.current=d.last_id)}catch(f){if(!o)break;if(f.name==="AbortError")continue;V(!1),await new Promise(d=>setTimeout(d,Pt))}})(),()=>{o=!1,W.current?.abort()}},[e,ue]),U(()=>{if(!e)return;let o=a[c];if(!o||o.type!=="channel")return;G(o.name);let i=setInterval(()=>G(o.name),Et);return()=>clearInterval(i)},[e,c,a,G]),U(()=>{Te.current?.scrollIntoView({behavior:"smooth"})},[v,c]),U(()=>{xe.current?.focus()},[c]),U(()=>{if(!e)return;let o=a[c];!o||o.type!=="channel"||M("/channels").then(i=>{let f=i.find(d=>d.name===o.name);f&&f.topic&&A(d=>({...d,[o.name]:f.topic}))}).catch(()=>{})},[e,c,a]);let _t=z(async o=>{r(o),t(!0),P("Server",`Connected as ${o}`);let i=JSON.parse(localStorage.getItem("neoirc_channels")||"[]");for(let f of i)try{await M("/messages",{method:"POST",body:JSON.stringify({command:"JOIN",to:f})}),s(d=>d.find(p=>p.type==="channel"&&p.name===f)?d:[...d,{type:"channel",name:f}])}catch{}},[P]),ct=async o=>{if(o){o=o.trim(),o.startsWith("#")||(o="#"+o);try{await M("/messages",{method:"POST",body:JSON.stringify({command:"JOIN",to:o})}),s(i=>i.find(f=>f.type==="channel"&&f.name===o)?i:[...i,{type:"channel",name:o}]),u(a.length);try{let i=await M(`/history?target=${encodeURIComponent(o)}&limit=50`);if(Array.isArray(i))for(let f of i)ue(f)}catch{}}catch(i){P("Server",`Failed to join ${o}: ${i.data?.error||"error"}`)}}},Pe=async(o,i)=>{try{let f={command:"PART",to:o};i&&(f.body=[i]),await M("/messages",{method:"POST",body:JSON.stringify(f)})}catch{}s(f=>f.filter(d=>!(d.type==="channel"&&d.name===o))),u(0)},it=o=>{let i=a[o];i.type==="channel"?Pe(i.name):i.type==="dm"&&(s(f=>f.filter((d,p)=>p!==o)),c>=o&&u(Math.max(0,c-1)))},Ee=o=>{s(f=>f.find(d=>d.type==="dm"&&d.name===o)?f:[...f,{type:"dm",name:o}]);let i=a.findIndex(f=>f.type==="dm"&&f.name===o);u(i>=0?i:a.length)},lt=async o=>{let i=o.split(" "),f=i[0].toLowerCase(),d=a[c];switch(f){case"/join":i[1]?ct(i[1]):P(d?.name||"Server","Usage: /join #channel");break;case"/part":{if(d?.type==="channel"){let p=i.slice(1).join(" ")||"";Pe(d.name,p)}else P(d?.name||"Server","Not in a channel");break}case"/msg":if(i[1]&&i.slice(2).join(" ")){let p=i[1],w=i.slice(2).join(" ");try{await M("/messages",{method:"POST",body:JSON.stringify({command:"PRIVMSG",to:p,body:[w]})}),Ee(p)}catch(N){P("Server",`DM failed: ${N.data?.error||"error"}`)}}else P(d?.name||"Server","Usage: /msg <nick> <message>");break;case"/me":if(d&&d.type!=="server"){let p=i.slice(1).join(" ");if(p)try{await M("/messages",{method:"POST",body:JSON.stringify({command:"PRIVMSG",to:d.name,body:[p],meta:{action:!0}})})}catch(w){P(d.name,`Action failed: ${w.data?.error||"error"}`)}else P(d.name,"Usage: /me <action>")}break;case"/nick":if(i[1])try{await M("/messages",{method:"POST",body:JSON.stringify({command:"NICK",body:[i[1]]})})}catch(p){P("Server",`Nick change failed: ${p.data?.error||"error"}`)}else P(d?.name||"Server","Usage: /nick <newnick>");break;case"/topic":if(d?.type==="channel"){let p=i.slice(1).join(" ");try{await M("/messages",{method:"POST",body:JSON.stringify({command:"TOPIC",to:d.name,body:[p]})})}catch(w){P(d.name,`Topic failed: ${w.data?.error||"error"}`)}}else P(d?.name||"Server","Not in a channel");break;case"/mode":if(d?.type==="channel"&&i.length>=2){let p=i[1].star Line truncated `):"",d={id:r.id,ts:r.ts,from:r.from,to:r.to,command:r.command};switch(r.command){case"PRIVMSG":case"NOTICE":{let f=l,v=!1;Pt(f)&&(f=Nt(f),v=!0);let S={...d,text:f,system:!1,isAction:v},G=r.to;if(G&&G.startsWith("#"))D(G,S);else{let H=r.from===ne.current?r.to:r.from;s(fe=>fe.find(Ne=>Ne.type==="dm"&&Ne.name===H)?fe:[...fe,{type:"dm",name:H}]),D(H,S)}break}case"JOIN":{let f=`${r.from} has joined ${r.to}`;r.to&&D(r.to,{...d,text:f,system:!0}),r.to&&r.to.startsWith("#")&&q(r.to);break}case"PART":{let f=l?" ("+l+")":"",v=`${r.from} has parted ${r.to}${f}`;r.to&&D(r.to,{...d,text:v,system:!0}),r.to&&r.to.startsWith("#")&&q(r.to);break}case"QUIT":{let f=l?" ("+l+")":"",v=`${r.from} has quit${f}`;P.current.forEach(S=>{S.type==="channel"&&D(S.name,{...d,text:v,system:!0})});break}case"NICK":{let f=Array.isArray(r.body)?r.body[0]:l,v=`${r.from} is now known as ${f}`;P.current.forEach(S=>{S.type==="channel"&&D(S.name,{...d,text:v,system:!0})}),r.from===ne.current&&f&&o(f),P.current.forEach(S=>{S.type==="channel"&&q(S.name)});break}case"TOPIC":{let f=`${r.from} has changed the topic to: ${l}`;r.to&&(D(r.to,{...d,text:f,system:!0}),y(v=>({...v,[r.to]:l})));break}case"353":{if(Array.isArray(r.params)&&r.params.length>=2&&r.body){let f=r.params[1],G=(Array.isArray(r.body)?r.body[0]:String(r.body)).split(/\s+/).filter(Boolean).map(H=>H.startsWith("@")?{nick:H.slice(1),mode:"o"}:H.startsWith("+")?{nick:H.slice(1),mode:"v"}:{nick:H,mode:""});i(H=>({...H,[f]:G}))}break}case"332":{if(Array.isArray(r.params)&&r.params.length>=1){let f=r.params[0],v=Array.isArray(r.body)?r.body[0]:l;v&&y(S=>({...S,[f]:v}))}break}case"375":case"372":case"376":D("Server",{...d,text:l,system:!0});break;default:l&&D("Server",{...d,text:l,system:!0})}},[D,q]);$(()=>{if(!e)return;let r=!0;return(async()=>{for(;r;)try{let d=new AbortController;Q.current=d;let f=await E(`/messages?after=${j.current}&timeout=${Tt}`,{signal:d.signal});if(!r)break;if(U(!0),f.messages)for(let v of f.messages)ue(v);f.last_id>j.current&&(j.current=f.last_id)}catch(d){if(!r)break;if(d.name==="AbortError")continue;U(!1),await new Promise(f=>setTimeout(f,xt))}})(),()=>{r=!1,Q.current?.abort()}},[e,ue]),$(()=>{if(!e)return;let r=a[c];if(!r||r.type!=="channel")return;q(r.name);let l=setInterval(()=>q(r.name),It);return()=>clearInterval(l)},[e,c,a,q]),$(()=>{xe.current?.scrollIntoView({behavior:"smooth"})},[h,c]),$(()=>{Ie.current?.focus()},[c]),$(()=>{if(!e)return;let r=a[c];!r||r.type!=="channel"||E("/channels").then(l=>{let d=l.find(f=>f.name===r.name);d&&d.topic&&y(f=>({...f,[r.name]:d.topic}))}).catch(()=>{})},[e,c,a]);let st=X(async r=>{o(r),t(!0),T("Server",`Connected as ${r}`);let l=JSON.parse(localStorage.getItem("neoirc_channels")||"[]");for(let d of l)try{await E("/messages",{method:"POST",body:JSON.stringify({command:"JOIN",to:d})}),s(f=>f.find(v=>v.type==="channel"&&v.name===d)?f:[...f,{type:"channel",name:d}])}catch{}},[T]),at=async r=>{if(r){r=r.trim(),r.startsWith("#")||(r="#"+r);try{await E("/messages",{method:"POST",body:JSON.stringify({command:"JOIN",to:r})}),s(d=>d.find(f=>f.type==="channel"&&f.name===r)?d:[...d,{type:"channel",name:r}]);let l=P.current.length;_(l);try{let d=await E(`/history?target=${encodeURIComponent(r)}&limit=50`);if(Array.isArray(d))for(let f of d)ue(f)}catch{}}catch(l){T("Server",`Failed to join ${r}: ${l.data?.error||"error"}`)}}},Ae=async(r,l)=>{try{await E("/messages",{method:"POST",body:JSON.stringify(l?{command:"PART",to:r,body:[l]}:{command:"PART",to:r})})}catch{}s(d=>d.filter(f=>!(f.type==="channel"&&f.name===r))),_(0)},it=r=>{let l=a[r];l.type==="channel"?Ae(l.name):l.type==="dm"&&(s(d=>d.filter((f,v)=>v!==r)),c>=r&&_(Math.max(0,c-1)))},Pe=r=>{if(r===ne.current)return;s(d=>d.find(f=>f.type==="dm"&&f.name===r)?d:[...d,{type:"dm",name:r}]);let l=a.findIndex(d=>d.type==="dm"&&d.name===r);_(l>=0?l:a.length)},ct=async r=>{let l=r.split(" "),d=l[0].toLowerCase(),f=a[c];switch(d){case"/join":{l[1]?at(l[1]):T("Server","Usage: /join #channel");break}case"/part":{if(f.type==="channel"){let v=l.slice(1).join(" ")||void 0;Ae(f.name,v)}else T("Server","You are not in a channel");break}case"/msg":{if(l[1]&&l.slice(2).join(" ")){let v=l[1],S=l.slice(2).join(" ");try{await E("/messages",{method:"POST",body:JSON.stringify({command:"PRIVMSG",to:v,body:[S]})}),Pe(v)}catch(G){T("Server",`Message failed: ${G.data?.error||"error"}`)}}else T("Server","Usage: /msg <nick> <message>");break}case"/me":{if(f.type==="server"){T("Server","Cannot use /me in server window");break}let v=l.slice(1).join(" ");if(v)try{await E("/messages",{method:"POST",body:JSON.stringify({command:"PRIVMSG",to:f.name,body:[Ce+v+Te]})})}catch(S){T(f.name,`Action failed: ${S.data?.error||"error"}`)}else T("Server","Usage: /me <action>");break}case"/nick":{if(l[1])try{await E("/messages",{method:"POST",body:JSON.stringify({command:"NICK",body:[l[1]]})})}catch(v){T("Server",`Nick change failed: ${v.data?.error||"error"}`)}else T("Server","Usage: /nick <newnick>");break}case"/topic":{i Line truncated
+279 -244
View File
@@ -6,218 +6,282 @@
:root { :root {
--bg: #0a0e14; --bg: #0a0e14;
--bg-secondary: #0d1117; --bg-panel: #0d1117;
--bg-input: #161b22; --bg-input: #0d1117;
--bg-highlight: #1a2030; --bg-tab: #161b22;
--bg-tab-active: #0d1117;
--bg-topic: #0d1117;
--text: #c9d1d9; --text: #c9d1d9;
--text-muted: #6e7681; --text-dim: #6e7681;
--text-bright: #e6edf3;
--accent: #58a6ff; --accent: #58a6ff;
--accent-dim: #1f6feb; --accent-dim: #1f6feb;
--border: #21262d; --border: #21262d;
--nick: #79c0ff; --system: #7d8590;
--timestamp: #484f58; --action: #d2a8ff;
--tab-active: #58a6ff;
--tab-bg: #0d1117;
--tab-hover: #161b22;
--topic-bg: #0d1117;
--unread-bg: #da3633;
--warn: #d29922; --warn: #d29922;
--op-color: #f0883e; --error: #f85149;
--voice-color: #3fb950; --unread: #f0883e;
--action-color: #bc8cff; --nick-brackets: #6e7681;
--system-color: #484f58; --timestamp: #484f58;
--input-bg: #161b22;
--prompt: #3fb950;
--tab-indicator: #58a6ff;
--user-list-bg: #0d1117;
--user-list-header: #484f58;
} }
html, html,
body, body,
#root { #root {
height: 100%; height: 100%;
font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Courier New', font-family: "JetBrains Mono", "Cascadia Code", "Fira Code", "SF Mono",
Courier, monospace; "Consolas", "Liberation Mono", "Courier New", monospace;
font-size: 13px; font-size: 13px;
background: var(--bg); background: var(--bg);
color: var(--text); color: var(--text);
overflow: hidden;
} }
/* Login screen */ /* ============================================
Login Screen
============================================ */
.login-screen { .login-screen {
display: flex; display: flex;
flex-direction: column;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
height: 100%; height: 100%;
gap: 16px; background: var(--bg);
} }
.login-screen h1 { .login-box {
text-align: center;
max-width: 360px;
width: 100%;
padding: 32px;
}
.login-box h1 {
color: var(--accent); color: var(--accent);
font-size: 2em; font-size: 1.8em;
margin-bottom: 16px;
font-weight: 400;
} }
.login-screen input { .login-box .motd {
padding: 10px 16px; color: var(--text-dim);
font-size: 16px; font-size: 12px;
margin-bottom: 20px;
text-align: left;
white-space: pre-wrap;
font-family: inherit; font-family: inherit;
background: var(--bg-input); border-left: 2px solid var(--border);
padding-left: 12px;
}
.login-box form {
display: flex;
flex-direction: column;
gap: 8px;
align-items: stretch;
}
.login-box label {
color: var(--text-dim);
text-align: left;
font-size: 12px;
}
.login-box input {
padding: 8px 12px;
font-family: inherit;
font-size: 14px;
background: var(--input-bg);
border: 1px solid var(--border); border: 1px solid var(--border);
color: var(--text); color: var(--text-bright);
border-radius: 4px; border-radius: 3px;
width: 280px; outline: none;
} }
.login-screen button { .login-box input:focus {
padding: 10px 24px; border-color: var(--accent-dim);
font-size: 16px; }
.login-box button {
padding: 8px 16px;
font-family: inherit; font-family: inherit;
font-size: 14px;
background: var(--accent-dim); background: var(--accent-dim);
border: none; border: none;
color: white; color: var(--text-bright);
border-radius: 4px; border-radius: 3px;
cursor: pointer; cursor: pointer;
margin-top: 4px;
} }
.login-screen button:hover { .login-box button:hover {
background: var(--accent); background: var(--accent);
} }
.login-screen .error { .login-box .error {
color: var(--unread-bg); color: var(--error);
font-size: 12px;
margin-top: 8px;
} }
.login-screen .motd { /* ============================================
color: var(--text-muted); IRC App Layout
max-width: 400px; ============================================ */
text-align: center;
white-space: pre-wrap;
}
/* Main layout */ .irc-app {
.app {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
height: 100%; height: 100%;
overflow: hidden;
} }
/* Tab bar */ /* ============================================
Tab Bar
============================================ */
.tab-bar { .tab-bar {
display: flex; display: flex;
background: var(--bg-secondary); background: var(--bg-tab);
border-bottom: 1px solid var(--border); border-bottom: 1px solid var(--border);
overflow-x: auto;
flex-shrink: 0; flex-shrink: 0;
height: 32px;
align-items: stretch; align-items: stretch;
min-height: 32px;
} }
.tab-bar::-webkit-scrollbar { .tabs {
height: 2px; display: flex;
overflow-x: auto;
flex: 1;
scrollbar-width: none;
} }
.tab-bar::-webkit-scrollbar-thumb { .tabs::-webkit-scrollbar {
background: var(--border); display: none;
} }
.tab { .tab {
display: flex; display: flex;
align-items: center; align-items: center;
padding: 6px 12px; padding: 0 12px;
cursor: pointer; cursor: pointer;
border-bottom: 2px solid transparent; color: var(--text-dim);
white-space: nowrap; white-space: nowrap;
color: var(--text-muted);
user-select: none; user-select: none;
border-right: 1px solid var(--border);
font-size: 12px; font-size: 12px;
gap: 6px; gap: 4px;
transition: position: relative;
background 0.1s,
color 0.1s;
} }
.tab:hover { .tab:hover {
background: var(--tab-hover);
color: var(--text); color: var(--text);
background: rgba(255, 255, 255, 0.03);
} }
.tab.active { .tab.active {
color: var(--text); color: var(--text-bright);
border-bottom-color: var(--tab-active); background: var(--bg-tab-active);
background: var(--bg-highlight); border-bottom: 2px solid var(--tab-indicator);
margin-bottom: -1px;
} }
.tab.server { .tab.has-unread .tab-label {
color: var(--unread);
font-weight: bold; font-weight: bold;
} }
.tab .tab-name { .tab .unread-count {
overflow: hidden; color: var(--unread);
text-overflow: ellipsis;
}
.tab .close-btn {
color: var(--text-muted);
font-size: 14px;
line-height: 1;
flex-shrink: 0;
}
.tab .close-btn:hover {
color: var(--unread-bg);
}
.tab .unread-badge {
display: inline-block;
background: var(--unread-bg);
color: white;
font-size: 10px;
font-weight: bold;
padding: 0 5px;
border-radius: 8px;
min-width: 16px;
text-align: center;
line-height: 16px;
flex-shrink: 0;
}
/* Connection status */
.connection-status {
display: flex;
align-items: center;
padding: 0 12px;
background: var(--warn);
color: var(--bg);
font-size: 11px; font-size: 11px;
font-weight: bold; font-weight: bold;
white-space: nowrap;
flex-shrink: 0;
} }
/* Topic bar */ .tab-close {
.topic-bar { color: var(--text-dim);
padding: 4px 12px; font-size: 14px;
background: var(--topic-bg); line-height: 1;
border-bottom: 1px solid var(--border); margin-left: 2px;
color: var(--text-muted); }
.tab-close:hover {
color: var(--error);
}
.status-area {
display: flex;
align-items: center;
gap: 10px;
padding: 0 12px;
flex-shrink: 0;
font-size: 12px; font-size: 12px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
flex-shrink: 0;
} }
.topic-bar .topic-label { .status-nick {
color: var(--accent); color: var(--accent);
font-weight: bold; font-weight: bold;
} }
/* Content area */ .status-warn {
.content { color: var(--warn);
animation: blink 1.5s ease-in-out infinite;
}
@keyframes blink {
0%,
100% {
opacity: 1;
}
50% {
opacity: 0.4;
}
}
/* ============================================
Topic Bar
============================================ */
.topic-bar {
padding: 4px 12px;
background: var(--bg-topic);
border-bottom: 1px solid var(--border);
font-size: 12px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
flex-shrink: 0;
line-height: 1.5;
}
.topic-label {
color: var(--text-dim);
}
.topic-text {
color: var(--text);
}
/* ============================================
Main Content Area
============================================ */
.main-area {
display: flex; display: flex;
flex: 1; flex: 1;
overflow: hidden; overflow: hidden;
min-height: 0;
} }
/* Messages */ /* ============================================
.messages-pane { Messages Panel
============================================ */
.messages-panel {
flex: 1; flex: 1;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@@ -225,207 +289,178 @@ body,
min-width: 0; min-width: 0;
} }
.messages { .messages-scroll {
flex: 1; flex: 1;
overflow-y: auto; overflow-y: auto;
padding: 4px 0; padding: 4px 8px;
scrollbar-width: thin;
scrollbar-color: var(--border) transparent;
} }
.messages::-webkit-scrollbar { .messages-scroll::-webkit-scrollbar {
width: 6px; width: 8px;
} }
.messages::-webkit-scrollbar-thumb { .messages-scroll::-webkit-scrollbar-track {
background: transparent;
}
.messages-scroll::-webkit-scrollbar-thumb {
background: var(--border); background: var(--border);
border-radius: 3px; border-radius: 4px;
} }
/* ============================================
Message Lines
============================================ */
.message { .message {
padding: 1px 12px; padding: 1px 0;
line-height: 1.5; line-height: 1.4;
white-space: pre-wrap;
word-wrap: break-word; word-wrap: break-word;
} font-size: 13px;
.message:hover {
background: var(--bg-highlight);
} }
.message .timestamp { .message .timestamp {
color: var(--timestamp); color: var(--timestamp);
font-size: 11px; font-size: 12px;
margin-right: 6px;
} }
.message .nick { .message .nick {
font-weight: bold; font-weight: bold;
margin-right: 6px;
} }
.message .nick::before { .message .content {
content: '<';
color: var(--text-muted);
}
.message .nick::after {
content: '>';
color: var(--text-muted);
}
.message.system {
color: var(--system-color);
font-style: italic;
}
.message.system .timestamp {
color: var(--timestamp);
}
.message.system .content::before {
content: '*** ';
}
.message.action {
color: var(--action-color);
}
.message.action .timestamp {
color: var(--timestamp);
}
.message.action .action-nick {
font-weight: bold;
}
/* Input bar — full width at bottom */
.input-bar {
display: flex;
align-items: center;
border-top: 1px solid var(--border);
background: var(--bg-secondary);
flex-shrink: 0;
}
.input-bar .input-nick {
padding: 0 8px 0 12px;
color: var(--accent);
font-weight: bold;
white-space: nowrap;
flex-shrink: 0;
font-size: 13px;
}
.input-bar .input-nick::after {
content: '>';
color: var(--text-muted);
margin-left: 1px;
}
.input-bar input {
flex: 1;
padding: 8px 8px;
font-family: inherit;
font-size: 13px;
background: transparent;
border: none;
color: var(--text); color: var(--text);
outline: none;
} }
.input-bar input::placeholder { /* System messages (joins, parts, quits, etc.) */
color: var(--text-muted); .system-message {
color: var(--system);
} }
/* User list */ .system-message .system-text {
color: var(--system);
}
/* /me action messages */
.action-message .action-text {
color: var(--action);
}
/* ============================================
User List (Right Panel)
============================================ */
.user-list { .user-list {
width: 170px; width: 160px;
background: var(--bg-secondary); background: var(--user-list-bg);
border-left: 1px solid var(--border); border-left: 1px solid var(--border);
display: flex; display: flex;
flex-direction: column; flex-direction: column;
flex-shrink: 0; flex-shrink: 0;
overflow: hidden;
} }
.user-list-header { .user-list-header {
padding: 6px 10px; padding: 6px 10px;
color: var(--text-muted); color: var(--user-list-header);
font-size: 11px; font-size: 11px;
text-transform: uppercase; text-transform: uppercase;
letter-spacing: 0.5px; letter-spacing: 0.5px;
border-bottom: 1px solid var(--border); border-bottom: 1px solid var(--border);
font-weight: bold;
flex-shrink: 0; flex-shrink: 0;
} }
.user-list-entries { .user-list-entries {
overflow-y: auto; overflow-y: auto;
flex: 1;
padding: 4px 0; padding: 4px 0;
flex: 1;
scrollbar-width: thin;
scrollbar-color: var(--border) transparent;
} }
.user-list-entries::-webkit-scrollbar { .nick-entry {
width: 4px;
}
.user-list-entries::-webkit-scrollbar-thumb {
background: var(--border);
}
.user-list .user {
padding: 2px 10px; padding: 2px 10px;
font-size: 12px; font-size: 12px;
cursor: pointer; cursor: pointer;
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
color: var(--text); line-height: 1.5;
} }
.user-list .user:hover { .nick-entry:hover {
background: var(--tab-hover); background: rgba(255, 255, 255, 0.04);
} }
.user-list .user.op { .nick-prefix {
color: var(--op-color); color: var(--text-dim);
display: inline-block;
width: 1ch;
text-align: right;
margin-right: 1px;
} }
.user-list .user.voice { .nick-name {
color: var(--voice-color); font-weight: normal;
} }
/* Server tab messages */ /* ============================================
.server-messages { Input Line (Bottom)
color: var(--text-muted); ============================================ */
padding: 8px 12px;
white-space: pre-wrap; .input-line {
overflow-y: auto; display: flex;
align-items: center;
background: var(--input-bg);
border-top: 1px solid var(--border);
flex-shrink: 0;
height: 36px;
padding: 0 8px;
gap: 6px;
}
.input-prompt {
color: var(--prompt);
font-size: 13px;
flex-shrink: 0;
white-space: nowrap;
}
.input-line input {
flex: 1; flex: 1;
padding: 4px 0;
font-family: inherit;
font-size: 13px;
background: transparent;
border: none;
color: var(--text-bright);
outline: none;
caret-color: var(--accent);
} }
.server-messages .message { .input-line input::placeholder {
padding: 1px 0; color: var(--text-dim);
font-style: italic;
} }
.server-messages .message:hover { /* ============================================
background: var(--bg-highlight); Responsive
} ============================================ */
/* Responsive */
@media (max-width: 600px) { @media (max-width: 600px) {
.user-list { .user-list {
display: none; display: none;
} }
.tab { .tab {
padding: 5px 8px; padding: 0 8px;
font-size: 11px; font-size: 11px;
} }
.input-bar .input-nick { .input-prompt {
padding-left: 8px;
font-size: 12px;
}
.input-bar input {
font-size: 12px; font-size: 12px;
} }
} }
+443 -372
View File
File diff suppressed because it is too large. Load diff
+279 -244
View File
@@ -6,218 +6,282 @@
:root { :root {
--bg: #0a0e14; --bg: #0a0e14;
--bg-secondary: #0d1117; --bg-panel: #0d1117;
--bg-input: #161b22; --bg-input: #0d1117;
--bg-highlight: #1a2030; --bg-tab: #161b22;
--bg-tab-active: #0d1117;
--bg-topic: #0d1117;
--text: #c9d1d9; --text: #c9d1d9;
--text-muted: #6e7681; --text-dim: #6e7681;
--text-bright: #e6edf3;
--accent: #58a6ff; --accent: #58a6ff;
--accent-dim: #1f6feb; --accent-dim: #1f6feb;
--border: #21262d; --border: #21262d;
--nick: #79c0ff; --system: #7d8590;
--timestamp: #484f58; --action: #d2a8ff;
--tab-active: #58a6ff;
--tab-bg: #0d1117;
--tab-hover: #161b22;
--topic-bg: #0d1117;
--unread-bg: #da3633;
--warn: #d29922; --warn: #d29922;
--op-color: #f0883e; --error: #f85149;
--voice-color: #3fb950; --unread: #f0883e;
--action-color: #bc8cff; --nick-brackets: #6e7681;
--system-color: #484f58; --timestamp: #484f58;
--input-bg: #161b22;
--prompt: #3fb950;
--tab-indicator: #58a6ff;
--user-list-bg: #0d1117;
--user-list-header: #484f58;
} }
html, html,
body, body,
#root { #root {
height: 100%; height: 100%;
font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Courier New', font-family: "JetBrains Mono", "Cascadia Code", "Fira Code", "SF Mono",
Courier, monospace; "Consolas", "Liberation Mono", "Courier New", monospace;
font-size: 13px; font-size: 13px;
background: var(--bg); background: var(--bg);
color: var(--text); color: var(--text);
overflow: hidden;
} }
/* Login screen */ /* ============================================
Login Screen
============================================ */
.login-screen { .login-screen {
display: flex; display: flex;
flex-direction: column;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
height: 100%; height: 100%;
gap: 16px; background: var(--bg);
} }
.login-screen h1 { .login-box {
text-align: center;
max-width: 360px;
width: 100%;
padding: 32px;
}
.login-box h1 {
color: var(--accent); color: var(--accent);
font-size: 2em; font-size: 1.8em;
margin-bottom: 16px;
font-weight: 400;
} }
.login-screen input { .login-box .motd {
padding: 10px 16px; color: var(--text-dim);
font-size: 16px; font-size: 12px;
margin-bottom: 20px;
text-align: left;
white-space: pre-wrap;
font-family: inherit; font-family: inherit;
background: var(--bg-input); border-left: 2px solid var(--border);
padding-left: 12px;
}
.login-box form {
display: flex;
flex-direction: column;
gap: 8px;
align-items: stretch;
}
.login-box label {
color: var(--text-dim);
text-align: left;
font-size: 12px;
}
.login-box input {
padding: 8px 12px;
font-family: inherit;
font-size: 14px;
background: var(--input-bg);
border: 1px solid var(--border); border: 1px solid var(--border);
color: var(--text); color: var(--text-bright);
border-radius: 4px; border-radius: 3px;
width: 280px; outline: none;
} }
.login-screen button { .login-box input:focus {
padding: 10px 24px; border-color: var(--accent-dim);
font-size: 16px; }
.login-box button {
padding: 8px 16px;
font-family: inherit; font-family: inherit;
font-size: 14px;
background: var(--accent-dim); background: var(--accent-dim);
border: none; border: none;
color: white; color: var(--text-bright);
border-radius: 4px; border-radius: 3px;
cursor: pointer; cursor: pointer;
margin-top: 4px;
} }
.login-screen button:hover { .login-box button:hover {
background: var(--accent); background: var(--accent);
} }
.login-screen .error { .login-box .error {
color: var(--unread-bg); color: var(--error);
font-size: 12px;
margin-top: 8px;
} }
.login-screen .motd { /* ============================================
color: var(--text-muted); IRC App Layout
max-width: 400px; ============================================ */
text-align: center;
white-space: pre-wrap;
}
/* Main layout */ .irc-app {
.app {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
height: 100%; height: 100%;
overflow: hidden;
} }
/* Tab bar */ /* ============================================
Tab Bar
============================================ */
.tab-bar { .tab-bar {
display: flex; display: flex;
background: var(--bg-secondary); background: var(--bg-tab);
border-bottom: 1px solid var(--border); border-bottom: 1px solid var(--border);
overflow-x: auto;
flex-shrink: 0; flex-shrink: 0;
height: 32px;
align-items: stretch; align-items: stretch;
min-height: 32px;
} }
.tab-bar::-webkit-scrollbar { .tabs {
height: 2px; display: flex;
overflow-x: auto;
flex: 1;
scrollbar-width: none;
} }
.tab-bar::-webkit-scrollbar-thumb { .tabs::-webkit-scrollbar {
background: var(--border); display: none;
} }
.tab { .tab {
display: flex; display: flex;
align-items: center; align-items: center;
padding: 6px 12px; padding: 0 12px;
cursor: pointer; cursor: pointer;
border-bottom: 2px solid transparent; color: var(--text-dim);
white-space: nowrap; white-space: nowrap;
color: var(--text-muted);
user-select: none; user-select: none;
border-right: 1px solid var(--border);
font-size: 12px; font-size: 12px;
gap: 6px; gap: 4px;
transition: position: relative;
background 0.1s,
color 0.1s;
} }
.tab:hover { .tab:hover {
background: var(--tab-hover);
color: var(--text); color: var(--text);
background: rgba(255, 255, 255, 0.03);
} }
.tab.active { .tab.active {
color: var(--text); color: var(--text-bright);
border-bottom-color: var(--tab-active); background: var(--bg-tab-active);
background: var(--bg-highlight); border-bottom: 2px solid var(--tab-indicator);
margin-bottom: -1px;
} }
.tab.server { .tab.has-unread .tab-label {
color: var(--unread);
font-weight: bold; font-weight: bold;
} }
.tab .tab-name { .tab .unread-count {
overflow: hidden; color: var(--unread);
text-overflow: ellipsis;
}
.tab .close-btn {
color: var(--text-muted);
font-size: 14px;
line-height: 1;
flex-shrink: 0;
}
.tab .close-btn:hover {
color: var(--unread-bg);
}
.tab .unread-badge {
display: inline-block;
background: var(--unread-bg);
color: white;
font-size: 10px;
font-weight: bold;
padding: 0 5px;
border-radius: 8px;
min-width: 16px;
text-align: center;
line-height: 16px;
flex-shrink: 0;
}
/* Connection status */
.connection-status {
display: flex;
align-items: center;
padding: 0 12px;
background: var(--warn);
color: var(--bg);
font-size: 11px; font-size: 11px;
font-weight: bold; font-weight: bold;
white-space: nowrap;
flex-shrink: 0;
} }
/* Topic bar */ .tab-close {
.topic-bar { color: var(--text-dim);
padding: 4px 12px; font-size: 14px;
background: var(--topic-bg); line-height: 1;
border-bottom: 1px solid var(--border); margin-left: 2px;
color: var(--text-muted); }
.tab-close:hover {
color: var(--error);
}
.status-area {
display: flex;
align-items: center;
gap: 10px;
padding: 0 12px;
flex-shrink: 0;
font-size: 12px; font-size: 12px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
flex-shrink: 0;
} }
.topic-bar .topic-label { .status-nick {
color: var(--accent); color: var(--accent);
font-weight: bold; font-weight: bold;
} }
/* Content area */ .status-warn {
.content { color: var(--warn);
animation: blink 1.5s ease-in-out infinite;
}
@keyframes blink {
0%,
100% {
opacity: 1;
}
50% {
opacity: 0.4;
}
}
/* ============================================
Topic Bar
============================================ */
.topic-bar {
padding: 4px 12px;
background: var(--bg-topic);
border-bottom: 1px solid var(--border);
font-size: 12px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
flex-shrink: 0;
line-height: 1.5;
}
.topic-label {
color: var(--text-dim);
}
.topic-text {
color: var(--text);
}
/* ============================================
Main Content Area
============================================ */
.main-area {
display: flex; display: flex;
flex: 1; flex: 1;
overflow: hidden; overflow: hidden;
min-height: 0;
} }
/* Messages */ /* ============================================
.messages-pane { Messages Panel
============================================ */
.messages-panel {
flex: 1; flex: 1;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@@ -225,207 +289,178 @@ body,
min-width: 0; min-width: 0;
} }
.messages { .messages-scroll {
flex: 1; flex: 1;
overflow-y: auto; overflow-y: auto;
padding: 4px 0; padding: 4px 8px;
scrollbar-width: thin;
scrollbar-color: var(--border) transparent;
} }
.messages::-webkit-scrollbar { .messages-scroll::-webkit-scrollbar {
width: 6px; width: 8px;
} }
.messages::-webkit-scrollbar-thumb { .messages-scroll::-webkit-scrollbar-track {
background: transparent;
}
.messages-scroll::-webkit-scrollbar-thumb {
background: var(--border); background: var(--border);
border-radius: 3px; border-radius: 4px;
} }
/* ============================================
Message Lines
============================================ */
.message { .message {
padding: 1px 12px; padding: 1px 0;
line-height: 1.5; line-height: 1.4;
white-space: pre-wrap;
word-wrap: break-word; word-wrap: break-word;
} font-size: 13px;
.message:hover {
background: var(--bg-highlight);
} }
.message .timestamp { .message .timestamp {
color: var(--timestamp); color: var(--timestamp);
font-size: 11px; font-size: 12px;
margin-right: 6px;
} }
.message .nick { .message .nick {
font-weight: bold; font-weight: bold;
margin-right: 6px;
} }
.message .nick::before { .message .content {
content: '<';
color: var(--text-muted);
}
.message .nick::after {
content: '>';
color: var(--text-muted);
}
.message.system {
color: var(--system-color);
font-style: italic;
}
.message.system .timestamp {
color: var(--timestamp);
}
.message.system .content::before {
content: '*** ';
}
.message.action {
color: var(--action-color);
}
.message.action .timestamp {
color: var(--timestamp);
}
.message.action .action-nick {
font-weight: bold;
}
/* Input bar — full width at bottom */
.input-bar {
display: flex;
align-items: center;
border-top: 1px solid var(--border);
background: var(--bg-secondary);
flex-shrink: 0;
}
.input-bar .input-nick {
padding: 0 8px 0 12px;
color: var(--accent);
font-weight: bold;
white-space: nowrap;
flex-shrink: 0;
font-size: 13px;
}
.input-bar .input-nick::after {
content: '>';
color: var(--text-muted);
margin-left: 1px;
}
.input-bar input {
flex: 1;
padding: 8px 8px;
font-family: inherit;
font-size: 13px;
background: transparent;
border: none;
color: var(--text); color: var(--text);
outline: none;
} }
.input-bar input::placeholder { /* System messages (joins, parts, quits, etc.) */
color: var(--text-muted); .system-message {
color: var(--system);
} }
/* User list */ .system-message .system-text {
color: var(--system);
}
/* /me action messages */
.action-message .action-text {
color: var(--action);
}
/* ============================================
User List (Right Panel)
============================================ */
.user-list { .user-list {
width: 170px; width: 160px;
background: var(--bg-secondary); background: var(--user-list-bg);
border-left: 1px solid var(--border); border-left: 1px solid var(--border);
display: flex; display: flex;
flex-direction: column; flex-direction: column;
flex-shrink: 0; flex-shrink: 0;
overflow: hidden;
} }
.user-list-header { .user-list-header {
padding: 6px 10px; padding: 6px 10px;
color: var(--text-muted); color: var(--user-list-header);
font-size: 11px; font-size: 11px;
text-transform: uppercase; text-transform: uppercase;
letter-spacing: 0.5px; letter-spacing: 0.5px;
border-bottom: 1px solid var(--border); border-bottom: 1px solid var(--border);
font-weight: bold;
flex-shrink: 0; flex-shrink: 0;
} }
.user-list-entries { .user-list-entries {
overflow-y: auto; overflow-y: auto;
flex: 1;
padding: 4px 0; padding: 4px 0;
flex: 1;
scrollbar-width: thin;
scrollbar-color: var(--border) transparent;
} }
.user-list-entries::-webkit-scrollbar { .nick-entry {
width: 4px;
}
.user-list-entries::-webkit-scrollbar-thumb {
background: var(--border);
}
.user-list .user {
padding: 2px 10px; padding: 2px 10px;
font-size: 12px; font-size: 12px;
cursor: pointer; cursor: pointer;
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
color: var(--text); line-height: 1.5;
} }
.user-list .user:hover { .nick-entry:hover {
background: var(--tab-hover); background: rgba(255, 255, 255, 0.04);
} }
.user-list .user.op { .nick-prefix {
color: var(--op-color); color: var(--text-dim);
display: inline-block;
width: 1ch;
text-align: right;
margin-right: 1px;
} }
.user-list .user.voice { .nick-name {
color: var(--voice-color); font-weight: normal;
} }
/* Server tab messages */ /* ============================================
.server-messages { Input Line (Bottom)
color: var(--text-muted); ============================================ */
padding: 8px 12px;
white-space: pre-wrap; .input-line {
overflow-y: auto; display: flex;
align-items: center;
background: var(--input-bg);
border-top: 1px solid var(--border);
flex-shrink: 0;
height: 36px;
padding: 0 8px;
gap: 6px;
}
.input-prompt {
color: var(--prompt);
font-size: 13px;
flex-shrink: 0;
white-space: nowrap;
}
.input-line input {
flex: 1; flex: 1;
padding: 4px 0;
font-family: inherit;
font-size: 13px;
background: transparent;
border: none;
color: var(--text-bright);
outline: none;
caret-color: var(--accent);
} }
.server-messages .message { .input-line input::placeholder {
padding: 1px 0; color: var(--text-dim);
font-style: italic;
} }
.server-messages .message:hover { /* ============================================
background: var(--bg-highlight); Responsive
} ============================================ */
/* Responsive */
@media (max-width: 600px) { @media (max-width: 600px) {
.user-list { .user-list {
display: none; display: none;
} }
.tab { .tab {
padding: 5px 8px; padding: 0 8px;
font-size: 11px; font-size: 11px;
} }
.input-bar .input-nick { .input-prompt {
padding-left: 8px;
font-size: 12px;
}
.input-bar input {
font-size: 12px; font-size: 12px;
} }
} }