Skip to content

Commit

Permalink
feat: uses username on highlight instead of full name (#162)
Browse files Browse the repository at this point in the history
* uses username instead of full name

* remove formatlink

---------

Co-authored-by: Brian 'bdougie' Douglas <[email protected]>
  • Loading branch information
bdougie and Brian 'bdougie' Douglas committed Jun 3, 2023
1 parent c345080 commit 801fe5a
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/pages/home.tsx
Expand Up @@ -23,6 +23,7 @@ interface Highlight {
title: string;
name: string;
url: string;
login: string;
}


Expand Down Expand Up @@ -57,16 +58,13 @@ const Home = () => {
setCurrentPage(prevPage => prevPage + 1);
};

const formatNameForLink = (name: string): string => name.replace(/\s/g, "");

useEffect(() => {
// Update the current name when the highlight changes
if (highlights[currentPage]?.name) {
setCurrentName(formatNameForLink(highlights[currentPage].name));
if (highlights[currentPage]?.login) {
setCurrentName(highlights[currentPage].login);
}
}, [highlights, currentPage]);


return (
<div className="p-4 bg-slate-800">
<div className="grid grid-cols-1 divide-y divide-white/40 divider-y-center-2 min-w-[320px] text-white">
Expand Down Expand Up @@ -119,13 +117,13 @@ const Home = () => {

<a
className="text-blue-500 hover:text-blue-700 underline cursor-pointer"
href={`https://insights.opensauced.pizza/user/${formatNameForLink(highlights[currentPage]?.name)}`}
href={`https://insights.opensauced.pizza/user/${highlights[currentPage]?.login}`}
rel="noopener noreferrer"
target="_blank"


>
{highlights[currentPage]?.name}
{highlights[currentPage]?.login}
</a>
</div>

Expand Down

0 comments on commit 801fe5a

Please sign in to comment.