-
-
Notifications
You must be signed in to change notification settings - Fork 38
feat: export buttons for json and text format #19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ed the exportText function
Someone is attempting to deploy a commit to a Personal Account owned by @Balastrong on Vercel. @Balastrong first needs to authorize it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a few comments but the overall logic seems correct! :)
Also please make sure to format the file (you can use npm run format:fix
in your terminal) and restore the .env.example
file :)
src/pages/stats/[login].tsx
Outdated
{repositories?.map(({ repository, contributions }) => ( | ||
<div key={repository.name}> | ||
<div key={repository.name} id="repo-content"> | ||
{repository.owner.login}/{repository.name} ( | ||
{contributions.totalCount}) | ||
<br /> | ||
{contributions.nodes.map(({ pullRequest }) => ( | ||
<span key={pullRequest.id}> | ||
<span key={pullRequest.id} id="pr-content"> | ||
{pullRequest.title} - {pullRequest.state} | ||
<br /> | ||
</span> | ||
))} | ||
<br /> | ||
</div> | ||
))} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can now replace all of this with generateText to make sure it is the exact same output
{repositories?.map(({ repository, contributions }) => ( | |
<div key={repository.name}> | |
<div key={repository.name} id="repo-content"> | |
{repository.owner.login}/{repository.name} ( | |
{contributions.totalCount}) | |
<br /> | |
{contributions.nodes.map(({ pullRequest }) => ( | |
<span key={pullRequest.id}> | |
<span key={pullRequest.id} id="pr-content"> | |
{pullRequest.title} - {pullRequest.state} | |
<br /> | |
</span> | |
))} | |
<br /> | |
</div> | |
))} | |
{generateText()} |
src/pages/stats/[login].tsx
Outdated
{pullRequest.title} - {pullRequest.state} | ||
<br /> | ||
</span> | ||
))} | ||
<br /> | ||
</div> | ||
))} | ||
<button className="bg-blue-500 p-2 m-1 rounded hover:bg-blue-900" onClick={exportText}>Export as Text</button> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we put this button before the text? Same as you did for the JSON :)
src/pages/stats/[login].tsx
Outdated
|
||
text += "\n"; | ||
} | ||
console.log(text) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you remove this console.log
?
src/pages/stats/[login].tsx
Outdated
@@ -80,35 +151,43 @@ export default function Stats() { | |||
{isLoading ? ( | |||
<div>Loading...</div> | |||
) : format === "cards" ? ( | |||
<div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This duplicate div
can be removed
src/pages/stats/[login].tsx
Outdated
@@ -2,7 +2,7 @@ import { RepositoryContributionsCard } from "@/components"; | |||
import { useGitHubPullRequests } from "@/hooks"; | |||
import { useSession } from "next-auth/react"; | |||
import { useRouter } from "next/router"; | |||
import { useState } from "react"; | |||
import { useEffect, useState } from "react"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
useEffect is no longer used, can be removed
Sure |
I have done the changes, check it once! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thank you again! 🚀
Created a generate text function and a button to export it.
Added a button for downloading in json format as well. :)