Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added backend/database/__init__.py
Empty file.
10 changes: 5 additions & 5 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,12 @@ function App() {
isAuthenticated ? <ProtectedLayout /> : <Navigate to="/login" replace />
}
>
<Route index element={<LandingPage setRepoData={setRepoData} />} />
<Route path="dashboard" element={<Dashboard repoData={repoData} />} />
<Route index element={<LandingPage setRepoData={setRepoData} message="Welcome! Enter a repository URL to get started." />} />
<Route path="dashboard" element={<Dashboard repoData={repoData} setRepoData={setRepoData} />} />
<Route path="integration" element={<BotIntegrationPage />} />
<Route path="contributors" element={<ContributorsPage repoData={repoData} />} />
<Route path="analytics" element={<AnalyticsPage repoData={repoData} />} />
<Route path="prs" element={<PullRequestsPage repoData={repoData} />} />
<Route path="contributors" element={<ContributorsPage repoData={repoData} setRepoData={setRepoData} />} />
<Route path="analytics" element={<AnalyticsPage repoData={repoData} setRepoData={setRepoData} />} />
<Route path="prs" element={<PullRequestsPage repoData={repoData} setRepoData={setRepoData} />} />
<Route path="support" element={<SupportPage />} />
<Route path="settings" element={<SettingsPage />} />
<Route path="profile" element={<ProfilePage />} />
Expand Down
6 changes: 4 additions & 2 deletions frontend/src/components/contributors/ContributorsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ import React, { useEffect, useState } from 'react';
import { motion } from 'framer-motion';
import { toast } from 'react-hot-toast';
import ContributorCard from './ContributorCard';
import LandingPage from '../landing/LandingPage';

interface Props {
repoData: any; // Fetched repository stats
setRepoData?: (data: any) => void;
}

const ContributorsPage: React.FC<Props> = ({ repoData }) => {
const ContributorsPage: React.FC<Props> = ({ repoData, setRepoData }) => {
const [contributors, setContributors] = useState<any[]>([]);
const [loading, setLoading] = useState(false);
const [error, setError] = useState<string | null>(null);
Expand All @@ -27,7 +29,7 @@ const ContributorsPage: React.FC<Props> = ({ repoData }) => {
};

if (!repoData) {
return <div>No data available. Please analyze a repository first.</div>;
return <LandingPage setRepoData={setRepoData || (() => {})} message="Please analyze a repository first to get started." />;
}

if (loading) {
Expand Down
6 changes: 4 additions & 2 deletions frontend/src/components/dashboard/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@ import { toast } from 'react-hot-toast';
import { Users, GitPullRequest, MessageSquare, Activity, Github, Slack } from 'lucide-react';
import StatCard from './StatCard';
import BotIntegration from '../integration/BotIntegration';
import LandingPage from '../landing/LandingPage';

interface Props {
repoData: any; // Fetched repository stats
setRepoData?: (data: any) => void; // Function to pass data to parent
}

const Dashboard: React.FC<Props> = ({ repoData }) => {
const Dashboard: React.FC<Props> = ({ repoData,setRepoData }) => {
if (!repoData) {
return <div>No data available. Please analyze a repository first.</div>;
return <LandingPage setRepoData={setRepoData || (() => {})} message="Please analyze a repository first to get started." />;
}

const handleNewIntegration = () => {
Expand Down
10 changes: 6 additions & 4 deletions frontend/src/components/landing/LandingPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ import { toast } from 'react-hot-toast';
import { useNavigate } from 'react-router-dom';

interface Props {
setRepoData: (data: any) => void; // Function to pass data to parent
setRepoData?: (data: any) => void;
message: string;
}

const LandingPage: React.FC<Props> = ({ setRepoData }) => {
const LandingPage: React.FC<Props> = ({ setRepoData, message="Enter a GitHub repository URL to analyze its stats." }) => {
const safeSetRepoData = setRepoData ?? (() => {});
const [repoUrl, setRepoUrl] = useState('');
const [loading, setLoading] = useState(false);
const navigate = useNavigate();
Expand All @@ -21,7 +23,7 @@ const LandingPage: React.FC<Props> = ({ setRepoData }) => {
setLoading(true);
try {
const response = await axios.post('http://localhost:8000/api/repo-stats', { repo_url: repoUrl });
setRepoData(response.data); // Pass fetched data to parent
safeSetRepoData(response.data);
toast.success('Repository stats fetched successfully!');
navigate('/dashboard'); // Navigate to dashboard
} catch (error) {
Expand All @@ -40,7 +42,7 @@ const LandingPage: React.FC<Props> = ({ setRepoData }) => {
>
<div className="bg-gray-900 p-8 rounded-lg shadow-lg w-full max-w-md">
<h1 className="text-3xl font-bold mb-4">Welcome to Devr.AI</h1>
<p className="text-gray-400 mb-6">Enter a GitHub repository URL to analyze its stats.</p>
<p className="text-gray-400 mb-6">{message}</p>
<input
type="text"
placeholder="https://github.com/owner/repo"
Expand Down
23 changes: 16 additions & 7 deletions frontend/src/components/pages/AnalyticsPage.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

import React from 'react';
import LandingPage from '../landing/LandingPage';
import {
BarChart3,
TrendingUp,
Expand Down Expand Up @@ -115,13 +115,22 @@ const pieData = [
const COLORS = ['#0088FE', '#00C49F', '#FFBB28'];

interface Props {
repoData: any;
repoData: any;
setRepoData?: (data: any) => void;
}

const AnalyticsPage: React.FC<Props> = ({ repoData }) => {
if (!repoData || !repoData.pull_requests) {
return <div>No data available. Please analyze a repository first.</div>;
}
const AnalyticsPage: React.FC<Props> = ({ repoData, setRepoData }) => {
if (!repoData) {
return <LandingPage setRepoData={setRepoData || (() => {})} message='Please analyze a repository first to get started.' />;
}
if (!repoData.pull_requests) {
return (
<div>
No data available for pull requests. Please analyze a repository
first.
</div>
);
}
const [selectedRange, setSelectedRange] = React.useState('Last Week');
const [activeIndex, setActiveIndex] = React.useState(0);

Expand Down Expand Up @@ -349,7 +358,7 @@ const AnalyticsPage: React.FC<Props> = ({ repoData }) => {
</div>
</div>
);
}
};

const renderActiveShape = (props: any) => {
const {
Expand Down
11 changes: 8 additions & 3 deletions frontend/src/components/pages/PullRequestsPage.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';
import LandingPage from '../landing/LandingPage';
import { motion } from 'framer-motion';

interface PullRequest {
Expand All @@ -17,11 +18,15 @@ interface PullRequest {

interface Props {
repoData: { pull_requests: { details: PullRequest[] } } | null;
setRepoData?: (data: any) => void;
}

const PullRequestsPage: React.FC<Props> = ({ repoData }) => {
if (!repoData || !repoData.pull_requests) {
return <div>No data available. Please analyze a repository first.</div>;
const PullRequestsPage: React.FC<Props> = ({ repoData, setRepoData }) => {
if (!repoData) {
return <LandingPage setRepoData={setRepoData || (() => {})} message='Please analyze a repository first to get started.' />;
}
if (!repoData.pull_requests) {
return <div>No data available for pull requests. Please analyze a repository first.</div>;
}

const prs = repoData.pull_requests.details;
Expand Down