Skip to content

Commit

Permalink
style: use react-service-provider
Browse files Browse the repository at this point in the history
  • Loading branch information
makamekm committed Oct 6, 2020
1 parent 8c71358 commit e13136a
Show file tree
Hide file tree
Showing 14 changed files with 27 additions and 91 deletions.
7 changes: 6 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@
"react-spring": "^8.0.27",
"react-toastify": "^6.0.5",
"react-virtualized": "^9.21.2",
"react-service-provider": "^1.2.0",
"@reach/dialog": "^0.11.2",
"recharts": "^2.0.0-beta.5",
"safe-eval": "^0.4.1",
Expand Down
27 changes: 11 additions & 16 deletions src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ import React from "react";
import { HashRouter as Router } from "react-router-dom";
import { RoutedContent } from "./routing";
import { AppLayout } from "./app/Layout/AppLayout";
import {
ServiceProviderFactory,
ServiceProviderHook,
} from "./components/ServiceProvider/ServiceProvider";
import { useServiceProvider } from "react-service-provider";
import { AuthService } from "./app/Auth/AuthService";
import { LoadingScreen } from "./app/Loading/LoadingScreen";
import { LoadingService } from "./app/Loading/LoadingService";
Expand All @@ -20,18 +17,16 @@ import { LayoutService } from "./components/Layout/LayoutService";
const basePath = process.env.BASE_PATH || "/";

export const App = () => {
const [ServiceProvider] = React.useState<React.FC>(() =>
ServiceProviderFactory(
AuthService,
LayoutService,
LoadingService,
FavouriteService,
DashboardService,
SearchService,
MessageService,
RepositoryUserService,
ConfigService
)
const [ServiceProvider, ServiceProviderHook] = useServiceProvider(
AuthService,
LayoutService,
LoadingService,
FavouriteService,
DashboardService,
SearchService,
MessageService,
RepositoryUserService,
ConfigService
);

return (
Expand Down
2 changes: 1 addition & 1 deletion src/app/Auth/AuthService.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from "react";
import md5 from "md5";
import { useLocalStore } from "mobx-react";
import { useHistory, useLocation } from "react-router";
import { createService } from "~/components/ServiceProvider/ServiceProvider";
import { createService } from "react-service-provider";
import { LoadingService } from "../Loading/LoadingService";
import { useOnChange } from "~/hooks";
import { ipc } from "~/shared/ipc";
Expand Down
2 changes: 1 addition & 1 deletion src/app/ConfigService.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import { useLocalStore } from "mobx-react";
import { createService } from "~/components/ServiceProvider/ServiceProvider";
import { createService } from "react-service-provider";
import { LoadingService } from "./Loading/LoadingService";
import { useOnChange } from "~/hooks";
import { ipc } from "~/shared/ipc";
Expand Down
2 changes: 1 addition & 1 deletion src/app/Dashboard/DashboardService.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import { useLocalStore } from "mobx-react";
import { createService } from "~/components/ServiceProvider/ServiceProvider";
import { createService } from "react-service-provider";
import { useOnChange, useDelay } from "~/hooks";
import { Config } from "~/shared/Config";
import { ipc, IpcHandler } from "~/shared/ipc";
Expand Down
2 changes: 1 addition & 1 deletion src/app/Dashboard/FavouriteService.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import { useLocalStore } from "mobx-react";
import moment from "moment";
import { createService } from "~/components/ServiceProvider/ServiceProvider";
import { createService } from "react-service-provider";
import { useSyncLocalStorage, useOnLoadPathname, useOnChange } from "~/hooks";
import { Config } from "~/shared/Config";
import { ipc } from "~/shared/ipc";
Expand Down
2 changes: 1 addition & 1 deletion src/app/Dashboard/MessageService.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import { useLocalStore } from "mobx-react";
import { createService } from "~/components/ServiceProvider/ServiceProvider";
import { createService } from "react-service-provider";
import { useOnChange, useDelay } from "~/hooks";
import { ipc } from "~/shared/ipc";
import { DashboardState, DashboardService } from "./DashboardService";
Expand Down
2 changes: 1 addition & 1 deletion src/app/Dashboard/RepositoryUserService.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import { useLocalStore } from "mobx-react";
import { createService } from "~/components/ServiceProvider/ServiceProvider";
import { createService } from "react-service-provider";
import { useDelay } from "~/hooks";
import { ipc } from "~/shared/ipc";
import { DashboardService, DashboardState } from "./DashboardService";
Expand Down
2 changes: 1 addition & 1 deletion src/app/Layout/SearchService.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import { useLocalStore } from "mobx-react";
import { createService } from "~/components/ServiceProvider/ServiceProvider";
import { createService } from "react-service-provider";
import { useOnLoad, useOnChange } from "~/hooks";
import { Config } from "~/shared/Config";
import { ipc } from "~/shared/ipc";
Expand Down
2 changes: 1 addition & 1 deletion src/app/Loading/LoadingService.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import { useLocalStore } from "mobx-react";
import { createService } from "~/components/ServiceProvider/ServiceProvider";
import { createService } from "react-service-provider";
import { useOnLoad, useOnChange } from "~/hooks";

export interface LoadingStore {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Layout/LayoutService.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import { createService } from "~/components/ServiceProvider/ServiceProvider";
import { createService } from "react-service-provider";
import { useLocalStore } from "mobx-react";
import { isEqual } from "lodash";
import { useSimpleSyncLocalStorage } from "~/hooks";
Expand Down
54 changes: 0 additions & 54 deletions src/components/ServiceProvider/ServiceProvider.tsx

This file was deleted.

11 changes: 0 additions & 11 deletions src/components/ServiceProvider/context.tsx

This file was deleted.

0 comments on commit e13136a

Please sign in to comment.