drishti/src/MailboxList.tsx
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

40 lines
895 B
TypeScript

import React from "react";
import Stack from "react-bootstrap/Stack";
import Client from "./client/Client";
import { IAccount } from "./client/types";
import Mailbox from "./Mailbox";
type MailboxListProps = {
account: IAccount | null;
client: Client | null;
};
type MailboxListState = {};
class MailboxList extends React.Component<MailboxListProps, MailboxListState> {
componentDidUpdate() {
if (this.props.account == null) return;
if (this.props.client == null) return;
this.props.client.mailboxList(this.props.account.id, []);
}
render() {
return this.props.account == null ||
this.props.account.mailboxes == null ? (
<Stack />
) : (
<Stack>
{this.props.account.mailboxes.map((m) => (
<Mailbox
accountId={this.props.account!.id}
id={m.id}
key={m.id}
name={m.name}
/>
))}
</Stack>
);
}
}
export default MailboxList;