Commit Graph

15 Commits

Author SHA1 Message Date
Guangcong Luo
5971e5151a Preact minor update batch 11
Some checks are pending
Node.js CI / build (22.x) (push) Waiting to run
Minor
- Unhide right panel when choosing "Two panels" layout option
- Refactor focusing
  - Correctly focus next room when closing currently active room
  - Correctly focus room when joining new room
- Use strict mode on all compiled files
- Fix router when started on `/` (it previously required starting on a
  non-empty room ID, which wasn't noticeable back when the URL needed
  to be `/preactalpha`)
- Update teambuilder sidebar CSS, to make it easier to add regular text
  - This is mainly for the "Tournaments" button in the main menu,
    which shares the CSS
- Fix new tournament elim tree text in Safari
- Update new tournament elim tree highlighted links to reliably
  link every still-playing game
- Remove latest gen from format name displays everywhere
  - Previously, they would only be removed from the format dropdown,
    but now they're also gone from the Ladder tab, battle tabs, and
    `/rank`
- Support async d3 loading
  - This allows chatrooms to be loaded way before all our dependencies
    are fully downloaded
- Remove "[Gen 9]" from format names everywhere (previously it was only
  removed from the format dropdown)
  - Also add "[Gen 6]" to unlabeled formats in `/rank` (Gen 6 was the
    last time we didn't have format generation as part of format names)

Trivial
- Stricter JSX linting
  - (unfortunately, most of the JSX style enforcement I actually want
    isn't possible in @stylistic)
- Make room.subscribeTo's second parameter optional
- Rearrange and comment loading order
- Rename hiddenInit -> focusNextUpdate (clarity)
- Rename PSMain -> PSView (clarity)
- Fix button spacing in Change Password
- Add `touch-action: manipulation` to <a> tags
- Refactor `nodeSize` in elim tour trees
2025-04-18 05:47:58 +00:00
Guangcong Luo
228ee955eb Upgrade Babel dependency
Nothing major, but we no longer need `plugin-proposal-class-properties`.
2025-04-16 19:50:49 -07:00
Marty-D
a526a66dfa
Update .babelrc 2023-06-02 15:34:37 -04:00
Guangcong Luo
c833975782 Upgrade to TypeScript 4.3
Unlike in the server:

74211859c9

We're using Babel here, and can immediately start using `override`.
2021-05-26 19:37:44 -07:00
Guangcong Luo
621d6565e6 Update .babelrc
The new Babel version gives us access to transforming `||=` and `??`,
and removes the need for a lot of dependencies that are now included in
`@babel/preset-env` thanks to them being released rather than proposals.

This also adds a new Babel plugin to simply remove import/export when
building, which seems to be the best way to make `import` and `export`
usable on the client.
2021-04-10 23:23:49 -07:00
Adam Tran
1f3c8cf450
Add sourceMaps and vscode debug configurations (#1707)
* launch json

* vscode updates

* clientUrl rename
2021-01-10 16:58:28 -08:00
Guangcong Luo
b815730c51 Improve teambuilder team selection layout 2020-05-03 22:40:11 -07:00
Guangcong Luo
0d05feb41b Migrate to optional chaining and TypeScript 3.7
This is something I probably wouldn't have rushed nearly as much,
except I have a serious use-case coming up; specifically

```js
foo = document.querySelector('foo')?.bar;
```

in a class property.

`document.querySelector('foo') && document.querySelector('foo').bar`
is incredibly inefficient here, but TypeScript doesn't consider
`(document.querySelector('foo') || {}).bar` to be valid because `{}`
doesn't have the `.bar` property. Creating a temporary variable
would have been a huge mess because this was a class property
initializer.

In hindsight, `(document.querySelector('foo')! || {}).bar` would
probably have worked, but too late now.
2019-10-13 01:28:36 +11:00
Guangcong Luo
04a5454f6e Support login handshake
You can't actually log in through the Preact client anyway, but now
if you set the right config file, you can _be_ logged in.
2019-03-17 19:02:53 +09:00
Guangcong Luo
26f78dcce6 Add Preact dependency
Preact is currently unused in the client, but will be used in an
upcoming rewrite. This adds the foundation to support `.tsx` files in
`src/`.
2018-10-16 14:53:27 -05:00
Guangcong Luo
7df9e5a7ea Make Babel output compact
This doesn't change debuggability and saves a bit of bandwidth.

But most importantly, it might help Windows users who are having
trouble compiling because Babel runs out of memory.
2018-10-14 04:36:58 -05:00
Guangcong Luo
2d77a709a6 Babel: Compile object-spread to Object.assign 2018-05-19 20:13:55 -04:00
Guangcong Luo
4e7f998afa TypeScript data/graphics.js 2018-05-18 17:10:58 -05:00
Guangcong Luo
d247364027 Migrate js/battle.js to TypeScript
This is only a first step and doesn't pass strictNullChecks.

I'm committing now because skipping straight to refactoring will be
easier than trying to make it pass strictNullChecks as-is.

TypeScript found at least a few bugs here, which is nice.
2018-05-16 19:49:25 -05:00
Guangcong Luo
a15ec64d1d Move battledata.js to TypeScript
This is the first step of moving the entire client over to
TypeScript + Preact!!!!

The main change here is that battledata.js has been split into three
files:
- `src/battle-dex.ts`
- `src/battle-dex-data.ts`
- `src/battle-dex-misc.js`

These are concatenated back into `battledata.js` in the client, so
third parties (and specifically, old replay files) should be
unaffected. Also, this makes sure that we don't have more than two
dependencies right now.

The compilation is done with Babel 7 beta, because no stable version
of Babel supports TypeScript. We're not using `tsc` because it can't
compile to ES3 and it doesn't support preserving line numbers.

`toRoomid` has been moved from client.js to battle-dex.ts.
2018-05-14 12:53:34 -05:00