Skip to content
This repository has been archived by the owner on Apr 25, 2023. It is now read-only.

Commit

Permalink
chore: add remaining props to plugin settings extensions (#312)
Browse files Browse the repository at this point in the history
add lang and theme to plugin extensions
  • Loading branch information
KaWaite committed Sep 7, 2022
1 parent 3574f06 commit 893d32f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
Expand Up @@ -26,6 +26,8 @@ export type Props = {
library: Extension<"plugin-library">[] | undefined;
installed: Extension<"plugin-installed">[] | undefined;
};
currentTheme?: "light" | "dark";
currentLang?: string;
accessToken?: string;
onInstallByMarketplace: (pluginId: string) => void;
onInstallFromPublicRepo: (repoUrl: string) => void;
Expand All @@ -48,6 +50,8 @@ const PluginSection: React.FC<Props> = ({
marketplacePluginIds,
personalPlugins,
extensions,
currentTheme,
currentLang,
accessToken,
onInstallByMarketplace,
onInstallByUploadingZipFile,
Expand Down Expand Up @@ -81,6 +85,8 @@ const PluginSection: React.FC<Props> = ({
<ext.component
key={ext.id}
selectedPluginId={queriedPluginId}
theme={currentTheme}
lang={currentLang}
accessToken={accessToken}
onInstall={onInstallByMarketplace}
onUninstall={uninstallPlugin}
Expand All @@ -95,6 +101,8 @@ const PluginSection: React.FC<Props> = ({
<ext.component
key={ext.id}
installedPlugins={marketplacePluginIds}
theme={currentTheme}
lang={currentLang}
accessToken={accessToken}
onInstall={onInstallByMarketplace}
onUninstall={uninstallPlugin}
Expand Down
7 changes: 4 additions & 3 deletions src/components/organisms/Settings/Project/Plugin/hooks.ts
Expand Up @@ -10,13 +10,13 @@ import {
useUploadPluginMutation,
} from "@reearth/gql/graphql-client-api";
import { useLang, useT } from "@reearth/i18n";
import { useTeam, useProject, useNotification } from "@reearth/state";
import { useProject, useNotification, useCurrentTheme } from "@reearth/state";

export default (projectId: string) => {
const t = useT();
const locale = useLang();
const [currentTheme] = useCurrentTheme();
const client = useApolloClient();
const [currentTeam] = useTeam();
const [currentProject] = useProject();
const [, setNotification] = useNotification();
const { getAccessToken } = useAuth();
Expand Down Expand Up @@ -175,8 +175,9 @@ export default (projectId: string) => {

const loading = sceneLoading;
return {
currentTeam,
currentProject,
currentTheme,
currentLang: locale,
loading,
marketplacePluginIds,
personalPlugins,
Expand Down
6 changes: 5 additions & 1 deletion src/components/organisms/Settings/Project/Plugin/index.tsx
Expand Up @@ -18,9 +18,11 @@ const Plugin: React.FC<Props> = ({ projectId }) => {
const t = useT();
const {
currentProject,
currentTheme,
currentLang,
loading,
marketplacePluginIds,
personalPlugins,
loading,
extensions,
accessToken,
handleInstallByMarketplace,
Expand All @@ -38,6 +40,8 @@ const Plugin: React.FC<Props> = ({ projectId }) => {
marketplacePluginIds={marketplacePluginIds}
personalPlugins={personalPlugins}
extensions={extensions}
currentTheme={currentTheme}
currentLang={currentLang}
accessToken={accessToken}
onInstallByMarketplace={handleInstallByMarketplace}
onInstallByUploadingZipFile={handleInstallByUploadingZipFile}
Expand Down

0 comments on commit 893d32f

Please sign in to comment.