Skip to content

Commit

Permalink
chore: refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
louis-menlo committed Sep 18, 2023
1 parent df15fa7 commit d7149ac
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 26 deletions.
15 changes: 15 additions & 0 deletions web-client/app/_components/Preferences.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,28 @@
"use client";
import { useEffect } from "react";
import {
setup,
plugins,
extensionPoints,
activationPoints,
} from "../../node_modules/pluggable-electron/dist/execution.es.js";
/* eslint-disable @next/next/no-sync-scripts */
export const Preferences = () => {
useEffect(() => {
async function setupPE() {
// Enable activation point management
setup({
importer: (plugin) =>
//@ts-ignore
import(/* webpackIgnore: true */ plugin).catch((err) => {
console.log(err);
}),
});

// Register all active plugins with their activation points
await plugins.registerActive();
}
setupPE();
// Install a new plugin on clicking the install button
document
?.getElementById("install-file")
Expand Down
26 changes: 0 additions & 26 deletions web-client/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,7 @@ import JotaiWrapper from "./_helpers/JotaiWrapper";
import LeftContainer from "./_components/LeftContainer";
import RightContainer from "./_components/RightContainer";
import { ModalWrapper } from "./_helpers/ModalWrapper";
import { useEffect } from "react";
import { Preferences } from "./_components/Preferences";
import dynamic from "next/dynamic";
import Head from "next/head";
import {
setup,
plugins,
} from "../node_modules/pluggable-electron/dist/execution.es.js";
const Page: React.FC = () => {
useEffect(() => {
async function setupPE() {
// Enable activation point management
setup({
importer: (plugin) =>
//@ts-ignore
import(/* webpackIgnore: true */ plugin).catch((err) => {
console.log(err);
}),
});

// Register all active plugins with their activation points
await plugins.registerActive();
}
setupPE();
});

return (
<>
<ApolloWrapper>
Expand All @@ -45,7 +20,6 @@ const Page: React.FC = () => {
</ThemeWrapper>
</JotaiWrapper>
</ApolloWrapper>
{/* <>{typeof window !== "undefined" ? <Preferences /> : <></>}</> */}
</>
);
};
Expand Down

0 comments on commit d7149ac

Please sign in to comment.