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 @@
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>('');
......
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>;
......
......@@ -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 (
......
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);
......
import {CSVLink} from "react-csv";
import {useCommitsPositivity} from "@/app/hooks/useCommitDetails";
import {useCommitTestFiles} from "@/app/hooks/useCommitTestFiles";
const CsvDownloadTestFiles = ({commits, projectId, token, host}) => {
......
......@@ -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};
};
......
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