Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preact rewrite #1156

Closed
wants to merge 17 commits into from
Closed

Preact rewrite #1156

wants to merge 17 commits into from

Conversation

Zarel
Copy link
Member

@Zarel Zarel commented Oct 17, 2018

HIGHLY UNFINISHED CODE

@walshyb
Copy link

walshyb commented Oct 17, 2018

Just curious, but do you plan on using redux (or something similar) to manage global state/data?

@Zarel
Copy link
Member Author

Zarel commented Oct 17, 2018

@walshyb Nope, we're using PSModel to manage global state, a class loosely inspired by the ECMAScript Observable proposal.

It's defined here: (will be easier to read if you click instead of reading inline)

https://github.com/Zarel/Pokemon-Showdown-Client/blob/77df694dee276373c54ba7f2c2d22a3a3861ddd0/src/client-core.ts#L78-L146

@Zarel Zarel force-pushed the preact-rewrite branch 2 times, most recently from d4a82b2 to 38434d2 Compare October 18, 2018 02:57
@Zarel
Copy link
Member Author

Zarel commented Oct 18, 2018

In-progress shot!

image

@danimesq
Copy link

danimesq commented Nov 2, 2018

@Zarel
Could you upload it to a subdomain, for easy live testing?

@Zarel
Copy link
Member Author

Zarel commented Nov 2, 2018

I'll upload it when it gets closer to done.

As it is, it's very easy to test. Just check it out, run node build, and double-click testclient-beta.html.

HIGHLY UNFINISHED CODE
This is kind of a break of purity, because it reads
`window.offsetWidth`, but this is the lowest-overhead way to
automatically recalculate the leftRoom width whenever PS updates
(i.e. whenever leftRoom or rightRoom change).
Considering all the individual panels start with `panel-`, this should
make it easier to find and in general be a more intuitive name.

All other tsx files will start with `panel-`, putting them together in
one place when sorting alphabetically.
Room layout code is now better commented and more readable.
There's still a lot more to do, but this is a start
Unlike the old router, this one has no dependencies, and also tracks
left/right panel state, for more accurate back/forward button support.

It also sets the URL to the last selected panel, instead of always
using the left panel.
The actual connect function is commented out, because there's no reason
for it to do anything. But it can actually connect to a server now.
This at least lets me test some router features without pushing it to
the live server.
@Zarel
Copy link
Member Author

Zarel commented Feb 19, 2019

Superseded by #1229

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants