diff --git a/src/app/components/App.tsx b/src/app/components/App.tsx index b5cb1b8f29ea11d55788d122407e4faa881188e1..8bd67b49c35605351469889545df4020894a94a6 100644 --- a/src/app/components/App.tsx +++ b/src/app/components/App.tsx @@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react'; import CommitList from './CommitList'; import CommitDetail from './CommitDetail'; -import { extractProjectIdFromUrl, extractGitlabDomainFromUrl } from '../../utils.ts'; +import { extractProjectIdFromUrl, extractGitlabDomainFromUrl } from '@/utils'; const App: React.FC = () => { const [repoUrl, setRepoUrl] = useState<string>(''); diff --git a/src/app/components/CommitDetail.tsx b/src/app/components/CommitDetail.tsx index 0e00a9dba7289acff4e1d0e0ec4c2afe72d588a5..5051b809af83b97d4ce74142cb3ee7463b9e4e86 100644 --- a/src/app/components/CommitDetail.tsx +++ b/src/app/components/CommitDetail.tsx @@ -1,5 +1,4 @@ -import React, { useEffect, useState } from 'react'; -import api from "@/client"; +import React from 'react'; import useCommitDetails from "@/app/hooks/useCommitDetails"; import {useCommitFiles} from "@/app/hooks/useCommitFiles"; @@ -11,7 +10,7 @@ interface CommitDetailProps { const CommitDetail: React.FC<CommitDetailProps> = ({ projectId, commitId, token, host }) => { const { commit, loading, error } = useCommitDetails(projectId, commitId, token, host); - const { files, loadingE, errorE } = useCommitFiles(projectId, commitId, token); + const { files} = useCommitFiles(projectId, commitId, token); if (loading) return <p>Loading...</p>; diff --git a/src/app/csvDownload/CsvButtons.tsx b/src/app/csvDownload/CsvButtons.tsx index e71778ceb1863cef7ae99eb6c1d34f51a8c969ff..9acf406fb23b65f93263231a05dfd7f957732a4d 100644 --- a/src/app/csvDownload/CsvButtons.tsx +++ b/src/app/csvDownload/CsvButtons.tsx @@ -8,25 +8,21 @@ const CsvButtons = ({projectId, token, host}) => { const [showCsvDownloadPositivity, setShowCsvDownloadPositivity] = useState(false); const [showCsvDownloadSize, setShowCsvDownloadSize] = useState(false); const [showCsvDownloadTestFiles, setShowCsvDownloadTestFiles] = useState(false); - const [fetchCommits, setFetchCommits] = useState(false); - const {commits, loading, error} = useCommitsAll(projectId, token, host); + const {commits} = useCommitsAll(projectId, token, host); console.log(projectId, host); const handleFetchSize = () => { setShowCsvDownloadSize(true); - setFetchCommits(true); }; const handleFetchPositivity = () => { setShowCsvDownloadPositivity(true); - setFetchCommits(true); }; const handleFetchTestFiles = () => { setShowCsvDownloadTestFiles(true); - setFetchCommits(true); }; return ( diff --git a/src/app/csvDownload/CsvDownload.tsx b/src/app/csvDownload/CsvDownload.tsx index 3d4e93ef342d723387b963a4706c316521d9c9bc..7f503d0048d634a449e809edcf124b967ce8d1db 100644 --- a/src/app/csvDownload/CsvDownload.tsx +++ b/src/app/csvDownload/CsvDownload.tsx @@ -1,6 +1,5 @@ -import { useState, useEffect, createRef } from 'react'; import { CSVLink } from "react-csv"; -import useCommitDetails, { useCommitsPositivity } from "@/app/hooks/useCommitDetails"; +import { useCommitsPositivity } from "@/app/hooks/useCommitDetails"; const CsvDownloadPositivity = ({ commits, projectId, token, host }) => { const { data, isLoading } = useCommitsPositivity(projectId, commits, token, host); diff --git a/src/app/csvDownload/CsvDownloadTestFiles.tsx b/src/app/csvDownload/CsvDownloadTestFiles.tsx index fafd9fb04415d61204843e3ebb680da291300cd8..f3d949120172dd3177e17202877db7f3439f947c 100644 --- a/src/app/csvDownload/CsvDownloadTestFiles.tsx +++ b/src/app/csvDownload/CsvDownloadTestFiles.tsx @@ -1,5 +1,4 @@ import {CSVLink} from "react-csv"; -import {useCommitsPositivity} from "@/app/hooks/useCommitDetails"; import {useCommitTestFiles} from "@/app/hooks/useCommitTestFiles"; const CsvDownloadTestFiles = ({commits, projectId, token, host}) => { diff --git a/src/app/hooks/useCommitDetails.ts b/src/app/hooks/useCommitDetails.ts index 05d9d5d6bed0b2cb71e66588314f18deb58dc06d..fc3975463e08418e4cb69c1833f5e63a60c7cbe9 100644 --- a/src/app/hooks/useCommitDetails.ts +++ b/src/app/hooks/useCommitDetails.ts @@ -11,7 +11,7 @@ export const useCommitsPositivity = (projectId, commitIds, token, host) => { axios.get(`${host}/api/v4/projects/${projectId}/repository/commits/${commitId.id}`, { headers: {'PRIVATE-TOKEN': token} }).then(response => { - const {id, author_name, created_at, stats} = response.data; + const { author_name, created_at, stats} = response.data; let commitType = 'mixed'; if (stats.additions > 0 && stats.deletions === 0) { commitType = 'addition'; @@ -41,7 +41,7 @@ export const useCommitSize = (projectId, commitIds, token, host) => { axios.get(`${host}/api/v4/projects/${projectId}/repository/commits/${commitId.id}`, { headers: {'PRIVATE-TOKEN': token} }).then(response => { - const {id, author_name, created_at, stats} = response.data; + const {author_name, created_at, stats} = response.data; let commitSize = 'small'; const totalChanges = stats.additions + stats.deletions; if (totalChanges > 50) { @@ -90,7 +90,7 @@ const useCommitDetails = (projectId: string, commitId: string, token: string, ho }; fetchCommitDetails(); - }, [projectId, commitId, token]); + }, [projectId, commitId, token, host]); return {commit, loading, error}; };