Skip to content

Commit

Permalink
Merge branch 'main' into b-2734-create-billing-profile-selection-panel
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelfact committed Nov 14, 2024
2 parents cd35cba + d2a114f commit 8a27628
Show file tree
Hide file tree
Showing 66 changed files with 550 additions and 315 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { AvatarLabelGroup } from "@/design-system/molecules/avatar-label-group";
import { SortDirection } from "@/design-system/molecules/table-sort";

import { TABLE_CELL_SIZE } from "@/shared/constants/table";
import { CellCategories } from "@/shared/features/table/cell/cell-categories/cell-categories";
import { CellEcosystems } from "@/shared/features/table/cell/cell-ecosystems/cell-ecosystems";
import { CellEmpty } from "@/shared/features/table/cell/cell-empty/cell-empty";
import { CellLanguages } from "@/shared/features/table/cell/cell-languages/cell-languages";
Expand Down Expand Up @@ -97,13 +98,9 @@ export function useFilterColumns() {
enableSorting: false,
header: () => <Translate token={"data:deepDive.contributorsTable.columns.categories"} />,
cell: info => {
const categories = info.getValue();
const categories = info.getValue() ?? [];

if (!categories?.length) {
return <CellEmpty />;
}

return <TableCellKpi>{categories.map(category => category.name).join(", ")}</TableCellKpi>;
return <CellCategories categories={categories} />;
},
}),
languages: columnHelper.accessor("languages", {
Expand All @@ -127,6 +124,7 @@ export function useFilterColumns() {
country: columnHelper.accessor("country", {
enableSorting: false,
size: TABLE_CELL_SIZE.SM,
minSize: TABLE_CELL_SIZE.SM,
header: () => <Translate token={"data:deepDive.contributorsTable.columns.country"} />,
cell: info => {
const country = info.getValue();
Expand Down Expand Up @@ -162,7 +160,8 @@ export function useFilterColumns() {
},
}),
contributionCount: columnHelper.accessor("contributionCount", {
size: TABLE_CELL_SIZE.SM,
size: TABLE_CELL_SIZE.MD,
minSize: TABLE_CELL_SIZE.MD,
header: () => <Translate token={"data:deepDive.contributorsTable.columns.contributionCount"} />,
cell: info => {
const { value, trend } = info.getValue() ?? {};
Expand All @@ -174,6 +173,7 @@ export function useFilterColumns() {
}),
prCount: columnHelper.accessor("prCount", {
size: TABLE_CELL_SIZE.SM,
minSize: TABLE_CELL_SIZE.SM,
header: () => <Translate token={"data:deepDive.contributorsTable.columns.prCount"} />,
cell: info => {
const { value, trend } = info.getValue() ?? {};
Expand All @@ -186,6 +186,7 @@ export function useFilterColumns() {
rewardCount: columnHelper.accessor("rewardCount", {
enableSorting: false,
size: TABLE_CELL_SIZE.SM,
minSize: TABLE_CELL_SIZE.SM,
header: () => <Translate token={"data:deepDive.contributorsTable.columns.rewardCount"} />,
cell: info => {
const { value, trend } = info.getValue() ?? {};
Expand All @@ -198,6 +199,7 @@ export function useFilterColumns() {
engagementStatus: columnHelper.accessor("engagementStatus", {
enableSorting: false,
size: TABLE_CELL_SIZE.MD,
minSize: TABLE_CELL_SIZE.MD,
header: () => <Translate token={"data:deepDive.contributorsTable.columns.engagementStatuses"} />,
cell: info => {
const engagementStatuses = info.getValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import { AvatarLabelGroup } from "@/design-system/molecules/avatar-label-group";
import { SortDirection } from "@/design-system/molecules/table-sort";

import { TABLE_CELL_SIZE } from "@/shared/constants/table";
import { CellBadge } from "@/shared/features/table/cell/cell-badge/cell-badge";
import { CellBudget } from "@/shared/features/table/cell/cell-budget/cell-budget";
import { CellCategories } from "@/shared/features/table/cell/cell-categories/cell-categories";
import { CellEcosystems } from "@/shared/features/table/cell/cell-ecosystems/cell-ecosystems";
import { CellEmpty } from "@/shared/features/table/cell/cell-empty/cell-empty";
import { CellLanguages } from "@/shared/features/table/cell/cell-languages/cell-languages";
Expand Down Expand Up @@ -108,8 +108,9 @@ export function useFilterColumns() {
enableSorting: false,
header: () => <Translate token={"data:deepDive.projectsTable.columns.categories"} />,
cell: info => {
const categories = info.getValue();
return <CellBadge items={categories?.map(category => category.name)} />;
const categories = info.getValue() ?? [];

return <CellCategories categories={categories} />;
},
}),
languages: columnHelper.accessor("languages", {
Expand Down Expand Up @@ -149,6 +150,7 @@ export function useFilterColumns() {
}),
percentUsedBudget: columnHelper.accessor("percentUsedBudget", {
size: TABLE_CELL_SIZE.MD,
minSize: TABLE_CELL_SIZE.MD,
header: () => <Translate token={"data:deepDive.projectsTable.columns.percentUsedBudget"} />,
cell: info => {
const value = info.getValue();
Expand Down Expand Up @@ -195,7 +197,8 @@ export function useFilterColumns() {
},
}),
onboardedContributorCount: columnHelper.accessor("onboardedContributorCount", {
size: TABLE_CELL_SIZE.SM,
size: TABLE_CELL_SIZE.MD,
minSize: TABLE_CELL_SIZE.MD,
header: () => <Translate token={"data:deepDive.projectsTable.columns.onboardedContributorCount"} />,
cell: info => {
const { value, trend } = info.getValue() ?? {};
Expand All @@ -206,7 +209,8 @@ export function useFilterColumns() {
},
}),
activeContributorCount: columnHelper.accessor("activeContributorCount", {
size: TABLE_CELL_SIZE.SM,
size: TABLE_CELL_SIZE.MD,
minSize: TABLE_CELL_SIZE.MD,
header: () => <Translate token={"data:deepDive.projectsTable.columns.activeContributorCount"} />,
cell: info => {
const { value, trend } = info.getValue() ?? {};
Expand All @@ -218,6 +222,7 @@ export function useFilterColumns() {
}),
prCount: columnHelper.accessor("prCount", {
size: TABLE_CELL_SIZE.SM,
minSize: TABLE_CELL_SIZE.SM,
header: () => <Translate token={"data:deepDive.projectsTable.columns.prCount"} />,
cell: info => {
const { value, trend } = info.getValue() ?? {};
Expand All @@ -228,7 +233,8 @@ export function useFilterColumns() {
},
}),
rewardCount: columnHelper.accessor("rewardCount", {
size: TABLE_CELL_SIZE.SM,
size: TABLE_CELL_SIZE.MD,
minSize: TABLE_CELL_SIZE.MD,
header: () => <Translate token={"data:deepDive.projectsTable.columns.rewardCount"} />,
cell: info => {
const { value, trend } = info.getValue() ?? {};
Expand All @@ -239,7 +245,8 @@ export function useFilterColumns() {
},
}),
contributionCount: columnHelper.accessor("contributionCount", {
size: TABLE_CELL_SIZE.SM,
size: TABLE_CELL_SIZE.MD,
minSize: TABLE_CELL_SIZE.MD,
header: () => <Translate token={"data:deepDive.projectsTable.columns.contributionCount"} />,
cell: info => {
const { value, trend } = info.getValue() ?? {};
Expand All @@ -252,6 +259,7 @@ export function useFilterColumns() {
engagementStatus: columnHelper.accessor("engagementStatus", {
enableSorting: false,
size: TABLE_CELL_SIZE.MD,
minSize: TABLE_CELL_SIZE.MD,
header: () => <Translate token={"data:deepDive.projectsTable.columns.engagementStatuses"} />,
cell: info => {
const engagementStatuses = info.getValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export function ProgramsTable({ onAllocateClick }: ProgramsTableProps) {
columnHelper.accessor("projectCount", {
enableSorting: false,
size: TABLE_CELL_SIZE.SM,
minSize: TABLE_CELL_SIZE.SM,
header: () => <Translate token={"financials:details.programs.table.columns.projects"} />,
cell: info => {
return <TableCellKpi>{info.getValue()}</TableCellKpi>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ export function useFilterColumns() {
id: "select",
enableResizing: false,
size: TABLE_CELL_SIZE.XS,
minSize: TABLE_CELL_SIZE.XS,
header: ({ table }) => (
<Checkbox
onNativeEventChange={table.getToggleAllRowsSelectedHandler()}
Expand Down Expand Up @@ -182,6 +183,7 @@ export function useFilterColumns() {
country: columnHelper.accessor("country", {
enableSorting: false,
size: TABLE_CELL_SIZE.SM,
minSize: TABLE_CELL_SIZE.SM,
header: () => <Translate token={"manageProjects:detail.contributorsTable.columns.country"} />,
cell: info => {
const country = info.getValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export function useFilterColumns({ projectId }: { projectId: string }) {
const columnMap: Partial<Record<TableColumns, object>> = {
requestedAt: columnHelper.accessor("requestedAt", {
size: TABLE_CELL_SIZE.SM,
minSize: TABLE_CELL_SIZE.SM,
header: () => <Translate token={"manageProjects:detail.rewardsTable.columns.date"} />,
cell: info => {
const requestedAt = info.getValue();
Expand All @@ -82,6 +83,7 @@ export function useFilterColumns({ projectId }: { projectId: string }) {
id: columnHelper.accessor("id", {
enableSorting: false,
size: TABLE_CELL_SIZE.SM,
minSize: TABLE_CELL_SIZE.SM,
header: () => <Translate token={"manageProjects:detail.rewardsTable.columns.id"} />,
cell: info => {
const id = info.getValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useEffect } from "react";
import { useLocalStorage } from "react-use";

import { bootstrap } from "@/core/bootstrap";
import { MeProjectListItemInterface } from "@/core/domain/me/models/me-projects-model";
import { MeMaintainerProjectsInterface } from "@/core/domain/me/models/me-maintainer-projects-model";

import { Button } from "@/design-system/atoms/button/variants/button-default";
import { TableCellKpi } from "@/design-system/atoms/table-cell-kpi";
Expand All @@ -20,7 +20,7 @@ import { TableColumns } from "./filter-columns.types";

export function useFilterColumns() {
const moneyKernelPort = bootstrap.getMoneyKernelPort();
const columnHelper = createColumnHelper<MeProjectListItemInterface>();
const columnHelper = createColumnHelper<MeMaintainerProjectsInterface>();

const [selectedIds, setSelectedIds] = useLocalStorage<Array<TableColumns>>("manage-projects-table-columns");

Expand Down Expand Up @@ -77,6 +77,7 @@ export function useFilterColumns() {
contributorCount: columnHelper.accessor("contributorCount", {
enableSorting: false,
size: TABLE_CELL_SIZE.SM,
minSize: TABLE_CELL_SIZE.SM,
header: () => <Translate token={"manageProjects:list.projectsTable.columns.members"} />,
cell: info => {
const contributorCount = info.getValue();
Expand Down Expand Up @@ -145,7 +146,7 @@ export function useFilterColumns() {
// Loop on object keys to keep column order
const columns = columnMapKeys
.map(key => (selectedIds?.includes(key) ? columnMap[key] : null))
.filter(Boolean) as ColumnDef<MeProjectListItemInterface>[];
.filter(Boolean) as ColumnDef<MeMaintainerProjectsInterface>[];

return { columns, selectedIds, setSelectedIds };
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export function ProjectsTable() {
const router = useRouter();

const { data, isLoading, isError, hasNextPage, fetchNextPage, isFetchingNextPage } =
MeReactQueryAdapter.client.useGetMeProjects({});
MeReactQueryAdapter.client.useGetMyProjectsAsMaintainer({});
const projects = useMemo(() => data?.pages.flatMap(page => page.projects) ?? [], [data]);
const totalItemNumber = useMemo(() => data?.pages[0].totalItemNumber, [data]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export function useFilterColumns() {
const columnMap: Partial<Record<TableColumns, object>> = {
requestedAt: columnHelper.accessor("requestedAt", {
size: TABLE_CELL_SIZE.SM,
minSize: TABLE_CELL_SIZE.SM,
header: () => <Translate token={"myDashboard:detail.rewardsTable.columns.date"} />,
cell: info => {
const requestedAt = info.getValue();
Expand All @@ -73,6 +74,7 @@ export function useFilterColumns() {
id: columnHelper.accessor("id", {
enableSorting: false,
size: TABLE_CELL_SIZE.SM,
minSize: TABLE_CELL_SIZE.SM,
header: () => <Translate token={"myDashboard:detail.rewardsTable.columns.id"} />,
cell: info => {
const id = info.getValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ export function ProjectsTable({ programId }: { programId: string }) {
columnHelper.accessor("percentUsedBudget", {
enableSorting: false,
size: TABLE_CELL_SIZE.MD,
minSize: TABLE_CELL_SIZE.MD,
header: () => <Translate token={"programs:details.projects.table.columns.budgetUsed"} />,
cell: info => {
const value = info.getValue() ?? 0;
Expand All @@ -168,7 +169,8 @@ export function ProjectsTable({ programId }: { programId: string }) {

columnHelper.accessor("mergedPrCount", {
enableSorting: false,
size: TABLE_CELL_SIZE.SM,
size: TABLE_CELL_SIZE.MD,
minSize: TABLE_CELL_SIZE.MD,
header: () => <Translate token={"programs:details.projects.table.columns.prsMerged"} />,
cell: info => {
const { value, trend } = info.getValue() ?? {};
Expand All @@ -179,7 +181,8 @@ export function ProjectsTable({ programId }: { programId: string }) {

columnHelper.accessor("newContributorsCount", {
enableSorting: false,
size: TABLE_CELL_SIZE.SM,
size: TABLE_CELL_SIZE.MD,
minSize: TABLE_CELL_SIZE.MD,
header: () => <Translate token={"programs:details.projects.table.columns.onboardedDevs"} />,
cell: info => {
const { value, trend } = info.getValue() ?? {};
Expand All @@ -189,7 +192,8 @@ export function ProjectsTable({ programId }: { programId: string }) {
}),
columnHelper.accessor("activeContributorsCount", {
enableSorting: false,
size: TABLE_CELL_SIZE.SM,
size: TABLE_CELL_SIZE.MD,
minSize: TABLE_CELL_SIZE.MD,
header: () => <Translate token={"programs:details.projects.table.columns.activeDevs"} />,
cell: info => {
const { value, trend } = info.getValue() ?? {};
Expand Down
1 change: 1 addition & 0 deletions app/programs/_features/programs-table/programs-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export function ProgramsTable() {
columnHelper.accessor("projectCount", {
enableSorting: false,
size: TABLE_CELL_SIZE.SM,
minSize: TABLE_CELL_SIZE.SM,
header: () => <Translate token={"programs:list.content.table.columns.projects"} />,
cell: info => {
return <TableCellKpi>{info.getValue()}</TableCellKpi>;
Expand Down
3 changes: 2 additions & 1 deletion core/application/react-query-adapter/me/client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ export * from "./use-set-me";
export * from "./use-get-my-profile";
export * from "./use-set-my-profile";
export * from "./use-replace-my-profile";
export * from "./use-get-me-projects";
export * from "./use-get-my-projects-as-maintainer";
export * from "./use-get-my-projects-as-contributor";
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { useInfiniteQuery } from "@tanstack/react-query";

import {
UseInfiniteQueryFacadeParams,
useInfiniteQueryAdapter,
} from "@/core/application/react-query-adapter/helpers/use-infinite-query-adapter";
import { bootstrap } from "@/core/bootstrap";
import { MeFacadePort } from "@/core/domain/me/inputs/me-facade-port";
import { GetMyProjectsAsContributorModel } from "@/core/domain/me/me-contract.types";
import { MeStoragePort } from "@/core/domain/me/outputs/me-storage-port";

export function useGetMyProjectsAsContributor({
pathParams,
queryParams,
options,
}: UseInfiniteQueryFacadeParams<MeStoragePort["getMyProjectsAsContributor"], GetMyProjectsAsContributorModel>) {
const meStoragePort = bootstrap.getMeStoragePortForClient();

return useInfiniteQuery(
useInfiniteQueryAdapter<MeFacadePort["getMyProjectsAsContributor"], GetMyProjectsAsContributorModel>({
pathParams,
queryParams,
options,
httpStorage: meStoragePort.getMyProjectsAsContributor,
})
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@ import {
} from "@/core/application/react-query-adapter/helpers/use-infinite-query-adapter";
import { bootstrap } from "@/core/bootstrap";
import { MeFacadePort } from "@/core/domain/me/inputs/me-facade-port";
import { GetMeProjectsModel } from "@/core/domain/me/me-contract.types";
import { GetMyProjectsAsMaintainerModel } from "@/core/domain/me/me-contract.types";
import { MeStoragePort } from "@/core/domain/me/outputs/me-storage-port";

export function useGetMeProjects({
export function useGetMyProjectsAsMaintainer({
pathParams,
queryParams,
options,
}: UseInfiniteQueryFacadeParams<MeStoragePort["getMeProjects"], GetMeProjectsModel>) {
}: UseInfiniteQueryFacadeParams<MeStoragePort["getMyProjectsAsMaintainer"], GetMyProjectsAsMaintainerModel>) {
const meStoragePort = bootstrap.getMeStoragePortForClient();

return useInfiniteQuery(
useInfiniteQueryAdapter<MeFacadePort["getMeProjects"], GetMeProjectsModel>({
useInfiniteQueryAdapter<MeFacadePort["getMyProjectsAsMaintainer"], GetMyProjectsAsMaintainerModel>({
pathParams,
queryParams,
options,
httpStorage: meStoragePort.getMeProjects,
httpStorage: meStoragePort.getMyProjectsAsMaintainer,
})
);
}
1 change: 1 addition & 0 deletions core/domain/bi/models/bi-stats-financials-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export class BiStatsFinancials implements BiStatsFinancialsInterface {
totalDeposited!: BiStatsFinancialsResponse["totalDeposited"];
totalGranted!: BiStatsFinancialsResponse["totalGranted"];
totalRewarded!: BiStatsFinancialsResponse["totalRewarded"];
totalPaid!: BiStatsFinancialsResponse["totalPaid"];
transactionCount!: BiStatsFinancialsResponse["transactionCount"];

constructor(props: BiStatsFinancialsResponse) {
Expand Down
Loading

0 comments on commit 8a27628

Please sign in to comment.