Wykres commitów

31 Commity (main)

Autor SHA1 Wiadomość Data
Atul Varma be3f1abab0
Implement read-only, text-only gallery (#217)
This implements an _extremely_ basic Firebase-powered gallery (#26).  At present it's just a list of links to creatures/manadalas that open in new tabs, without preview thumbnails. Or the ability to submit new entries. These features will be forthcoming in future PRs.

As with #215, this decouples the view logic from Firebase so we can use something else in the future if we want.
2021-08-22 12:23:51 -04:00
Atul Varma 22ae85c512
Factor out firebase.tsx, FirebaseAppContext (#216)
This factors out a ` firebase.tsx` file and a `FirebaseAppContext` in preparation for gallery work (#26).
2021-08-22 09:10:17 -04:00
Atul Varma f927db60c0
Add Firebase-powered GitHub login (#215)
This adds GitHub login via Firebase, as a foundation for adding a gallery (#26).  Currently it just adds a login/logout button to the Debug page.

At an architectural level, this adds an `AuthContext` React context, whose interface is generic enough that it's not coupled to Firebase or GitHub.  In fact, the default context is a "null context" whose operations are all no-ops.
2021-08-21 19:43:47 -04:00
Atul Varma 46d9f524da
Use eslint. (#133)
Fixes #128.

A number of hook-related warnings were brought up, which this PR also fixes.  Note that from now on, if there are any warnings raised by the eslint, CI will fail.
2021-05-28 10:17:45 -04:00
Atul Varma d1c2ae4b02
Always permalink to Mandalas. (#99)
This addresses #61 by making mandalas permalinked.

The URL to a mandala will change whenever the user stops fiddling with it for 250 ms.  This means that the user can always reload the page to get a reasonably recent version of what they were creating, and they can use the browser's "back" and "next" buttons to effectively undo/redo recent changes.  They can also copy the URL to share it with others.

## About the serialization format

Originally, I stored the state of the user's mandala in the URL using JSON.  This had a number of drawbacks, though:

* **It was really long.**  A mandala serialization was almost 1k characters, which was a very big URL, and one that some sharing platforms might even reject.

* **It wasn't type-checked in any way.** Unless I added some kind of JSON schema validation (which I didn't), the serialization was simply deserialized and assumed to be in the proper format.  This could result in confusing exceptions during render time, rather than decisively exploding at deserialization time.

To resolve these limitations, and because I thought it would be fun, I decided to store the mandala state using a serialization format called [Apache Avro][].  I first read about this in Kleppmann's [Designing Data-Intensive Applications][kleppmann] and was intrigued by both its compactness (a serialized mandala is around 80-120 characters) and schema evolution properties.

It might be going a bit overboard, but again, I thought it would be fun and I wanted to play around with Avro.  Also, I tried architecting things in such a way that all the Avro code is in its own file, and can easily be removed (or swapped out for another serialization format) if we decide it's dumb.

[Apache Avro]: http://avro.apache.org/
[kleppmann]: https://dataintensive.net/

## Other changes

This PR also makes a few other changes:

* Tests can now import files with JSX in them (I don't think this was required for the final state of this PR, but I figured I'd leave it in there for its almost inevitable use in the future).

* The value labels for number sliders now have a fixed width, which eliminates a weird "jitter" effect that sometimes occurred when using them.
2021-04-24 08:46:32 -04:00
Atul Varma a13f989ab3 Use history.pushState() for internal links. 2021-04-02 21:17:44 -04:00
Atul Varma 1cbe2b6d22
Improve layout (#74)
This improves the layout of all our pages to look more like the mandala page.

Additionally, some form widgets now have better layout, and the header takes up less vertical space.

At an implementation level, the component hierarchy of pages has been inverted to make this kind of layout easier.  Now fully laid-out pages are contained within `<Page>` components that are at the top of the component hierarchy, and which are defined by each specific page (mandala, creature, vocabulary, etc).

I had to do a few architectural things to avoid circular imports, though; most notably, this involved the creation of a new React context called a `PageContext`.

It uses CSS grid, which should be pretty well-supported amongst recent browsers.
2021-04-02 19:00:29 -04:00
Atul Varma a917f40da9 Move page list to header for easier navigation. 2021-03-29 07:48:56 -04:00
Atul Varma 8a54b62bdb
Move eye creature to a separate debug page. (#58)
Really the eye creature is only useful for me as a debugging tool, so this moves it over to a separate debug page.

It also removes the whole concept of randomizing the eye creature, mainly because it ignores all the rules set forth in the normal creature randomizer, so it's not terribly useful.

This simplifies the code for `creature-page.tsx` a bunch and hopefully makes it easier to understand.
2021-03-26 20:47:22 -04:00
Atul Varma f790838b06
Add a very basic Mandala page. (#57)
This adds an extremely simple Mandala page (for #24) with a single circle Mandala comprised of several eyes.  The symbol style is configurable, but parameters for the actual Mandala are not (yet).

Doing this also involved factoring out a `<SvgTransforms>` component, which makes setting up SVG transforms a bit easier.

Also moved `getSymbol` of `creature-page.tsx` and into `svg-vocabulary.tsx`, with the new name `getSvgSymbol`.
2021-03-26 18:07:01 -04:00
Atul Varma 93225e9b6c Add more docs to readme, link to github repo in website. 2021-02-17 07:41:26 -05:00
Atul Varma 2384d1eac3 Add a placeholder creature page. 2021-02-15 08:34:22 -05:00
Atul Varma 046c940351 Add waves. 2021-02-14 16:39:10 -05:00
Atul Varma 0652aa19ea Add rudimentary about page. 2021-02-14 12:32:55 -05:00
Atul Varma f3beb8cdd9
Auto-detect direction of normals. (#2)
This auto-detects the direction of normals on which to attach attachments.

Right now it's getting very confused by corners, but otherwise it seems to mostly work.
2021-02-14 12:07:34 -05:00
Atul Varma 6d911e1654 Use js-bezier's BBox struct and functions. 2021-02-14 07:44:52 -05:00
Atul Varma 2b0d69bb87 Factor out getColor(). 2021-02-14 07:32:54 -05:00
Atul Varma a135b6930b Add checkbox toggle to show specs. 2021-02-13 21:13:04 -05:00
Atul Varma 56fd341daa Factor out colors.ts. 2021-02-13 19:24:46 -05:00
Atul Varma 27cbf37209 Detect bounding boxes of symbols and crop to them. 2021-02-13 09:02:25 -05:00
Atul Varma aa61f26c79 Rename to Mystic Symbolic. 2021-02-13 07:20:16 -05:00
Atul Varma ea1f42d810 Simplify stroke/fill logic. 2021-02-06 10:57:41 -05:00
Atul Varma b17f429ef8 Add checkerboard bg. 2021-02-06 08:11:20 -05:00
Atul Varma 1e3cbe73b1 Add support for shadows, bg color. 2021-02-06 08:02:18 -05:00
Atul Varma 5df222edea Process multiple children of <svg>, store SVG as struct. 2021-02-06 07:50:51 -05:00
Atul Varma 63f3c2be88 Use one paragraph for stroke and fill 2021-02-03 20:26:17 -05:00
Atul Varma 2d1fb67839 Change styling a bit. 2021-02-03 20:23:24 -05:00
Atul Varma 511ea2510b Make stroke/fill configurable. 2021-02-03 19:53:01 -05:00
Atul Varma db29a5af47 Factor out px(). 2021-02-03 19:39:48 -05:00
Atul Varma 7019199bd4 Show all symbols. 2021-02-03 19:36:29 -05:00
Atul Varma f0960d4280 use react. 2021-02-03 19:11:34 -05:00