feat(admin): adapt new config system (#11360)

feat(server): add test mail api

feat(admin): adapt new config system
This commit is contained in:
forehalo
2025-04-01 15:00:10 +00:00
parent 8427293d36
commit dad858014f
29 changed files with 718 additions and 400 deletions
@@ -195,7 +195,7 @@ export function Template(props: PropsWithChildren) {
</>
);
if (env.testing) {
if (globalThis.env?.testing) {
return content;
}
+6 -1
View File
@@ -12,6 +12,7 @@ import {
TeamWorkspaceDeleted,
TeamWorkspaceUpgraded,
} from './teams';
import TestMail from './test-mail';
import {
ChangeEmail,
ChangeEmailNotification,
@@ -45,7 +46,7 @@ function render(component: React.ReactElement) {
});
}
type Props<T> = T extends React.FC<infer P> ? P : never;
type Props<T> = T extends React.ComponentType<infer P> ? P : never;
export type EmailRenderer<Props> = (props: Props) => Promise<EmailContent>;
function make<T extends React.ComponentType<any>>(
@@ -65,6 +66,10 @@ function make<T extends React.ComponentType<any>>(
}
export const Renderers = {
//#region Test
TestMail: make(TestMail, 'Test Email from AFFiNE'),
//#endregion
//#region User
SignIn: make(SignIn, 'Sign in to AFFiNE'),
SignUp: make(SignUp, 'Your AFFiNE account is waiting for you!'),
@@ -0,0 +1,12 @@
import { Content, P, Template, Title } from './components';
export default function TestMail() {
return (
<Template>
<Title>Test Email from AFFiNE</Title>
<Content>
<P>This is a test email from your AFFiNE instance.</P>
</Content>
</Template>
);
}