mirror of
https://github.com/wassname/talk.git
synced 2026-08-05 13:30:26 +08:00
[next] Admin Configure (#2076)
* feat: Add RadioButton and CheckBox * feat: configure facebook and google auth * feat: configure sso, localAuth and displayName + some tests * test: add integration tests for configure auth * test: more integration tests * feat: add oidc support * test: add oidc integration test * feat: generate sso key initially * fix: import fetchQuery from correct package * fix: admin url * fix: set timezone to utc when testing * refactor: improve route config * fix: remove obsolete line * fix: clientMutationId increment * fix: oidc only create when enabled * fix: copy * test: update snapshots * feat: fixed graphql logging extension * Update src/locales/en-US/admin.ftl Co-Authored-By: cvle <vinh@wikiwi.io> * Apply suggestions from code review Co-Authored-By: cvle <vinh@wikiwi.io> * test: update snapshots * fix: change Local Auth to Email Authentication * fix: copy updates
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
import * as React from "react";
|
||||
import {
|
||||
hoistStatics,
|
||||
InferableComponentEnhancer,
|
||||
wrapDisplayName,
|
||||
} from "recompose";
|
||||
|
||||
/**
|
||||
* withContext is a HOC wrapper around `TalkContextConsumer`.
|
||||
* `propsCallback` must be provided which accepts the `TalkContext`
|
||||
* and returns the props the should be injected.
|
||||
*/
|
||||
function createContextHOC<Context>(
|
||||
displayName: string,
|
||||
Consumer: React.ComponentType<React.ConsumerProps<Context>>
|
||||
) {
|
||||
return function withContext<T>(
|
||||
propsCallback: (context: Context) => T
|
||||
): InferableComponentEnhancer<T> {
|
||||
return hoistStatics<T>(
|
||||
<U extends T>(WrappedComponent: React.ComponentType<U>) => {
|
||||
const Component: React.StatelessComponent<any> = props => (
|
||||
<Consumer>
|
||||
{context => (
|
||||
<WrappedComponent {...props} {...propsCallback(context)} />
|
||||
)}
|
||||
</Consumer>
|
||||
);
|
||||
Component.displayName = wrapDisplayName(WrappedComponent, displayName);
|
||||
return Component;
|
||||
}
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
export default createContextHOC;
|
||||
@@ -2,3 +2,4 @@ export { default as getMe } from "./getMe";
|
||||
export { default as getMeSourceID } from "./getMeSourceID";
|
||||
export { default as getURLWithCommentID } from "./getURLWithCommentID";
|
||||
export { default as urls } from "./urls";
|
||||
export { default as createContextHOC } from "./createContextHOC";
|
||||
|
||||
@@ -7,7 +7,7 @@ export default (process.env.NODE_ENV !== "development"
|
||||
},
|
||||
}
|
||||
: {
|
||||
admin: "/admin.html",
|
||||
admin: "/admin",
|
||||
embed: {
|
||||
stream: "/stream.html",
|
||||
auth: "/auth.html",
|
||||
|
||||
Reference in New Issue
Block a user