Skip to content
Snippets Groups Projects
Commit bbbeca80 authored by Štěpán Šonovský's avatar Štěpán Šonovský
Browse files

chore: removed unused code

parent 81a0ed0d
No related branches found
No related tags found
No related merge requests found
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import CommitList from './CommitList'; import CommitList from './CommitList';
import CommitDetail from './CommitDetail'; import CommitDetail from './CommitDetail';
import { extractProjectIdFromUrl, extractGitlabDomainFromUrl } from '../../utils.ts'; import { extractProjectIdFromUrl, extractGitlabDomainFromUrl } from '@/utils';
const App: React.FC = () => { const App: React.FC = () => {
const [repoUrl, setRepoUrl] = useState<string>(''); const [repoUrl, setRepoUrl] = useState<string>('');
......
import React, { useEffect, useState } from 'react'; import React from 'react';
import api from "@/client";
import useCommitDetails from "@/app/hooks/useCommitDetails"; import useCommitDetails from "@/app/hooks/useCommitDetails";
import {useCommitFiles} from "@/app/hooks/useCommitFiles"; import {useCommitFiles} from "@/app/hooks/useCommitFiles";
...@@ -11,7 +10,7 @@ interface CommitDetailProps { ...@@ -11,7 +10,7 @@ interface CommitDetailProps {
const CommitDetail: React.FC<CommitDetailProps> = ({ projectId, commitId, token, host }) => { const CommitDetail: React.FC<CommitDetailProps> = ({ projectId, commitId, token, host }) => {
const { commit, loading, error } = useCommitDetails(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>; if (loading) return <p>Loading...</p>;
......
...@@ -8,25 +8,21 @@ const CsvButtons = ({projectId, token, host}) => { ...@@ -8,25 +8,21 @@ const CsvButtons = ({projectId, token, host}) => {
const [showCsvDownloadPositivity, setShowCsvDownloadPositivity] = useState(false); const [showCsvDownloadPositivity, setShowCsvDownloadPositivity] = useState(false);
const [showCsvDownloadSize, setShowCsvDownloadSize] = useState(false); const [showCsvDownloadSize, setShowCsvDownloadSize] = useState(false);
const [showCsvDownloadTestFiles, setShowCsvDownloadTestFiles] = 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); console.log(projectId, host);
const handleFetchSize = () => { const handleFetchSize = () => {
setShowCsvDownloadSize(true); setShowCsvDownloadSize(true);
setFetchCommits(true);
}; };
const handleFetchPositivity = () => { const handleFetchPositivity = () => {
setShowCsvDownloadPositivity(true); setShowCsvDownloadPositivity(true);
setFetchCommits(true);
}; };
const handleFetchTestFiles = () => { const handleFetchTestFiles = () => {
setShowCsvDownloadTestFiles(true); setShowCsvDownloadTestFiles(true);
setFetchCommits(true);
}; };
return ( return (
......
import { useState, useEffect, createRef } from 'react';
import { CSVLink } from "react-csv"; 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 CsvDownloadPositivity = ({ commits, projectId, token, host }) => {
const { data, isLoading } = useCommitsPositivity(projectId, commits, token, host); const { data, isLoading } = useCommitsPositivity(projectId, commits, token, host);
......
import {CSVLink} from "react-csv"; import {CSVLink} from "react-csv";
import {useCommitsPositivity} from "@/app/hooks/useCommitDetails";
import {useCommitTestFiles} from "@/app/hooks/useCommitTestFiles"; import {useCommitTestFiles} from "@/app/hooks/useCommitTestFiles";
const CsvDownloadTestFiles = ({commits, projectId, token, host}) => { const CsvDownloadTestFiles = ({commits, projectId, token, host}) => {
......
...@@ -11,7 +11,7 @@ export const useCommitsPositivity = (projectId, commitIds, token, host) => { ...@@ -11,7 +11,7 @@ export const useCommitsPositivity = (projectId, commitIds, token, host) => {
axios.get(`${host}/api/v4/projects/${projectId}/repository/commits/${commitId.id}`, { axios.get(`${host}/api/v4/projects/${projectId}/repository/commits/${commitId.id}`, {
headers: {'PRIVATE-TOKEN': token} headers: {'PRIVATE-TOKEN': token}
}).then(response => { }).then(response => {
const {id, author_name, created_at, stats} = response.data; const { author_name, created_at, stats} = response.data;
let commitType = 'mixed'; let commitType = 'mixed';
if (stats.additions > 0 && stats.deletions === 0) { if (stats.additions > 0 && stats.deletions === 0) {
commitType = 'addition'; commitType = 'addition';
...@@ -41,7 +41,7 @@ export const useCommitSize = (projectId, commitIds, token, host) => { ...@@ -41,7 +41,7 @@ export const useCommitSize = (projectId, commitIds, token, host) => {
axios.get(`${host}/api/v4/projects/${projectId}/repository/commits/${commitId.id}`, { axios.get(`${host}/api/v4/projects/${projectId}/repository/commits/${commitId.id}`, {
headers: {'PRIVATE-TOKEN': token} headers: {'PRIVATE-TOKEN': token}
}).then(response => { }).then(response => {
const {id, author_name, created_at, stats} = response.data; const {author_name, created_at, stats} = response.data;
let commitSize = 'small'; let commitSize = 'small';
const totalChanges = stats.additions + stats.deletions; const totalChanges = stats.additions + stats.deletions;
if (totalChanges > 50) { if (totalChanges > 50) {
...@@ -90,7 +90,7 @@ const useCommitDetails = (projectId: string, commitId: string, token: string, ho ...@@ -90,7 +90,7 @@ const useCommitDetails = (projectId: string, commitId: string, token: string, ho
}; };
fetchCommitDetails(); fetchCommitDetails();
}, [projectId, commitId, token]); }, [projectId, commitId, token, host]);
return {commit, loading, error}; return {commit, loading, error};
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment