Template
fix: make template build, lint and test cleanly out of the box
This commit is contained in:
@@ -1,19 +1,10 @@
|
||||
import React from "react";
|
||||
import { useDispatch } from 'react-redux';
|
||||
import { Provider } from 'react-redux';
|
||||
import manifest from '../manifest';
|
||||
import usePlugin from '../utils/usePlugin';
|
||||
import React from 'react';
|
||||
|
||||
// Корневой компонент всегда присутствует на странице, но ничего не показывает сам по себе.
|
||||
// Держите здесь то, что должно работать постоянно: модальные окна, фоновую логику.
|
||||
// Доступ к объекту плагина — хук usePlugin() из ../utils/usePlugin.
|
||||
const RootComponent: React.FC = () => {
|
||||
const dispatch = useDispatch();
|
||||
const plugin = usePlugin();
|
||||
return null;
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
{/* Add your root component content here */}
|
||||
<p>Template Plugin Root Component</p>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default RootComponent
|
||||
export default RootComponent;
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
import { getPluginAssetsPath } from '../utils/utils';
|
||||
|
||||
export const basePath = getPluginAssetsPath();
|
||||
|
||||
// Add your assets configuration here
|
||||
export type AssetsType = {
|
||||
// Define your asset types
|
||||
}
|
||||
|
||||
const assets: AssetsType = {
|
||||
// Add your assets here
|
||||
} as const
|
||||
|
||||
export default assets
|
||||
@@ -1,5 +0,0 @@
|
||||
import Svgs from './svgs.js';
|
||||
|
||||
export {
|
||||
Svgs,
|
||||
};
|
||||
@@ -25,7 +25,7 @@ function pluginState(state: PluginStore = EmptyState, { type, data }: ActionType
|
||||
case ACTIONS.EXAMPLE_ACTION:
|
||||
return {
|
||||
...state,
|
||||
// Handle action
|
||||
...data,
|
||||
}
|
||||
default:
|
||||
return state;
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
// trackEvent: (event: Telemetry.Event, source: Telemetry.Source, props?: Record<string, string>) => void,
|
||||
@@ -1,18 +0,0 @@
|
||||
import { getTheme } from 'loop-plugin-sdk/loop/redux/selectors/entities/preferences';
|
||||
import { GlobalState } from 'loop-plugin-sdk/loop/types/store';
|
||||
import React, { useEffect } from "react";
|
||||
import { useSelector } from 'react-redux';
|
||||
import { isDarkTheme } from './colorUtils';
|
||||
|
||||
const useIsDarkTheme = () => {
|
||||
const [isDark, setIsDark] = React.useState(false);
|
||||
const theme = useSelector((state: GlobalState) => getTheme(state))
|
||||
|
||||
useEffect(() => {
|
||||
setIsDark(isDarkTheme());
|
||||
}, [theme])
|
||||
|
||||
return isDark
|
||||
}
|
||||
|
||||
export default useIsDarkTheme
|
||||
Reference in New Issue
Block a user