Commit Graph

6164 Commits

Author SHA1 Message Date
Guangcong Luo
0740eb5148 Preact: Refactor client commands
Some checks are pending
Node.js CI / build (22.x) (push) Waiting to run
At this point we've probably outgrown the "huge switch" pattern. So
instead, here's a client command syntax a lot like server's.

I've also added an `add` command that works more like server's and
2013 client's, as the default way to respond to client commands.
2025-04-14 03:12:22 +00:00
Aurastic
8f41ceb4da
Preact: Add /showjoins and other client side commands (#2352)
Some checks are pending
Node.js CI / build (22.x) (push) Waiting to run
2025-04-13 12:33:55 -07:00
Aurastic
cf09cc7a91
Preact: Fix popup bug in testclient (#2357) 2025-04-13 12:13:12 -07:00
dot-Comfey
f8c09c1068
Preact: Add /ignore and /unignore (#2354)
Implements basic functionality of the ignore commands. I also added the ^ (prize winner) rank to the ignorable ranks since the inability for this rank to be ignored has been reported as a bug.
2025-04-13 12:01:30 -07:00
Guangcong Luo
21a2617289 Preact minor updates batch 8
Some checks are pending
Node.js CI / build (22.x) (push) Waiting to run
Minor
- Redesign battle room tabs in vertical tab mode (they're now
  two-liners), kind of like in the original 2011 client
- Redesign roomtab tags (they're now smaller and bold)
- Fix scrolling to left when focusing textbox in Chrome Android
  - This was a huge mess. If scroll snap weren't such a horrible mess
    without CSS, I'd probably just give up and do it in JS. But given
    that that's much worse, here we are working around tons of Chrome
    and Safari bugs.
- Update replay watching UI to match modern PS
  - "Play/Pause" button has constant width
  - "Switch viewpoint" instead of "Switch sides"
  - "Last turn" -> "Prev turn"
  - Disable "First turn" and "Prev turn" when already at first turn
  - modern button arrangement
- Battle controls: align to bottom in mobile UI

Trivial
- rename `PS.closePopupsUntil` to `PS.closePopupsAbove`
- fix `<a href=".">` links to Home
- Fix ranks in DM userlist
2025-04-13 08:12:44 +00:00
Guangcong Luo
8a01113f3e Update replay download link
In practice this link should never go through, but I figure it should
have some sort of message for it to make sense at all...
2025-04-13 08:12:44 +00:00
Guangcong Luo
9040d41fb3 Improve testclient-key retrieval
Chrome makes it much harder to grab keys now. I've set up a way to
make it easy (since we're going to be doing it once a week).

Chrome did make it hard on purpose, so I'm a little paranoid, but
I think probably these warnings will be enough. If we develop a
phishing problem I'll revisit this.
2025-04-13 08:12:44 +00:00
Guangcong Luo
bfae3543e4 Add W/L/COIL to web API 2025-04-13 08:12:43 +00:00
Guangcong Luo
d84727f101
Update GitHub Actions config
Some checks are pending
Node.js CI / build (22.x) (push) Waiting to run
This makes it better match the server config.
2025-04-12 18:14:30 -07:00
Guangcong Luo
e7041cc5bd Testclient: Fix clicking room links in Firefox
Some checks are pending
Node.js CI / build (22.x) (push) Waiting to run
2025-04-12 12:14:13 -07:00
Guangcong Luo
c3301aabea Fix testclient to work without a full build 2025-04-12 10:53:31 -07:00
Guangcong Luo
39ddd15510 Preact update batch 7
Some checks are pending
Node.js CI / build (22.x) (push) Waiting to run
I've been batching all my non-huge Preact updates approximately once a
day and I intend to keep that up, but I should probably number them so
it's not just "misc updates" every time. Anyway: I went back and
counted. This is batch 7.

Major
- Update Options popup
  - Layout options
- Topbar in vertical tabs mode now contains a username/options button
- If you click on a button for a popup (like Options or a trainercard)
  while the popup is already open, it will be closed.
	- Also if you click on a popup already open somewhere else, it will
	  open correctly.
- Fix clicking on readmores, spoilers, and buttons inside links
- Make the vertical tabbar scrollable
- Reliably title <<rooms>> "Chat Rooms"
- Add a button to get to the vertical tabbar on mobile

Minor
- `users` in the URL now directs to Preact client
- refactor popup closing to never use while loops
- Fix capitalization for usercards for users with no user objects
- Migrate all `name="cmd"` buttons to `data-cmd`
- Migrate all `name="joinRoom"` buttons to `data-href`
- Fix left border thickness on home screen in vertical tabs mode
- Use `/play` for replaying battles
2025-04-12 10:38:31 +00:00
FeluciaPS
36ccc1a80b
Preact: Add utilichart.css (#2349) 2025-04-12 03:21:50 -07:00
FeluciaPS
c9e0b0f035
Fix /invite styling (#2350) 2025-04-12 03:20:08 -07:00
Mayur Hiwale
3872e41872
Preact: Add controls after battles (#2347) 2025-04-12 03:07:44 -07:00
Mia
c8847a8a21 Teams: Only show more button in search if necessary 2025-04-12 02:03:56 -05:00
Mia
60ee938a1d Teams: Add a back button to the search/view pages
Some checks are pending
Node.js CI / build (22.x) (push) Waiting to run
2025-04-12 01:31:28 -05:00
Mia
84bb82a413 Teams: Fix 2-col mode on mobile
Some checks are pending
Node.js CI / build (22.x) (push) Waiting to run
2025-04-11 16:46:13 -05:00
Mia
f25ae63dc9 Teams: Re-style management section 2025-04-11 15:28:53 -05:00
Mia
33016e9658 Teams: Add visual indicator to private teams 2025-04-11 15:25:50 -05:00
Mia
2847de4aa1 Teams: Handle non-suffixed search URL 2025-04-11 15:19:50 -05:00
Mia
c9bef2cc15 Teams: Add sprite toggle 2025-04-11 15:18:21 -05:00
Waleed Hassan
deae72a434
Preact: Fix UserPanel (#2345)
Some checks are pending
Node.js CI / build (22.x) (push) Waiting to run
- Stop sending the server empty `/cmd userdetails`
- User search popup uses the server username instead of the searched
  name

Co-authored-by: Guangcong Luo <guangcongluo@gmail.com>
2025-04-11 01:09:59 -07:00
Guangcong Luo
9f18a13bbf Preact: More misc fixes
Moderate:

- Fix double messages when being DMed (and otherwise joining a room
  server-side)
- Refactor PSModel to support passing a value with updates, so
  PSStreamModel is explicitly about tracking an update backlog.
- Work on supporting AFD mode (it doesn't seem to work yet)
- Fix music still playing after closing a battle
- Show username (with capitalization and spaces) in DM titles
- Don't let people try to search for battles without choosing a username

Minor:

- Remove random BOM that made it into some files?
- Correct date Preact client started (I mistook the date testclient was
  created)
- Refactor updateLayout
2025-04-11 07:55:41 +00:00
Guangcong Luo
0eeed0d7ce Preact: Add vertical header layout for mobile
It's finally here and it's beautiful! I've had this design in my mind
for around ten years, ever since I first started working on a Preact
client.

The idea is that on small screens, you'd just scroll left to get to
the menu, instead of needing to press the menu button. This turned out
to work surprisingly well and I'm pretty happy with it.

This also exposed a number of bugs. It turns out most of our popups are
not written with horizontal scrolling in mind, so I had to fix
popup rooms as well as BattleTooltips.

There's still plenty of improvements possible, but I'm already really happy
with what I've done so far.
2025-04-11 07:55:41 +00:00
Guangcong Luo
a476ded769 Preact: Split off panel-popups.tsx from topbar 2025-04-10 05:01:49 +00:00
Mia
fce7f8e5aa Teams: Support dark mode, 2-column display mode, and fix sprite overflow
Some checks failed
Node.js CI / build (22.x) (push) Has been cancelled
2025-04-09 21:49:52 -05:00
Mia
517f4dd069 Teams: Add copy button to view page 2025-04-09 20:00:10 -05:00
Mia
8e378c6129 Add static website for viewing server-side teams 2025-04-09 19:36:58 -05:00
Guangcong Luo
e8c60fd8c6 Add psim.us shortlinks for replays and teams 2025-04-10 00:35:35 +00:00
Guangcong Luo
bfbec67457 Preact: Refactor ladder again
Some checks are pending
Node.js CI / build (22.x) (push) Waiting to run
2025-04-09 19:19:06 +00:00
Guangcong Luo
7a00e5f610 Preact: Misc fixes
- Rename RoomType to PSRoomPanelSubclass (so it doesn't conflict with
  the other RoomType)
- Support message notation in popups
- Support searching for battles
- Fix Terastallizing in battles
- Fix cancelling challenges
- Support the games list
- Topbar now shows format name rather than ID
- Fix rejoining battles in progress
- Chats and battles: Focus on any click
- Retain chat/battle history when moving rooms in/out of mini-windows
- Real news (instead of just testclient placeholder)
- Add "Tournaments" and "Friends" main menu links
- Use new icon in upper left
- Use dark main menu groups
- Fix pref loading
- Support `/nick`
- Rename `room.handleMessage` to `room.handleSend` for clarity
- Rename `room.queue` to `room.backlog` for clarity
- Fix DM userlist after renames
- Darken chat logs in dark mode
2025-04-09 17:22:50 +00:00
Guangcong Luo
bd94b60ed2 Split off replays-index.tsx
Mostly for easier maintenance.
2025-04-09 01:36:52 +00:00
Guangcong Luo
e30d3f0bcb Preact: Support mini-room (DMs) keyboard nav
Some checks are pending
Node.js CI / build (22.x) (push) Waiting to run
2025-04-08 23:11:09 +00:00
Guangcong Luo
7088a829ba Preact: More small fixes
- Refactor focusing text boxes on background panels
- Esc to close popups and hide rooms panel
- Fix joining hidden rooms by link
- Support renaming rooms
- Support searching the format dropdown
- Fix focus clicking in battle rooms
- Always use right panel URL if left panel is Main Menu
- Always use left panel URL if right panel is Rooms
- Add ARIA label for rooms tab
- Battles: Hide "Back" button when it's redundant with "Cancel"
- Support placeholders in new text boxes
- Hide Username box in DMs
- Show "Connecting..." in userbox until fully connected
- Refactor Ladder
  - Fix bug where the last ladder category wasn't shown
- Rooms: Show Official/Chat/Hidden sections
- Blur backgrounds in dark mode high-readability sections
2025-04-08 23:10:58 +00:00
Guangcong Luo
35e164b46d Preact: Support Tera 2025-04-08 19:07:08 +00:00
WifiLatency
9f151c3149
Collapsible Datasearches (#2338)
Some checks are pending
Node.js CI / build (22.x) (push) Waiting to run
* Clientside javascript to collapse and expand datasearch results

* Fix results expanding when clicking a link in the results

* Remove for of syntax

---------

Co-authored-by: WifiLatency <michaelweger5053@gmail.com>
2025-04-07 21:18:31 -06:00
Guangcong Luo
dc91acd7b6 Preact: Support new challenge protocol
This adds Preact support for the new challenge protocol (#1799).

https://github.com/smogon/pokemon-showdown-client/pull/1799#issuecomment-841363805

Apparently I announced that this would be supported in rooms. This
commit doesn't actually do that.
2025-04-07 20:15:47 -07:00
Guangcong Luo
610c33dfa4 Preact: Refactor room args
- custom room info is now in `room.args`
- rooms not compatible with URLs can be marked with `noURL`
- PMs renamed to DMs, and are now `dm-[userid]` instead of
  `pm-[userid1]-[userid2]`
- custom popups now supported
- find-user popup now supported
- popups no longer come with padding, making them behave more like
  other panels
2025-04-07 20:15:47 -07:00
Guangcong Luo
1572b07cb4 Preact: Misc fixes
- Don't clear PM contents when rearranging
- Don't show "Chat self" on others' usercards while not logged in
- Direct usercard URLs to Preact client
- Fix mini window collapse/expand
- Fix dark mode mini window and focused mini window styles
- Set titles for more readable history
- Stub PS.alert / PS.prompt
- Document RoomOptions
- Infer parentRoomid from parentElem
- Fix room focus issues
- Fix browser back/forward history
- Keep default format up to date
2025-04-07 20:15:25 -07:00
Guangcong Luo
f272d9526b Preact: Support logging in
Some checks are pending
Node.js CI / build (22.x) (push) Waiting to run
2025-04-07 20:04:49 +00:00
Guangcong Luo
5c2beea822 Update intro comment
Unfortunately it seems like the console is the new hot place to say
hi to devs, rather than the source, but we're actually using the
console. So it's gotta be here.

ASCII art circle was outlined with

https://www.asciiart.eu/ascii-draw-studio

and the exclamation mark was done by tracing the old one. The rest,
including the anti-aliasing was entirely by hand, though.
2025-04-07 17:14:22 +00:00
Guangcong Luo
d8cd5d6d9f Replays: Support easier ways of getting inputlogs 2025-04-06 17:58:29 +00:00
Guangcong Luo
a82991268f Preact: Catch errors that only affect one room
Some checks are pending
Node.js CI / build (22.x) (push) Waiting to run
2025-04-06 08:46:46 -07:00
Guangcong Luo
89c9a78e1e Preact: Refactor registering room types
Room type data is now nearly all in the Panel class, which should make
it much easier to add custom room types.
2025-04-06 08:46:46 -07:00
Guangcong Luo
0dddb2844d Preact: More minor fixes
- New subroom link style
- New-style format list button
- Fix router (accidentally deploying Preact client to
  play.pokemonshowdown.com)
- Support omitting redundant `data-name` on username elements
2025-04-06 08:46:46 -07:00
Guangcong Luo
7f1c0c6ffc Fix ability listing in PSdex
Some checks are pending
Node.js CI / build (22.x) (push) Waiting to run
2025-04-05 21:59:19 +00:00
Guangcong Luo
d2b33464ec Preact: Support dragging rooms into mini-windows
Some checks are pending
Node.js CI / build (22.x) (push) Waiting to run
Also fixes a whole bunch of bugs related to dragging rooms around.

Also renames:

- `activePanel` to `panel`
- `leftRoom` to `leftPanel`
- `rightRoom` to `rightPanel`
- `leftRoomWidth` to `leftPanelWidth`

Which should hopefully make the relationship between `panel` and
`leftPanel` more intuitive.
2025-04-04 19:38:02 -07:00
Guangcong Luo
0ace4b1b90 Refactor styling
- move big and small buttons to battle-log.css (so they can be used in
  custom HTML)
- sync Preact header styling with regular header (from the design
  refresh #2175)
- rearrange client.css and client2.css to move main menu and format
  dropdown styling out of the header section
- lighten light .button.cur to match header bar
- add active styling to blocklinks
2025-04-04 19:38:02 -07:00
Guangcong Luo
5a6e935747 Preact: Open console when pressing / in Main Menu
There's no easy way to enter a command in PS if you're not logged in.
This adds one.

This also standardizes the room ID for the console as `pm-`.

I'm still mulling whether `pm-[userid1]-[userid2]` should be the roomid,
or `pm-[pmtarget]`. Arguably it's nice for PMs to have the same roomid
for both sides of the conversation, but also arguably it's nice for
PMs not to change roomid when you change your own name (it'd still
change if your PM target changed name).
2025-04-04 19:38:02 -07:00