Skip to content

Commit 5daec55

Browse files
Add back button (#42)
* add back button, changed favicon * add hover state to back button * chore(deps-dev): bump @types/react-dom from 18.2.12 to 18.2.14 (#23) Bumps [@types/react-dom](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react-dom) from 18.2.12 to 18.2.14. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react-dom) --- updated-dependencies: - dependency-name: "@types/react-dom" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps-dev): bump tailwindcss from 3.3.3 to 3.3.5 (#33) Bumps [tailwindcss](https://github.com/tailwindlabs/tailwindcss) from 3.3.3 to 3.3.5. - [Release notes](https://github.com/tailwindlabs/tailwindcss/releases) - [Changelog](https://github.com/tailwindlabs/tailwindcss/blob/master/CHANGELOG.md) - [Commits](tailwindlabs/tailwindcss@v3.3.3...v3.3.5) --- updated-dependencies: - dependency-name: tailwindcss dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps-dev): bump @types/node from 20.8.8 to 20.8.10 (#39) Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 20.8.8 to 20.8.10. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) --- updated-dependencies: - dependency-name: "@types/node" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1 parent c087503 commit 5daec55

File tree

6 files changed

+52
-12
lines changed

6 files changed

+52
-12
lines changed

src/app/favicon.ico

-10.3 KB
Binary file not shown.

src/app/globals.css

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,14 @@ body {
2929
.gridBox {
3030
grid-template-rows: repeat(7, minmax(0, 1fr));
3131
}
32+
33+
.arrowLeftIcon {
34+
padding: 5px;
35+
border-radius: 4px;
36+
height: 32px;
37+
width: 32px;
38+
}
39+
40+
.arrowLeftIcon:hover {
41+
background-color: #eeeeee;
42+
}

src/app/result/page.tsx

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { useGithubIssues } from "@/hooks/useGithubIssues"
99
import { IssuesAndPullRequests } from "../components/issues-and-prs"
1010
import "../globals.css"
1111
import ToolTip from "../components/tool-tip"
12+
import { ArrowLeftIcon } from "@radix-ui/react-icons"
1213

1314
const Page = () => {
1415
const searchParams = useSearchParams()
@@ -18,14 +19,14 @@ const Page = () => {
1819
memoizedIssues,
1920
memoizedPrs,
2021
loading,
21-
error,
2222
projects,
2323
toggleFilter,
2424
yearlyFilter,
2525
handleYearlyFilter,
2626
years,
2727
memoizedGraphValues,
28-
onClickToolTip
28+
onClickToolTip,
29+
goBack
2930
} = useGithubIssues()
3031

3132
return (
@@ -35,7 +36,17 @@ const Page = () => {
3536
style={{ gridTemplateColumns: "3fr 1fr" }}
3637
>
3738
<div className="w-full flex flex-col sm:border-2 md:p-8 md:pt-0 sm:pb-2 p-4 pt-0 gap-6 h-screen overflow-x-scroll">
38-
<section className="max-h-[201px] flex flex-col gap-4 pt-9">
39+
<section className="flex flex-col gap-4 pt-9">
40+
<button>
41+
<ArrowLeftIcon
42+
color="black"
43+
onClick={goBack}
44+
cursor="pointer"
45+
height="20px"
46+
width="20px"
47+
className="arrowLeftIcon"
48+
/>
49+
</button>
3950
<div className="flex gap-2 flex-col sm:justify-between sm:items-center sm:flex-row">
4051
<h2 className=" text-black capitalize">
4152
{username} contributions

src/helpers/utils.ts

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
import { Contribution, Contributions, GridSet } from "@/types"
1+
import {
2+
Contribution,
3+
Contributions,
4+
GridSet,
5+
GRID_BLUE,
6+
GRID_GRAY,
7+
GRID_GREEN,
8+
GRID_YELLOW
9+
} from "@/types"
210
import { Comment, IssuesObject } from "@/types/comments"
311
import { Project, PRsObject } from "@/types/pull_requests"
412

@@ -172,7 +180,7 @@ export function filterObject<Type extends { [s: string]: Array<any> }>(
172180
}
173181
}
174182

175-
const months = [
183+
export const months = [
176184
"Jan",
177185
"Feb",
178186
"Mar",
@@ -187,6 +195,8 @@ const months = [
187195
"Dec"
188196
]
189197

198+
const days = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]
199+
190200
export const getYearlyContributions = (
191201
year: string,
192202
prsData: PRsObject,
@@ -362,21 +372,21 @@ export const boxColor = (arg: Contribution) => {
362372
const { activity, is_active } = arg
363373

364374
if (!activity.length || is_active === false) {
365-
return "#EEEEEE"
375+
return GRID_GRAY
366376
} else {
367377
if (activity) {
368378
const allTypes = Array.from(new Set(activity.map((x) => x.type)))
369379

370380
if (allTypes.length === 1) {
371381
if (allTypes.includes("issues")) {
372-
return "#E7C23E"
382+
return GRID_YELLOW
373383
} else if (allTypes.includes("prs")) {
374-
return "#0783F5"
384+
return GRID_BLUE
375385
} else {
376-
return "#EEEEEE"
386+
return GRID_GRAY
377387
}
378388
} else {
379-
return "#39D353"
389+
return GRID_GREEN
380390
}
381391
}
382392
}

src/hooks/useGithubIssues.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
} from "@/helpers/get-comments"
88
import { getPullRequests } from "@/helpers/get-pull-requests"
99
import { Project, PRsObject } from "@/types/pull_requests"
10-
import { useSearchParams } from "next/navigation"
10+
import { useRouter, useSearchParams } from "next/navigation"
1111
import {
1212
createGridSet,
1313
extractYears,
@@ -20,6 +20,7 @@ import { IssuesObject } from "@/types/comments"
2020
import { Contribution } from "@/types"
2121

2222
export const useGithubIssues = () => {
23+
const Router = useRouter()
2324
const searchParams = useSearchParams()
2425
const username = searchParams.get("username")
2526
const currentDate = new Date()
@@ -168,6 +169,8 @@ export const useGithubIssues = () => {
168169
}
169170
}
170171

172+
const goBack = () => Router.back()
173+
171174
return {
172175
projects,
173176
loading,
@@ -180,6 +183,6 @@ export const useGithubIssues = () => {
180183
handleYearlyFilter,
181184
years,
182185
memoizedGraphValues,
183-
onClickToolTip
186+
onClickToolTip, goBack
184187
}
185188
}

src/types/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,8 @@ export type Contribution = {
1616
date: string
1717
activity: Array<{ date: string; type: string }>
1818
}
19+
20+
export const GRID_YELLOW = '#E7C23E'
21+
export const GRID_BLUE = '#0783F5'
22+
export const GRID_GRAY = '#EEEEEE'
23+
export const GRID_GREEN = '#39D353'

0 commit comments

Comments
 (0)