fix: make template build, lint and test cleanly out of the box

This commit is contained in:
2026-09-25 09:05:40 +03:00
parent f3452876da
commit f0e09ef8c9
24 changed files with 128 additions and 244 deletions
+7 -16
View File
@@ -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;
-14
View File
@@ -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
-5
View File
@@ -1,5 +0,0 @@
import Svgs from './svgs.js';
export {
Svgs,
};
+1 -1
View File
@@ -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
View File
@@ -1 +0,0 @@
// trackEvent: (event: Telemetry.Event, source: Telemetry.Source, props?: Record<string, string>) => void,
-18
View File
@@ -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