mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-05 16:23:36 +00:00
Fix linter issues
This commit is contained in:
3 files changed
+29
-17
No files matched your search
@@ -7,13 +7,14 @@ import { Label } from '@/components/ui/label';
|
||||
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from '@/components/ui/accordion';
|
||||
import { Separator } from '@/components/ui/separator';
|
||||
import { usePlugins } from '@/hooks/usePlugins';
|
||||
import { usePluginGitInfo } from '@/hooks/usePluginGitInfo';
|
||||
import { useToast } from '@/hooks/useToast';
|
||||
import { Alert, AlertDescription } from '@/components/ui/alert';
|
||||
|
||||
export function PluginsSection() {
|
||||
const { t } = useTranslation();
|
||||
const { toast } = useToast();
|
||||
const { plugins, skills, clonePlugin, syncPlugin, deletePlugin, getPluginGitInfo } = usePlugins();
|
||||
const { plugins, skills, clonePlugin, syncPlugin, deletePlugin } = usePlugins();
|
||||
const [gitUrl, setGitUrl] = useState('');
|
||||
|
||||
const handleAddPlugin = async () => {
|
||||
@@ -108,7 +109,6 @@ export function PluginsSection() {
|
||||
isDeleting={isDeleting}
|
||||
onSync={handleSyncPlugin}
|
||||
onDelete={handleDeletePlugin}
|
||||
getPluginGitInfo={getPluginGitInfo}
|
||||
/>;
|
||||
})}
|
||||
</div>
|
||||
@@ -180,12 +180,11 @@ interface PluginItemProps {
|
||||
isDeleting: boolean;
|
||||
onSync: (pluginName: string) => void;
|
||||
onDelete: (pluginName: string) => void;
|
||||
getPluginGitInfo: (pluginName: string) => { data: { commitHash: string; commitDate: Date; commitMessage: string } | null | undefined; isLoading: boolean };
|
||||
}
|
||||
|
||||
function PluginItem({ pluginName, pluginSkills, isSyncing, isDeleting, onSync, onDelete, getPluginGitInfo }: PluginItemProps) {
|
||||
function PluginItem({ pluginName, pluginSkills, isSyncing, isDeleting, onSync, onDelete }: PluginItemProps) {
|
||||
const { t } = useTranslation();
|
||||
const { data: gitInfo } = getPluginGitInfo(pluginName);
|
||||
const { data: gitInfo } = usePluginGitInfo(pluginName);
|
||||
|
||||
return (
|
||||
<Accordion type="single" collapsible className="w-full">
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { useFS } from './useFS';
|
||||
import { useFSPaths } from './useFSPaths';
|
||||
import { getPluginGitInfo } from '@/lib/plugins';
|
||||
|
||||
/**
|
||||
* Hook to get git info for a specific plugin
|
||||
*/
|
||||
export function usePluginGitInfo(pluginName: string) {
|
||||
const { fs } = useFS();
|
||||
const { pluginsPath } = useFSPaths();
|
||||
|
||||
return useQuery({
|
||||
queryKey: ['plugin-git-info', pluginsPath, pluginName],
|
||||
queryFn: async () => {
|
||||
return await getPluginGitInfo(fs, pluginsPath, pluginName);
|
||||
},
|
||||
enabled: !!pluginName,
|
||||
});
|
||||
}
|
||||
+5
-12
@@ -1,7 +1,7 @@
|
||||
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
|
||||
import { useFS } from './useFS';
|
||||
import { useFSPaths } from './useFSPaths';
|
||||
import { getPlugins, getAllSkills, deletePlugin as deletePluginFn, getPluginGitInfo, type PluginGitInfo } from '@/lib/plugins';
|
||||
import { getPlugins, getAllSkills, deletePlugin as deletePluginFn } from '@/lib/plugins';
|
||||
import { useGit } from './useGit';
|
||||
import { join } from 'path-browserify';
|
||||
|
||||
@@ -91,6 +91,10 @@ export function usePlugins() {
|
||||
dir: pluginDir,
|
||||
singleBranch: true,
|
||||
fastForward: true,
|
||||
author: {
|
||||
name: 'shakespeare.diy',
|
||||
email: '[email protected]',
|
||||
},
|
||||
});
|
||||
|
||||
return pluginName;
|
||||
@@ -115,16 +119,6 @@ export function usePlugins() {
|
||||
},
|
||||
});
|
||||
|
||||
// Function to get git info for a specific plugin
|
||||
const getPluginGitInfoQuery = (pluginName: string) => {
|
||||
return useQuery({
|
||||
queryKey: ['plugin-git-info', pluginsPath, pluginName],
|
||||
queryFn: async () => {
|
||||
return await getPluginGitInfo(fs, pluginsPath, pluginName);
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
return {
|
||||
plugins: pluginsQuery.data || [],
|
||||
isLoadingPlugins: pluginsQuery.isLoading,
|
||||
@@ -133,6 +127,5 @@ export function usePlugins() {
|
||||
clonePlugin,
|
||||
syncPlugin,
|
||||
deletePlugin,
|
||||
getPluginGitInfo: getPluginGitInfoQuery,
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user