-
Notifications
You must be signed in to change notification settings - Fork 189
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
108 changed files
with
9,269 additions
and
416 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 []; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { Octokit } from "octokit"; | ||
|
||
const octokit = new Octokit(); | ||
|
||
export async function GET() { | ||
try { | ||
const response = await octokit.request("GET /repos/{owner}/{repo}/contributors", { | ||
owner: "latticexyz", | ||
repo: "mud", | ||
}); | ||
|
||
const allContributors = response.data; | ||
if (!Array.isArray(allContributors)) { | ||
return Response.json({ | ||
count: 0, | ||
contributors: [], | ||
}); | ||
} | ||
|
||
const userContributors = allContributors | ||
?.filter((contributor: { type: string }) => contributor.type === "User") | ||
.map((contributor) => { | ||
const weightedContributions = Math.log(contributor.contributions + 1) * 10; | ||
const index = Math.random() * weightedContributions; | ||
const score = weightedContributions - index; | ||
return { | ||
...contributor, | ||
score, | ||
}; | ||
}) | ||
.sort((a, b) => b.score - a.score); | ||
|
||
return Response.json({ | ||
count: userContributors.length, | ||
contributors: userContributors?.slice(0, 7), | ||
}); | ||
} catch (error) { | ||
console.error(error); | ||
return Response.json({ | ||
count: 0, | ||
contributors: [], | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { Octokit } from "octokit"; | ||
|
||
const octokit = new Octokit(); | ||
|
||
export async function GET() { | ||
try { | ||
const { | ||
data: { stargazers_count: totalStars }, | ||
} = await octokit.request("GET /repos/{owner}/{repo}", { | ||
owner: "latticexyz", | ||
repo: "mud", | ||
}); | ||
|
||
return Response.json(totalStars); | ||
} catch (error) { | ||
console.error(error); | ||
return Response.json(0); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
@tailwind base; | ||
@tailwind components; | ||
@tailwind utilities; | ||
|
||
/* Hide scrollbar for Chrome, Safari and Opera */ | ||
body::-webkit-scrollbar, | ||
div::-webkit-scrollbar, | ||
pre::-webkit-scrollbar { | ||
display: none; | ||
} | ||
|
||
body, | ||
div, | ||
pre { | ||
-ms-overflow-style: none; | ||
scrollbar-width: none; | ||
} | ||
|
||
html { | ||
background-color: black; | ||
} | ||
|
||
pre { | ||
font-size: 0.5; | ||
background-color: #222; | ||
border-color: #222; | ||
border-width: 1rem; | ||
border-radius: 0.4rem; | ||
overflow-x: scroll; | ||
margin-bottom: 18px; | ||
} | ||
|
||
summary { | ||
margin-bottom: 16px; | ||
} | ||
|
||
summary > p { | ||
display: inline; | ||
} | ||
|
||
/* Substack subscribe widget */ | ||
#custom-substack-embed { | ||
max-width: 530px !important; | ||
flex-direction: column !important; | ||
} | ||
|
||
#custom-substack-embed p { | ||
position: absolute !important; | ||
max-width: 530px !important; | ||
font-family: var(--font-supply-mono) !important; | ||
text-transform: uppercase !important; | ||
} | ||
|
||
.custom-substack-widget { | ||
flex-wrap: nowrap !important; | ||
max-width: 600px !important; | ||
border: none !important; | ||
border-radius: 0 !important; | ||
} | ||
|
||
.custom-substack-widget input { | ||
flex-basis: 100% !important; | ||
width: 100% !important; | ||
padding-left: 20px !important; | ||
padding-right: 20px !important; | ||
font-size: 20px !important; | ||
font-family: var(--font-supply-mono) !important; | ||
text-transform: uppercase !important; | ||
border: 1px solid rgba(255, 255, 255, 0.2) !important; | ||
box-sizing: border-box !important; | ||
} | ||
|
||
.custom-substack-widget input::placeholder { | ||
opacity: 0.3 !important; | ||
} | ||
|
||
.custom-substack-widget button { | ||
flex-shrink: 0 !important; | ||
flex-grow: 0 !important; | ||
width: 122px !important; | ||
/* flex-basis: 122px !important; */ | ||
border: none !important; | ||
padding: 23px 25px !important; | ||
margin-left: 15px !important; | ||
font-size: 20px !important; | ||
font-family: var(--font-supply-mono) !important; | ||
text-transform: uppercase !important; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.