Allow selecting an email, and adding it to the hash.

We don't do anything with it yet, though
This commit is contained in:
Eli Ribble 2024-08-28 10:16:11 -07:00
parent e68a21dcc4
commit d6b675f7b6
2 changed files with 24 additions and 4 deletions

View File

@ -42,6 +42,7 @@ class EmailList extends React.Component<EmailListProps, EmailListState> {
emailId={e}
email={this.props.client!.email(e)}
key={e}
mailbox={this.props.mailbox}
/>
))}
</Stack>

View File

@ -1,12 +1,15 @@
import React from "react";
import Placeholder from "react-bootstrap/Placeholder";
import Client from "./client/Client";
import { IAccount, IEmail } from "./client/types";
import { IAccount, IEmail, IMailbox } from "./client/types";
type EmailSummaryProps = {
account: IAccount | null;
client: Client | null;
email: IEmail | null;
emailId: string;
mailbox: IMailbox | null;
};
type EmailSummaryState = {};
@ -28,11 +31,27 @@ class EmailSummary extends React.Component<
}
render() {
if (this.props.account == null || this.props.mailbox == null) {
return (
<div className="p-2 border pe-auto" key={this.props.emailId}>
<Placeholder animation="glow" />
</div>
);
}
const href =
"#" +
this.props.account.id +
"/" +
this.props.mailbox.id +
"/" +
this.props.emailId;
return (
<div className="p-2 border" key={this.props.emailId}>
{this.props.email != null
? this.props.email.subject
: this.props.emailId}
<a className="btn" href={href}>
{this.props.email != null
? this.props.email.subject
: this.props.emailId}
</a>
</div>
);
}