Skip to content

Commit

Permalink
update quarry url
Browse files Browse the repository at this point in the history
  • Loading branch information
karooolis committed Nov 10, 2024
1 parent 5bdf018 commit e5b831f
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 34 deletions.
17 changes: 17 additions & 0 deletions docs/app/api/contributors/getContributors.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { headers } from "next/headers";

export async function getContributors() {
const headersList = headers();
const host = headersList.get("host") || "";
const protocol = headersList.get("x-forwarded-proto") || "http";
const baseUrl = `${protocol}://${host}`;

try {
const response = await fetch(`${baseUrl}/api/contributors`);
const data = await response.json();
return data;
} catch (error) {
console.error(error);
return [];
}
}
17 changes: 17 additions & 0 deletions docs/app/api/stargazers/getStargazers.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { headers } from "next/headers";

export async function getStargazers() {
const headersList = headers();
const host = headersList.get("host") || "";
const protocol = headersList.get("x-forwarded-proto") || "http";
const baseUrl = `${protocol}://${host}`;

try {
const response = await fetch(`${baseUrl}/api/stargazers`);
const data = await response.json();
return data;
} catch (error) {
console.error(error);
return 0;
}
}
28 changes: 0 additions & 28 deletions docs/app/api/stargazers/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@ import { Octokit } from "octokit";

const octokit = new Octokit();

// TODO: bring back?
// type Stargazer = {
// timestamp: Date;
// total: number;
// };

export async function GET() {
try {
const {
Expand All @@ -17,28 +11,6 @@ export async function GET() {
repo: "mud",
});

// TODO: bring back?
// const totalPages = Math.ceil(totalStars / 100);
// let allStargazers: Stargazer[] = [];
// for (let page = 0; page < totalPages; page++) {
// const { data: stargazers } = await octokit.request("GET /repos/{owner}/{repo}/stargazers", {
// owner: "latticexyz",
// repo: "mud",
// headers: {
// accept: "application/vnd.github.star+json",
// },
// per_page: 100,
// page: page + 1,
// });

// const stargazersWithTotal = stargazers.map((star, index) => ({
// timestamp: new Date(star.starred_at),
// total: allStargazers.length + index + 1,
// }));

// allStargazers = [...allStargazers, ...stargazersWithTotal];
// }

return Response.json(totalStars);
} catch (error) {
console.error(error);
Expand Down
1 change: 0 additions & 1 deletion docs/app/sections/TrustedBy/GitHubStars.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import React from "react";

async function getStargazers() {
// TODO: get full url
try {
const response = await fetch("http://localhost:3000/api/stargazers");
const data = await response.json();
Expand Down
8 changes: 3 additions & 5 deletions docs/app/sections/TrustedBy/TrustedBy.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
"use client";

import { Container } from "../../../components/ui/Container";
import { Section } from "../../../components/ui/Section";
import { GitHubStars } from "./GitHubStars";
import Contributors from "./Contributors";
import Projects from "./Projects";

export default async function TrustedBy() {
export default function TrustedBy() {
return (
<Section className="bg-[#E56A10] border-t border-t-white/20 py-8 lg:py-8">
<Container>
Expand All @@ -20,8 +18,8 @@ export default async function TrustedBy() {
</div>

<div className="grid grid-cols-1 sm:grid-cols-3 gap-12 sm:gap-4 w-full">
{/* <GitHubStars />
<Contributors /> */}
<GitHubStars />
<Contributors />
<Projects />
</div>
</div>
Expand Down

0 comments on commit e5b831f

Please sign in to comment.