diff --git a/.release-please-manifest.json b/.release-please-manifest.json index e04432c13..3078c39d4 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,7 +1,7 @@ { - ".": "1.54.0", - "apps/backend": "1.33.3", - "apps/frontend": "1.50.0", - "packages/shared": "1.31.1", - "scripts/analytics": "1.7.0" + ".": "1.56.0", + "apps/backend": "1.35.0", + "apps/frontend": "1.52.0", + "packages/shared": "1.33.0", + "scripts/analytics": "1.8.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index dec5fde0f..4e08608dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,30 @@ # Changelog +## [1.56.0](https://github.com/BinaryStudioAcademy/bsa-2024-gitfit/compare/v1.55.0...v1.56.0) (2024-09-25) + + +### Features + +* add search field to analytics page gf-352 ([#444](https://github.com/BinaryStudioAcademy/bsa-2024-gitfit/issues/444)) ([71dcfb1](https://github.com/BinaryStudioAcademy/bsa-2024-gitfit/commit/71dcfb15462b289bad70d90f65875bea40bbc560)) +* upgrade the visibility of the project's options button on the project detail page gf-508 ([#514](https://github.com/BinaryStudioAcademy/bsa-2024-gitfit/issues/514)) ([1d7d6f1](https://github.com/BinaryStudioAcademy/bsa-2024-gitfit/commit/1d7d6f1f8ed86321fe2b7231c0424d06a5772daa)) + + +### Bug Fixes + +* reload contributors on split gf-519 ([#525](https://github.com/BinaryStudioAcademy/bsa-2024-gitfit/issues/525)) ([f766ce8](https://github.com/BinaryStudioAcademy/bsa-2024-gitfit/commit/f766ce8145a202626ad154753dc01e1af5ee29f4)) + +## [1.55.0](https://github.com/BinaryStudioAcademy/bsa-2024-gitfit/compare/v1.54.0...v1.55.0) (2024-09-25) + + +### Features + +* add an ability to mark contributors as hidden gf-346 ([#400](https://github.com/BinaryStudioAcademy/bsa-2024-gitfit/issues/400)) ([6143e4c](https://github.com/BinaryStudioAcademy/bsa-2024-gitfit/commit/6143e4cb851e28de4080230e5e80e0665f65f41f)) + + +### Bug Fixes + +* adjusted loader and placeholder to render properly when loading gf-515 ([#520](https://github.com/BinaryStudioAcademy/bsa-2024-gitfit/issues/520)) ([f94c6b6](https://github.com/BinaryStudioAcademy/bsa-2024-gitfit/commit/f94c6b614d4e2a2f37f41a62d7cb2d5d1594d513)) + ## [1.54.0](https://github.com/BinaryStudioAcademy/bsa-2024-gitfit/compare/v1.53.1...v1.54.0) (2024-09-25) diff --git a/apps/backend/CHANGELOG.md b/apps/backend/CHANGELOG.md index 535fe9b38..62bd4f92d 100644 --- a/apps/backend/CHANGELOG.md +++ b/apps/backend/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## [1.35.0](https://github.com/BinaryStudioAcademy/bsa-2024-gitfit/compare/backend-v1.34.0...backend-v1.35.0) (2024-09-25) + + +### Features + +* add search field to analytics page gf-352 ([#444](https://github.com/BinaryStudioAcademy/bsa-2024-gitfit/issues/444)) ([71dcfb1](https://github.com/BinaryStudioAcademy/bsa-2024-gitfit/commit/71dcfb15462b289bad70d90f65875bea40bbc560)) + +## [1.34.0](https://github.com/BinaryStudioAcademy/bsa-2024-gitfit/compare/backend-v1.33.3...backend-v1.34.0) (2024-09-25) + + +### Features + +* add an ability to mark contributors as hidden gf-346 ([#400](https://github.com/BinaryStudioAcademy/bsa-2024-gitfit/issues/400)) ([6143e4c](https://github.com/BinaryStudioAcademy/bsa-2024-gitfit/commit/6143e4cb851e28de4080230e5e80e0665f65f41f)) + ## [1.33.3](https://github.com/BinaryStudioAcademy/bsa-2024-gitfit/compare/backend-v1.33.2...backend-v1.33.3) (2024-09-25) diff --git a/apps/backend/package.json b/apps/backend/package.json index c7ccb18f6..fb1ba6204 100644 --- a/apps/backend/package.json +++ b/apps/backend/package.json @@ -1,7 +1,7 @@ { "name": "@git-fit/backend", "type": "module", - "version": "1.33.3", + "version": "1.35.0", "engines": { "node": "20.x.x", "npm": "10.x.x" diff --git a/apps/backend/src/modules/activity-logs/activity-log.repository.ts b/apps/backend/src/modules/activity-logs/activity-log.repository.ts index 8e241c599..8b068cf64 100644 --- a/apps/backend/src/modules/activity-logs/activity-log.repository.ts +++ b/apps/backend/src/modules/activity-logs/activity-log.repository.ts @@ -41,6 +41,7 @@ class ActivityLogRepository implements Repository { } public async findAll({ + contributorName, endDate, projectId, startDate, @@ -56,6 +57,10 @@ class ActivityLogRepository implements Repository { .whereBetween("activity_logs.date", [startDate, endDate]) .orderBy("date"); + if (contributorName) { + query.whereILike("gitEmail:contributor.name", `%${contributorName}%`); + } + if (projectId) { query.where("project_id", projectId); } diff --git a/apps/backend/src/modules/activity-logs/activity-log.service.ts b/apps/backend/src/modules/activity-logs/activity-log.service.ts index 962f978ec..a603cb3fa 100644 --- a/apps/backend/src/modules/activity-logs/activity-log.service.ts +++ b/apps/backend/src/modules/activity-logs/activity-log.service.ts @@ -137,6 +137,7 @@ class ActivityLogService implements Service { } public async findAll({ + contributorName, endDate, projectId, startDate, @@ -152,6 +153,7 @@ class ActivityLogService implements Service { ); const activityLogsEntities = await this.activityLogRepository.findAll({ + contributorName, endDate: formattedEndDate, projectId, startDate: formattedStartDate, @@ -162,6 +164,7 @@ class ActivityLogService implements Service { ); const allContributors = await this.contributorService.findAll({ + contributorName, projectId: projectId ? Number(projectId) : undefined, }); @@ -201,8 +204,8 @@ class ActivityLogService implements Service { commitsNumber: commitsArray, contributor: { hiddenAt: null, - id: contributorId ?? "", - name: contributorName ?? "", + id: contributorId as string, + name: contributorName as string, }, }; }), diff --git a/apps/backend/src/modules/contributors/contributor.controller.ts b/apps/backend/src/modules/contributors/contributor.controller.ts index 64b6c81dc..c52adaf3e 100644 --- a/apps/backend/src/modules/contributors/contributor.controller.ts +++ b/apps/backend/src/modules/contributors/contributor.controller.ts @@ -172,9 +172,11 @@ class ContributorController extends BaseController { query: ContributorGetAllRequestDto; }>, ): Promise { - const { hasHidden, page, pageSize, projectId } = options.query; + const { contributorName, hasHidden, page, pageSize, projectId } = + options.query; const query = { + ...(contributorName ? { contributorName } : {}), ...(hasHidden ? { hasHidden: Boolean(hasHidden) } : {}), ...(page ? { page: Number(page) } : {}), ...(pageSize ? { pageSize: Number(pageSize) } : {}), diff --git a/apps/backend/src/modules/contributors/contributor.repository.ts b/apps/backend/src/modules/contributors/contributor.repository.ts index 93347441e..7fd22e3b7 100644 --- a/apps/backend/src/modules/contributors/contributor.repository.ts +++ b/apps/backend/src/modules/contributors/contributor.repository.ts @@ -57,6 +57,7 @@ class ContributorRepository implements Repository { } public async findAll({ + contributorName, hasHidden = false, page, pageSize, @@ -88,6 +89,10 @@ class ContributorRepository implements Repository { query.whereNull("contributors.hiddenAt"); } + if (contributorName) { + query.whereILike("contributors.name", `%${contributorName}%`); + } + if (projectId) { query.havingRaw("?? = ANY(ARRAY_AGG(projects.id))", projectId); } diff --git a/apps/frontend/CHANGELOG.md b/apps/frontend/CHANGELOG.md index 1ed925175..3898cfed1 100644 --- a/apps/frontend/CHANGELOG.md +++ b/apps/frontend/CHANGELOG.md @@ -1,5 +1,30 @@ # Changelog +## [1.52.0](https://github.com/BinaryStudioAcademy/bsa-2024-gitfit/compare/frontend-v1.51.0...frontend-v1.52.0) (2024-09-25) + + +### Features + +* add search field to analytics page gf-352 ([#444](https://github.com/BinaryStudioAcademy/bsa-2024-gitfit/issues/444)) ([71dcfb1](https://github.com/BinaryStudioAcademy/bsa-2024-gitfit/commit/71dcfb15462b289bad70d90f65875bea40bbc560)) +* upgrade the visibility of the project's options button on the project detail page gf-508 ([#514](https://github.com/BinaryStudioAcademy/bsa-2024-gitfit/issues/514)) ([1d7d6f1](https://github.com/BinaryStudioAcademy/bsa-2024-gitfit/commit/1d7d6f1f8ed86321fe2b7231c0424d06a5772daa)) + + +### Bug Fixes + +* reload contributors on split gf-519 ([#525](https://github.com/BinaryStudioAcademy/bsa-2024-gitfit/issues/525)) ([f766ce8](https://github.com/BinaryStudioAcademy/bsa-2024-gitfit/commit/f766ce8145a202626ad154753dc01e1af5ee29f4)) + +## [1.51.0](https://github.com/BinaryStudioAcademy/bsa-2024-gitfit/compare/frontend-v1.50.0...frontend-v1.51.0) (2024-09-25) + + +### Features + +* add an ability to mark contributors as hidden gf-346 ([#400](https://github.com/BinaryStudioAcademy/bsa-2024-gitfit/issues/400)) ([6143e4c](https://github.com/BinaryStudioAcademy/bsa-2024-gitfit/commit/6143e4cb851e28de4080230e5e80e0665f65f41f)) + + +### Bug Fixes + +* adjusted loader and placeholder to render properly when loading gf-515 ([#520](https://github.com/BinaryStudioAcademy/bsa-2024-gitfit/issues/520)) ([f94c6b6](https://github.com/BinaryStudioAcademy/bsa-2024-gitfit/commit/f94c6b614d4e2a2f37f41a62d7cb2d5d1594d513)) + ## [1.50.0](https://github.com/BinaryStudioAcademy/bsa-2024-gitfit/compare/frontend-v1.49.1...frontend-v1.50.0) (2024-09-25) diff --git a/apps/frontend/package.json b/apps/frontend/package.json index 8339f801c..352360e77 100644 --- a/apps/frontend/package.json +++ b/apps/frontend/package.json @@ -1,7 +1,7 @@ { "name": "@git-fit/frontend", "private": true, - "version": "1.50.0", + "version": "1.52.0", "type": "module", "engines": { "node": "20.x.x", diff --git a/apps/frontend/src/libs/components/menu/menu.tsx b/apps/frontend/src/libs/components/menu/menu.tsx index c75c27ddc..f56a45661 100644 --- a/apps/frontend/src/libs/components/menu/menu.tsx +++ b/apps/frontend/src/libs/components/menu/menu.tsx @@ -1,8 +1,11 @@ +import { type ComponentProps } from "react"; + import { IconButton, Popover } from "~/libs/components/components.js"; import styles from "./styles.module.css"; type Properties = { + buttonVariant?: ComponentProps["variant"]; children: React.ReactNode; isOpened: boolean; onClose: () => void; @@ -10,6 +13,7 @@ type Properties = { }; const Menu = ({ + buttonVariant = "primary", children, isOpened, onClose, @@ -29,6 +33,7 @@ const Menu = ({ iconName="ellipsis" label="options" onClick={isOpened ? onClose : onOpen} + variant={buttonVariant} /> ); diff --git a/apps/frontend/src/modules/activity/activity-logs-api.ts b/apps/frontend/src/modules/activity/activity-logs-api.ts index 3856d51e4..004429308 100644 --- a/apps/frontend/src/modules/activity/activity-logs-api.ts +++ b/apps/frontend/src/modules/activity/activity-logs-api.ts @@ -23,9 +23,10 @@ class ActivityLogApi extends BaseHTTPApi { public async getAll( query: ActivityLogQueryParameters, ): Promise { - const { endDate, projectId, startDate } = query; + const { contributorName, endDate, projectId, startDate } = query; const queryToSend = { + ...(contributorName ? { contributorName } : {}), endDate, startDate, ...(projectId ? { projectId } : {}), diff --git a/apps/frontend/src/modules/contributors/slices/contributor.slice.ts b/apps/frontend/src/modules/contributors/slices/contributor.slice.ts index 4a9060b11..47628e8ee 100644 --- a/apps/frontend/src/modules/contributors/slices/contributor.slice.ts +++ b/apps/frontend/src/modules/contributors/slices/contributor.slice.ts @@ -100,27 +100,7 @@ const { actions, name, reducer } = createSlice({ builder.addCase(split.pending, (state) => { state.splitContributorsStatus = DataStatus.PENDING; }); - builder.addCase(split.fulfilled, (state, action) => { - const { id: splittingContributorId } = action.meta.arg; - const { payload: newContributor } = action; - - state.contributors = state.contributors.map((contributor) => { - if (contributor.id !== splittingContributorId) { - return contributor; - } - - const [splitEmail] = newContributor.gitEmails; - - return { - ...contributor, - gitEmails: contributor.gitEmails.filter( - ({ id }) => id !== splitEmail?.id, - ), - }; - }); - - state.contributors = [newContributor, ...state.contributors]; - + builder.addCase(split.fulfilled, (state) => { state.splitContributorsStatus = DataStatus.FULFILLED; }); builder.addCase(split.rejected, (state) => { diff --git a/apps/frontend/src/pages/analytics/analytics.tsx b/apps/frontend/src/pages/analytics/analytics.tsx index 4cb19a4f7..777346160 100644 --- a/apps/frontend/src/pages/analytics/analytics.tsx +++ b/apps/frontend/src/pages/analytics/analytics.tsx @@ -13,10 +13,14 @@ import { useCallback, useEffect, useFormWatch, + useSearch, } from "~/libs/hooks/hooks.js"; import { actions as activityLogActions } from "~/modules/activity/activity.js"; -import { AnalyticsTable } from "./libs/components/components.js"; +import { + AnalyticsContributorsSearch, + AnalyticsTable, +} from "./libs/components/components.js"; import { ANALYTICS_DATE_MAX_RANGE, ANALYTICS_DEFAULT_DATE_RANGE, @@ -33,6 +37,8 @@ const Analytics = (): JSX.Element => { ANALYTICS_LOOKBACK_DAYS_COUNT, ); + const { onSearch, search } = useSearch(); + const { activityLogs, dataStatus, projects } = useAppSelector( ({ activityLogs }) => activityLogs, ); @@ -41,16 +47,24 @@ const Analytics = (): JSX.Element => { void dispatch(activityLogActions.loadAllProjects()); }, [dispatch]); - const { control, handleSubmit, isDirty } = useAppForm({ + const { control, errors, handleSubmit, isDirty } = useAppForm({ defaultValues: { dateRange: [ subtractDays(todayDate, ANALYTICS_DEFAULT_DATE_RANGE), todayDate, ] as [Date, Date], project: null, + search, }, }); + const handleSearchChange = useCallback( + (value: string) => { + onSearch(value); + }, + [onSearch], + ); + const dateRangeValue = useFormWatch({ control, name: "dateRange" }); const projectValue = useFormWatch({ control, name: "project" }); @@ -64,13 +78,14 @@ const Analytics = (): JSX.Element => { void dispatch( activityLogActions.loadAll({ + contributorName: search, endDate: formattedEndDate, projectId: projectId ?? undefined, startDate: formattedStartDate, }), ); }, - [dispatch], + [dispatch, search], ); useEffect(() => { @@ -102,6 +117,12 @@ const Analytics = (): JSX.Element => {

Analytics

+