Skip to content

Commit 4c8d9dd

Browse files
authored
fix: Browser Back button not functioning after redirecting to the Analytics page from the Project details page gf-540 (#542)
* feat: add check for initial load in use search filters hook gf-540 * feat: add contributor name search preselected on redirection gf-540 * fix: add link to contributor item activity chart gf-540
1 parent a6b96c4 commit 4c8d9dd

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

apps/frontend/src/libs/components/chart/chart.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,17 @@ import styles from "./styles.module.css";
66

77
type Properties = {
88
data: ChartData;
9+
isCursorPointer: boolean;
910
};
1011

11-
const Chart = ({ data }: Properties): JSX.Element => {
12+
const Chart = ({ data, isCursorPointer }: Properties): JSX.Element => {
1213
return (
13-
<LineChart data={data} height={40} width={120}>
14+
<LineChart
15+
data={data}
16+
height={40}
17+
style={{ cursor: isCursorPointer ? "pointer" : "default" }}
18+
width={120}
19+
>
1420
<Line className={styles["line"] as string} dataKey="y" dot={false} />
1521
</LineChart>
1622
);

apps/frontend/src/libs/hooks/use-search-filters/use-search-filters.hook.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,15 @@ const useSearchFilters = ({
2020
: "";
2121
const [search, setSearch] = useState<string>(searchParameter);
2222

23+
const [isInitialLoad, setIsInitialLoad] = useState<boolean>(true);
24+
2325
useEffect(() => {
26+
if (isInitialLoad) {
27+
setIsInitialLoad(false);
28+
29+
return;
30+
}
31+
2432
if (isSavedToUrl) {
2533
const updatedSearchParameters = new URLSearchParams(searchParameters);
2634
updatedSearchParameters.set(queryParameterName, search);

apps/frontend/src/pages/project/libs/components/contributor-card/contributor-card.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ const ContributorCard = ({
4747
}: Properties): JSX.Element => {
4848
const analyticsRoute = configureQueryString(AppRoute.ANALYTICS, [
4949
[QueryParameterName.PROJECT_ID, projectId],
50+
[QueryParameterName.SEARCH, contributor.name],
5051
]);
5152

5253
const currentDate = getStartOfDay(new Date());
@@ -94,7 +95,11 @@ const ContributorCard = ({
9495
{hasActivityIndicator && (
9596
<ActivityIndicator label={lastUpdateLabel} status={colorStatus} />
9697
)}
97-
{hasActivityData && <Chart data={activityData} />}
98+
{hasActivityData && (
99+
<NavLink to={analyticsRoute}>
100+
<Chart data={activityData} isCursorPointer />
101+
</NavLink>
102+
)}
98103
<ContributorMenu
99104
contributorId={contributor.id}
100105
hasEditPermission={hasEditPermission}

0 commit comments

Comments
 (0)