mirror of
https://github.com/wassname/talk.git
synced 2026-10-01 12:42:56 +08:00
[CORL-423] Rearrange client files and folder (#2352)
* chore: reorganize account * chore: reorganize install * chore: reorganize auth files * chore: reorganize admin files * fix: graphql naming * chore: adapt account routing
This commit is contained in:
1 parent
05c8f06ed8
commit
3947b143cb
559 files changed
+1691
-1755
No files matched your search
File renamed without changes.
@@ -6,8 +6,9 @@ import React, { FunctionComponent } from "react";
|
||||
|
||||
import { CoralContextConsumer } from "coral-framework/lib/bootstrap/CoralContext";
|
||||
|
||||
import routeConfig from "./routeConfig";
|
||||
import NotFound from "./routes/NotFound";
|
||||
import routeConfig from "../routeConfig";
|
||||
import NotFound from "../routes/NotFound";
|
||||
import MainLayout from "./MainLayout";
|
||||
|
||||
import "./App.css";
|
||||
|
||||
@@ -30,7 +31,9 @@ const Router = createFarceRouter({
|
||||
const EntryContainer: FunctionComponent = () => (
|
||||
<CoralContextConsumer>
|
||||
{({ relayEnvironment }) => (
|
||||
<Router resolver={new Resolver(relayEnvironment)} />
|
||||
<MainLayout>
|
||||
<Router resolver={new Resolver(relayEnvironment)} />
|
||||
</MainLayout>
|
||||
)}
|
||||
</CoralContextConsumer>
|
||||
);
|
||||
File renamed without changes.
File renamed without changes.
@@ -0,0 +1 @@
|
||||
export { default, default as App } from "./App";
|
||||
@@ -1 +0,0 @@
|
||||
export { default as CheckResetTokenFetch } from "./CheckResetTokenFetch";
|
||||
@@ -1 +0,0 @@
|
||||
export { default as ResetPasswordMutation } from "./ResetPasswordMutation";
|
||||
@@ -1,13 +1,12 @@
|
||||
import { makeRouteConfig, Route } from "found";
|
||||
import React from "react";
|
||||
|
||||
import MainLayout from "./components/MainLayout";
|
||||
import ResetPassword from "./routes/password/reset/Index";
|
||||
import ResetRoute from "./routes/password/Reset";
|
||||
|
||||
export default makeRouteConfig(
|
||||
<Route path="account" Component={MainLayout}>
|
||||
<Route path="account">
|
||||
<Route path="password">
|
||||
<Route path="reset" {...ResetPassword.routeConfig} />
|
||||
<Route path="reset" {...ResetRoute.routeConfig} />
|
||||
</Route>
|
||||
</Route>
|
||||
);
|
||||
@@ -1,7 +1,7 @@
|
||||
import { HorizontalGutter, Typography } from "coral-ui/components";
|
||||
import React, { FunctionComponent } from "react";
|
||||
|
||||
const NotFound: FunctionComponent = ({ children }) => (
|
||||
const NotFound: FunctionComponent = () => (
|
||||
<HorizontalGutter>
|
||||
<Typography variant="heading3">Not Found</Typography>
|
||||
</HorizontalGutter>
|
||||
|
||||
File renamed without changes.
+2
-1
@@ -3,7 +3,6 @@ import { Localized } from "fluent-react/compat";
|
||||
import React, { useCallback } from "react";
|
||||
import { Field, Form } from "react-final-form";
|
||||
|
||||
import { ResetPasswordMutation } from "coral-account/mutations";
|
||||
import { InvalidRequestError } from "coral-framework/lib/errors";
|
||||
import { useMutation } from "coral-framework/lib/relay";
|
||||
import {
|
||||
@@ -23,6 +22,8 @@ import {
|
||||
ValidationMessage,
|
||||
} from "coral-ui/components";
|
||||
|
||||
import ResetPasswordMutation from "./ResetPasswordMutation";
|
||||
|
||||
interface Props {
|
||||
token: string;
|
||||
disabled?: boolean;
|
||||
File renamed without changes.
+2
-2
@@ -11,7 +11,7 @@ interface Props {
|
||||
token: string | undefined;
|
||||
}
|
||||
|
||||
const Index: React.FunctionComponent<Props> = ({ token }) => {
|
||||
const ResetRoute: React.FunctionComponent<Props> = ({ token }) => {
|
||||
const [suceeded, setSuceeded] = useState<boolean>(false);
|
||||
const onSuccess = useCallback(() => {
|
||||
setSuceeded(true);
|
||||
@@ -28,6 +28,6 @@ const enhanced = withRouteConfig<Props>({
|
||||
render: ({ match, Component }) => (
|
||||
<Component token={parseHashQuery(match.location.hash).resetToken} />
|
||||
),
|
||||
})(Index);
|
||||
})(ResetRoute);
|
||||
|
||||
export default enhanced;
|
||||
+3
-4
@@ -1,12 +1,11 @@
|
||||
import { Localized } from "fluent-react/compat";
|
||||
import React, { useEffect, useState } from "react";
|
||||
|
||||
import { CheckResetTokenFetch } from "coral-account/fetches";
|
||||
import { ERROR_CODES } from "coral-common/errors";
|
||||
import { InvalidRequestError } from "coral-framework/lib/errors";
|
||||
import { useFetch } from "coral-framework/lib/relay";
|
||||
import { Delay, Flex, Spinner } from "coral-ui/components";
|
||||
import { Localized } from "fluent-react/compat";
|
||||
import React, { useEffect, useState } from "react";
|
||||
|
||||
import CheckResetTokenFetch from "./CheckResetTokenFetch";
|
||||
import Sorry from "./Sorry";
|
||||
|
||||
interface Props {
|
||||
File renamed without changes.
File renamed without changes.
@@ -0,0 +1 @@
|
||||
export { default, default as ResetRoute } from "./ResetRoute";
|
||||
+2
-2
@@ -25,7 +25,7 @@ const Router = createFarceRouter({
|
||||
),
|
||||
});
|
||||
|
||||
const EntryContainer: FunctionComponent = () => (
|
||||
const App: FunctionComponent = () => (
|
||||
<CoralContextConsumer>
|
||||
{({ relayEnvironment }) => (
|
||||
<Router resolver={new Resolver(relayEnvironment)} />
|
||||
@@ -33,4 +33,4 @@ const EntryContainer: FunctionComponent = () => (
|
||||
</CoralContextConsumer>
|
||||
);
|
||||
|
||||
export default EntryContainer;
|
||||
export default App;
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+1
-1
@@ -2,7 +2,7 @@ import React, { FunctionComponent } from "react";
|
||||
|
||||
import { PropTypesOf } from "coral-framework/types";
|
||||
|
||||
import DecisionHistoryItemContainer from "../containers/DecisionHistoryItemContainer";
|
||||
import DecisionHistoryItemContainer from "./DecisionHistoryItemContainer";
|
||||
import DecisionList from "./DecisionList";
|
||||
import Empty from "./Empty";
|
||||
import Main from "./Main";
|
||||
File renamed without changes.
+1
-1
@@ -3,7 +3,7 @@ import React, { FunctionComponent } from "react";
|
||||
|
||||
import { BaseButton, ClickOutside, Icon, Popover } from "coral-ui/components";
|
||||
|
||||
import DecisionHistoryQuery from "../views/decisionHistory/queries/DecisionHistoryQuery";
|
||||
import DecisionHistoryQuery from "./DecisionHistoryQuery";
|
||||
|
||||
import styles from "./DecisionHistoryButton.css";
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ import { DecisionHistoryContainer_viewer as ViewerData } from "coral-admin/__gen
|
||||
import { DecisionHistoryContainerPaginationQueryVariables } from "coral-admin/__generated__/DecisionHistoryContainerPaginationQuery.graphql";
|
||||
import { withPaginationContainer } from "coral-framework/lib/relay";
|
||||
|
||||
import DecisionHistory from "../components/DecisionHistory";
|
||||
import DecisionHistory from "./DecisionHistory";
|
||||
|
||||
interface DecisionHistoryContainerProps {
|
||||
viewer: ViewerData;
|
||||
+2
-2
@@ -4,8 +4,8 @@ import { graphql } from "react-relay";
|
||||
import { DecisionHistoryItemContainer_action as ActionData } from "coral-admin/__generated__/DecisionHistoryItemContainer_action.graphql";
|
||||
import { withFragmentContainer } from "coral-framework/lib/relay";
|
||||
|
||||
import ApprovedComment from "../components/ApprovedComment";
|
||||
import RejectedComment from "../components/RejectedComment";
|
||||
import ApprovedComment from "./ApprovedComment";
|
||||
import RejectedComment from "./RejectedComment";
|
||||
|
||||
interface DecisionHistoryItemContainerProps {
|
||||
action: ActionData;
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
+2
-2
@@ -3,8 +3,8 @@ import React, { Component } from "react";
|
||||
|
||||
import { DecisionHistoryQuery as QueryTypes } from "coral-admin/__generated__/DecisionHistoryQuery.graphql";
|
||||
|
||||
import DecisionHistoryLoading from "../components/DecisionHistoryLoading";
|
||||
import DecisionHistoryContainer from "../containers/DecisionHistoryContainer";
|
||||
import DecisionHistoryContainer from "./DecisionHistoryContainer";
|
||||
import DecisionHistoryLoading from "./DecisionHistoryLoading";
|
||||
|
||||
interface Props {
|
||||
onClosePopover: () => void;
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,4 @@
|
||||
export {
|
||||
default,
|
||||
default as DecisionHistoryButton,
|
||||
} from "./DecisionHistoryButton";
|
||||
File renamed without changes.
+4
-4
@@ -4,17 +4,17 @@ import { createRenderer } from "react-test-renderer/shallow";
|
||||
|
||||
import { PropTypesOf } from "coral-framework/types";
|
||||
|
||||
import App from "./App";
|
||||
import Main from "./Main";
|
||||
|
||||
const AppN = removeFragmentRefs(App);
|
||||
const MainN = removeFragmentRefs(Main);
|
||||
|
||||
it("renders correctly", () => {
|
||||
const props: PropTypesOf<typeof AppN> = {
|
||||
const props: PropTypesOf<typeof MainN> = {
|
||||
viewer: {},
|
||||
children: "child",
|
||||
};
|
||||
const renderer = createRenderer();
|
||||
|
||||
renderer.render(<AppN {...props} />);
|
||||
renderer.render(<MainN {...props} />);
|
||||
expect(renderer.getRenderOutput()).toMatchSnapshot();
|
||||
});
|
||||
@@ -4,12 +4,12 @@ import { PropTypesOf } from "coral-framework/types";
|
||||
import { Logo } from "coral-ui/components";
|
||||
import { AppBar, Begin, Divider, End } from "coral-ui/components/AppBar";
|
||||
|
||||
import NavigationContainer from "../containers/NavigationContainer";
|
||||
import UserMenuContainer from "../containers/UserMenuContainer";
|
||||
import DecisionHistoryButton from "./DecisionHistoryButton";
|
||||
import { DecisionHistoryButton } from "./DecisionHistory";
|
||||
import NavigationContainer from "./Navigation";
|
||||
import UserMenuContainer from "./UserMenu";
|
||||
import Version from "./Version";
|
||||
|
||||
import styles from "./App.css";
|
||||
import styles from "./Main.css";
|
||||
|
||||
interface Props {
|
||||
viewer: PropTypesOf<typeof UserMenuContainer>["viewer"] &
|
||||
@@ -17,7 +17,7 @@ interface Props {
|
||||
children: React.ReactNode;
|
||||
}
|
||||
|
||||
const App: FunctionComponent<Props> = ({ children, viewer }) => (
|
||||
const Main: FunctionComponent<Props> = ({ children, viewer }) => (
|
||||
<div className={styles.root}>
|
||||
<AppBar gutterBegin gutterEnd>
|
||||
<Begin itemGutter="double">
|
||||
@@ -37,4 +37,4 @@ const App: FunctionComponent<Props> = ({ children, viewer }) => (
|
||||
</div>
|
||||
);
|
||||
|
||||
export default App;
|
||||
export default Main;
|
||||
+8
-8
@@ -1,35 +1,35 @@
|
||||
import React from "react";
|
||||
|
||||
import { AppContainerQueryResponse } from "coral-admin/__generated__/AppContainerQuery.graphql";
|
||||
import { MainRouteQueryResponse } from "coral-admin/__generated__/MainRouteQuery.graphql";
|
||||
|
||||
import { graphql } from "coral-framework/lib/relay";
|
||||
import { withRouteConfig } from "coral-framework/lib/router";
|
||||
|
||||
import App from "../components/App";
|
||||
import Main from "./Main";
|
||||
|
||||
interface Props {
|
||||
data: AppContainerQueryResponse | null;
|
||||
data: MainRouteQueryResponse | null;
|
||||
}
|
||||
|
||||
class AppContainer extends React.Component<Props> {
|
||||
class MainRoute extends React.Component<Props> {
|
||||
public render() {
|
||||
return (
|
||||
<App viewer={this.props.data && this.props.data.viewer}>
|
||||
<Main viewer={this.props.data && this.props.data.viewer}>
|
||||
{this.props.children}
|
||||
</App>
|
||||
</Main>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const enhanced = withRouteConfig<Props>({
|
||||
query: graphql`
|
||||
query AppContainerQuery {
|
||||
query MainRouteQuery {
|
||||
viewer {
|
||||
...UserMenuContainer_viewer
|
||||
...NavigationContainer_viewer
|
||||
}
|
||||
}
|
||||
`,
|
||||
})(AppContainer);
|
||||
})(MainRoute);
|
||||
|
||||
export default enhanced;
|
||||
File renamed without changes.
File renamed without changes.
+1
-1
@@ -8,7 +8,7 @@ import {
|
||||
withSignOutMutation,
|
||||
} from "coral-framework/mutations";
|
||||
|
||||
import Navigation from "../components/Navigation";
|
||||
import Navigation from "./Navigation";
|
||||
|
||||
interface Props {
|
||||
signOut: SignOutMutation;
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loaded 100 of 559 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user