Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
AnushkaChouhan25 authored Nov 10, 2024
2 parents 821747b + b0f04f5 commit 2b65283
Show file tree
Hide file tree
Showing 10 changed files with 445 additions and 115 deletions.
16 changes: 10 additions & 6 deletions app/api/popular/route.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
const axios = require('axios');
import { NextResponse } from 'next/server';
import axios from 'axios';

async function getPopularRepositories() {
export async function GET() {
const url = 'https://api.github.com/search/repositories?q=stars:>10000&sort=stars';
try {
const response = await axios.get(url);
const repositories = response.data.items;
return repositories; // This contains the most popular repositories
return NextResponse.json(repositories); // This contains the most popular repositories
} catch (error) {
console.error('Error fetching repositories:', error);
return NextResponse.json(
{ error: 'Failed to fetch repositories' },
{ status: 500 }
);
}
}

getPopularRepositories().then(repos => {
GET().then(repos => {
console.log(repos);
});
});
60 changes: 56 additions & 4 deletions app/faq/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"use client";
"use client";
import React, { useState } from 'react';
import { Plus, Minus } from "lucide-react";

Expand All @@ -7,8 +7,16 @@ const Faq: React.FC = () => {

const toggleAccordion = (index: number) => {
setActiveIndex(activeIndex === index ? null : index);
};
};
import {
Accordion,
AccordionContent,
AccordionItem,
AccordionTrigger,
} from "@/components/ui/accordion"

const Faq: React.FC = () => {

const faqData = [
{ question: "What is Git-trace?", answer: "Git-trace is an open-source tool that allows users to view and bookmark GitHub repositories and issues, making it easier to keep track of projects." },
{ question: "What features does Git-trace offer?", answer: "Git-trace allows you to search for repositories, view issues related to those repositories, and bookmark important repositories and issues for quick access." },
Expand All @@ -22,7 +30,7 @@ const Faq: React.FC = () => {
return (
<div className="faq-container" style={{ maxWidth: '1000px', margin: 'auto', marginTop: '5rem' }}>
<strong><h1>Frequently Asked Questions</h1></strong>
<br />
<br />

<div className="faq-items-container dark:text-white bg-slate-50 dark:bg-gray-900" style={{ borderRadius: '8px', boxShadow: '0 2px 1px rgba(0, 0, 0, 0.1)', padding: '20px' }}>
{faqData.map((item, index) => (
Expand Down Expand Up @@ -53,7 +61,51 @@ const Faq: React.FC = () => {
)}
</div>
))}
</div>
</div>
<Accordion type="single" collapsible>
<AccordionItem value="item-1">
<AccordionTrigger>What is Git-trace?</AccordionTrigger>
<AccordionContent>
Git-trace is an open-source tool that allows users to view and bookmark GitHub repositories and issues, making it easier to keep track of projects.
</AccordionContent>
</AccordionItem>
<AccordionItem value="item-2">
<AccordionTrigger>What features does Git-trace offer?</AccordionTrigger>
<AccordionContent>
Git-trace allows you to search for repositories, view issues related to those repositories, and bookmark important repositories and issues for quick access.
</AccordionContent>
</AccordionItem>
<AccordionItem value="item-3">
<AccordionTrigger>What technology stack is used for Git-trace?</AccordionTrigger>
<AccordionContent>
Git-trace uses Next.js and React for the frontend,while the backend utilizes GitHub&#39;s API for data retrieval, along with Prisma and Neon DB for data management.
</AccordionContent>
</AccordionItem>
<AccordionItem value="item-4">
<AccordionTrigger>How do I search for repositories on Git-trace?</AccordionTrigger>
<AccordionContent>
You can search for repositories by entering the owner&#39;s name and the repository&#39;s name in the search bar.
</AccordionContent>
</AccordionItem>
<AccordionItem value="item-5">
<AccordionTrigger>How can I bookmark repositories and issues?</AccordionTrigger>
<AccordionContent>
After viewing a repository or issue, you can use the bookmarking feature to save it for easy access later.
</AccordionContent>
</AccordionItem>
<AccordionItem value="item-6">
<AccordionTrigger>What should I do if I encounter issues while using Git-trace?</AccordionTrigger>
<AccordionContent>
You can report any issues on the GitHub repository, where maintainers and the community can assist you.
</AccordionContent>
</AccordionItem>
<AccordionItem value="item-7">
<AccordionTrigger>Can I use Git-trace without installing it locally?</AccordionTrigger>
<AccordionContent>
Yes, you can access Git-trace directly through the web at git-trace.vercel.com.
</AccordionContent>
</AccordionItem>
</Accordion>
</div>
);
};
Expand Down
19 changes: 18 additions & 1 deletion app/provider.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
"use client";

import ProgressBar from "@/components/Progressbar";
import { SessionProvider } from "next-auth/react";
import { ThemeProvider as NextThemesProvider } from "next-themes"
import { type ThemeProviderProps } from "next-themes/dist/types"
import { ScrollToTop } from "react-simple-scroll-up";

type Props = {
children?: React.ReactNode;
Expand All @@ -14,5 +16,20 @@ export const Providers = ({ children }: Props) => {


export function ThemeProvider({ children, ...props }: ThemeProviderProps) {
return <NextThemesProvider {...props}>{children}</NextThemesProvider>
return (
<NextThemesProvider {...props}>
{" "}
<ProgressBar /> {children}{" "}
<ScrollToTop
className="scroll-to-top"
symbol={<span style={{ fontSize: "2.2rem" }}>&#8593;</span>}
size={60}
bgColor="#2C2A2A"
strokeWidth={5}
strokeFillColor="#fff"
strokeEmptyColor="#505050"
symbolColor="#F5FBFA"
/>{" "}
</NextThemesProvider>
);
}
52 changes: 52 additions & 0 deletions components/Progressbar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { useState, useEffect } from "react";

const ProgressBar = () => {
const [scrollProgress, setScrollProgress] = useState(0);

// Update progress bar on scroll
useEffect(() => {
const handleScroll = () => {
const totalHeight =
document.documentElement.scrollHeight - window.innerHeight;
const scrollPosition = window.pageYOffset;
const scrollPercentage = (scrollPosition / totalHeight) * 100;
setScrollProgress(scrollPercentage);
};

window.addEventListener("scroll", handleScroll);
return () => {
window.removeEventListener("scroll", handleScroll);
};
}, []);

return (
<>
<div
className="progress-bar-container"
style={{
position: "fixed",
top: "0",
left: "0",
width: "100%",
zIndex: "99999",
height: "7px",
}}
>
{/* Glowing Progress Bar */}
<div
className="progress-bar"
style={{
border: "none",
borderRadius: "2rem",
height: "100%",
width: `${scrollProgress}%`,
background: "linear-gradient(90deg, #ffff ,#404f78)",
boxShadow: "0 0 2px #ffff, 0 0 5px #404f78, 0 0 10px #2F80ED",
}}
></div>
</div>
</>
);
};

export default ProgressBar;
56 changes: 56 additions & 0 deletions components/ui/accordion.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
"use client"

import * as React from "react"
import * as AccordionPrimitive from "@radix-ui/react-accordion"
import { cn } from "@/lib/utils"
import { ChevronDownIcon } from "@radix-ui/react-icons"

const Accordion = AccordionPrimitive.Root

const AccordionItem = React.forwardRef<
React.ElementRef<typeof AccordionPrimitive.Item>,
React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Item>
>(({ className, ...props }, ref) => (
<AccordionPrimitive.Item
ref={ref}
className={cn("border-b", className)}
{...props}
/>
))
AccordionItem.displayName = "AccordionItem"

const AccordionTrigger = React.forwardRef<
React.ElementRef<typeof AccordionPrimitive.Trigger>,
React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger>
>(({ className, children, ...props }, ref) => (
<AccordionPrimitive.Header className="flex">
<AccordionPrimitive.Trigger
ref={ref}
className={cn(
"flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline text-left [&[data-state=open]>svg]:rotate-180",
className
)}
{...props}
>
{children}
<ChevronDownIcon className="h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200" />
</AccordionPrimitive.Trigger>
</AccordionPrimitive.Header>
))
AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName

const AccordionContent = React.forwardRef<
React.ElementRef<typeof AccordionPrimitive.Content>,
React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Content>
>(({ className, children, ...props }, ref) => (
<AccordionPrimitive.Content
ref={ref}
className="overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down"
{...props}
>
<div className={cn("pb-4 pt-0", className)}>{children}</div>
</AccordionPrimitive.Content>
))
AccordionContent.displayName = AccordionPrimitive.Content.displayName

export { Accordion, AccordionItem, AccordionTrigger, AccordionContent }
5 changes: 4 additions & 1 deletion next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ const nextConfig = {
},
images:{
domains: ['via.placeholder.com']
}
},
eslint: {
ignoreDuringBuilds: true,
},
};

export default nextConfig;
Loading

0 comments on commit 2b65283

Please sign in to comment.