Commit Graph

54 Commits

Author SHA1 Message Date
Eli Ribble 171a8aa1c0 Update the mailbox list when we get changes.
This is a pretty big change. I'm now storing the mailboxes within the
account as a map of IDs, which is more consistent with the rest of the
client and makes it easier to update a single mailbox when we know it
has changes.

I've also added a new function for getting a single mailbox. This isn't
really well coded - I need to refactor the client before I can do that
properly. But for now the proof-of-concept works: I'm getting push
events from the server, I'm getting the changes from my last update
state, and I'm applying them to the UI.

This is essentially the whole point for doing React and doing JMAP.

Woot.
2024-09-04 13:29:52 -07:00
Eli Ribble e93cbbaab2 Pull changes on change event.
We don't do much yet with the changes, and clearly this state should be
incorporated into the client in a different way, but for now I want to
commit to this checkpoint as it represents an update to my understanding
of how the standard works. Specifically, whenever we do a get against a
basic type we are given a state. We need to use that to request changes
whenever we are alerted to changes. From there we update the cache and
the display on the client should change in the reactive way.

I don't yet do the actual update, but I'm nearly there.
2024-09-04 12:49:38 -07:00
Eli Ribble c686f5c8d9 Subscribe to event type and message.
This mirrors a change in the client where we extract the type of the
event.
2024-09-04 12:04:45 -07:00
Eli Ribble 5cae71653f Space between when sent time, from, and subject in email summary
This is the first time I'm creating some custom style. There's probably
a way to do this with Bootstrap that I'm not expert enough to know
about.

For now I'm just scratching itches.
2024-09-04 11:41:08 -07:00
Eli Ribble 1e9dae15f1 Add button to move an email to trash.
This is the first time I'm modifying data instead of just displaying it.
And this commit is a mess, it's all over the place with duplicating
types and breaking my class layers.

But it works, technically, so, whatever, checkpoint!

I need to totally start reworking the base client library as I'm not
happy with it at all. Also, it turns out that we have very little type
protection on the "set" methods. I had a totally improper signature for
about an hour that led to useless debugging. Reading the standard, which
is excellent, helped me get sorted out, but they type checker should be
helping me.

Additionally, I should be creating this Account class type within the
client.
2024-09-03 12:03:04 -07:00
Eli Ribble dfca32eb36 Initial integration of event stream.
This doesn't do much yet but log the events I'm getting until I
understand them better.
2024-09-03 10:11:02 -07:00
Eli Ribble 5a36e46da5 Add support for react-bootstrap-icons. 2024-09-03 10:09:44 -07:00
Eli Ribble a412b6a0a4 Display the 'sentAt' information. 2024-09-03 08:36:28 -07:00
Eli Ribble d8ee3d5f0f Use my vendored jmap-client-ts
This allows me to modify the client in-place and get immediate feedback
that it's working.

There's likely a better way to do this. I'm not a node developer.
2024-08-30 10:14:05 -07:00
Eli Ribble 3aebdb471a Add jmap-client-ts fork
I need to add a bunch of stuff to this client.
2024-08-30 10:13:46 -07:00
Eli Ribble cf20d9aff1 Show convenient relative time in the email summary 2024-08-30 07:43:49 -07:00
Eli Ribble 895bb8ae47 Don't set inner HTML for text email content.
It was a bad copy-paste from the HTML display.
2024-08-29 11:49:04 -07:00
Eli Ribble 64d4e98996 Clean up some lint warnings 2024-08-29 11:43:41 -07:00
Eli Ribble eb09b39de3 Add beginning of email header information
The format is butt-ugly, but at least I'm showing info.
2024-08-29 11:41:41 -07:00
Eli Ribble 356173e4a3 Create button to choose between HTML and text-based email content. 2024-08-29 11:30:20 -07:00
Eli Ribble a65514f707 Add note to add support for sentAt.
It's in the spec, and I get it from the server, but it's not in the
client library I'm using.
2024-08-29 11:25:59 -07:00
Eli Ribble 3ef58b2259 Show the error when the email list fails.
Useful when I was tring to query for more stuff.
2024-08-29 10:47:35 -07:00
Eli Ribble 5c293219f3 Add 'from' and 'received at' to the email summary.
Really useful in deciding what to read.
2024-08-29 10:47:09 -07:00
Eli Ribble d71f18cce1 Show text content, and if unavailable, the HTML content.
This required actually requesting all the body values, and mapping from
the body values to to body parts for display.
2024-08-29 10:27:00 -07:00
Eli Ribble 4e1922c5fa Split email cache into full content and stubs.
This also introduces status for in-flight requests to avoid perpetual,
unnecessary loops of change-the-re-get-data.
2024-08-29 08:41:34 -07:00
Eli Ribble fb53a7506f Standardize on links for refresh.
Turns out I was doubling-up unnecessarily and had an event handler _and_
a hash change detection. This just made things complex. Now I use the
hash for both the mailbox and the email navigation.

I don't yet do anything with the email part.
2024-08-28 10:35:48 -07:00
Eli Ribble bf1ad0326d Show debug log messages on triggering changes 2024-08-28 10:16:40 -07:00
Eli Ribble d6b675f7b6 Allow selecting an email, and adding it to the hash.
We don't do anything with it yet, though
2024-08-28 10:16:11 -07:00
Eli Ribble e68a21dcc4 Move email list text to the left, fill the viewport, add border.
Much prettier.
2024-08-28 09:38:50 -07:00
Eli Ribble 0d2e43ae83 Add ability to support custom styles
Not using it yet, just thinking about usability and design a bit.
2024-08-28 09:38:23 -07:00
Eli Ribble a34d8f53b3 Show email subject lines.
This includes a bunch of new things. I've introduced "ensureEmail..." to
indicate that the UI would like some data to be populated, but if it is
already present we don't need to do anything.

I've also introduced a cache for emails that is keyed on the email ID. I
don't know if email IDs are unique. They look like they should be
globally unique within a given server, but I'm not sure and the standard
is unclear. It'll need some experimentation.
2024-08-28 09:21:31 -07:00
Eli Ribble 5c7e67a2bd Add mailbox to location hash.
Now we can preserve what mailbox we're looking at.
2024-08-28 01:08:27 -07:00
Eli Ribble ee872f6985 Select a mailbox on click, show its email IDs
We'll eventually want to populate them.
2024-08-28 01:08:27 -07:00
Eli Ribble 656495904b Add the ability to select a mailbox.
Just log the mailbox ID for now.
2024-08-28 01:08:27 -07:00
Eli Ribble bab5d421d4 Rip apart client, build a wrapper.
The goal here is to be able to augment the client with additional data
as we get it. At this point I'm now augmenting with the mailbox data
that the MailboxList is requesting and showing that.

That's progress.

There may be significant issues with making multiple requests in a
single round-trip because my client library appears to do things like
hard-coding the position of specific requests. I may have to work around
this.
2024-08-28 01:08:27 -07:00
Eli Ribble c17e8b9ad0 Get to where I'm querying for mailboxes
This won't work, not in the long term, but it's a better direction.

I've created proxy classes for the classes coming from the JMAP client.
The issue here is that this client is likely to have a bunch of things
wrong. Specifically, the standard indicates that the client can be
extremely stateful, to the point where it's just getting a stream of
updates and keeping most of the structure in memory. The client, as
presently built, does not make it easy to honor this part of the
standard, so I'm going to have to structure the client interaction
differently.

However, what I've done here, while interesting, is not good.

The problem is that I am correctly telling the client "I need the list
of mailboxes" when I render the mailbox list, but I'm not able to
propogate that information back to the client since it's passed down
through props.

I'm going to need to separate out the client into its own class and have
an eventing system of some kind between it and the app.
2024-08-28 01:08:27 -07:00
Eli Ribble a93a5d84f3 Trigger account list on valid session.
It's cleaner
2024-08-28 01:08:27 -07:00
Eli Ribble c5afd9f895 Allow selection of the account.
This was surprisingly complex because I tried to use react-router and
found no easily and reasonable way to do it, so instead I hooked the
location change event myself and plumbed it through. This required me to
switch to a class-style component rather than a functional one, which
required translating a bunch of coding styles through React.

Overall I'm happy, it works pretty well and simply.
2024-08-28 01:08:27 -07:00
Eli Ribble 1d7d96de4a Add list of accounts from the session.
This isn't great, but it shows data from the API being fed into the
interface.
2024-08-28 01:08:27 -07:00
Eli Ribble 2b94459651 Only make a single client setup request. 2024-08-28 01:08:27 -07:00
Eli Ribble 05779c0b64 Use tabs, add jmap-client-ts, use it a bit 2024-08-28 01:08:27 -07:00
Eli Ribble 913856c11b Save auth in localstorage and use it
Also consistently call it "email".
2024-08-28 01:08:27 -07:00
Eli Ribble 34ea77f7c3 Make enter key work on auth form.
It was bugging me.
2024-08-28 01:08:27 -07:00
Eli Ribble faca28f802 Actually make the login attempt to the well-known JMAP endpoint 2024-08-28 01:08:27 -07:00
Eli Ribble c6400d58d3 Save the username and password, show an alert to prove it. 2024-08-28 01:08:27 -07:00
Eli Ribble 9ff63d96fd Show an alert when we click the "login" button.
Yay, user interactivity.
2024-08-28 01:08:27 -07:00
Eli Ribble 302cbdd43d Add favicon and site title.
So I can find the tab, essentially.
2024-08-28 01:08:27 -07:00
Eli Ribble cda369a5f0 Auto pretty everything, add initial auth modal.
Sorry this isn't more commits, but, whatever.
2024-08-28 01:08:27 -07:00
Eli Ribble 9033b9862a Add pre-commit hook for formatting 2024-08-28 01:08:27 -07:00
Eli Ribble 91600be038 Add an autoformatter.
Seems fine.
2024-08-28 01:08:27 -07:00
Eli Ribble 16d9d4c4a4 Add authentication modal dialog and a stab at localstorage 2024-08-28 01:08:27 -07:00
Eli Ribble 8ea7aac4ed Make a basic remote request for data.
This uses an example from https://www.codingthesmartway.com/how-to-fetch-api-data-with-react/
and a public data API.
2024-08-28 01:08:27 -07:00
Eli Ribble 0878ec9435 Fix compiler warning.
I don't understand it, I just did exactly what it said to do.
2024-08-28 01:08:27 -07:00
Eli Ribble 48191baf2b Start of the mailbox list. 2024-08-28 01:08:27 -07:00
Eli Ribble d1746b6d17 Add react-bootstrap.
Now we're strappin'
2024-08-28 01:08:27 -07:00