🎨(app-desk) add feature members

The feature teams is getting big, we extracted codes
related to members to a new feature members.
This commit is contained in:
Anthony LC
2024-03-13 14:34:18 +01:00
committed by Anthony LC
parent bdddbb84a5
commit 4a141736ff
17 changed files with 109 additions and 92 deletions

View File

@@ -4,8 +4,8 @@ import fetchMock from 'fetch-mock';
import { AppWrapper } from '@/tests/utils';
import { Access, Role } from '../api';
import { MemberAction } from '../components/Member/MemberAction';
import { MemberAction } from '../components/MemberAction';
import { Access, Role } from '../types';
const access: Access = {
id: '789',

View File

@@ -5,8 +5,8 @@ import fetchMock from 'fetch-mock';
import { AppWrapper } from '@/tests/utils';
import { Access, Role } from '../api';
import { MemberGrid } from '../components/Member/MemberGrid';
import { MemberGrid } from '../components/MemberGrid';
import { Access, Role } from '../types';
describe('MemberGrid', () => {
afterEach(() => {

View File

@@ -6,8 +6,8 @@ import fetchMock from 'fetch-mock';
import { useAuthStore } from '@/features/auth';
import { AppWrapper } from '@/tests/utils';
import { Access, Role } from '../api';
import { ModalRole } from '../components/Member/ModalRole';
import { ModalRole } from '../components/ModalRole';
import { Access, Role } from '../types';
const toast = jest.fn();
jest.mock('@openfun/cunningham-react', () => ({

View File

@@ -2,7 +2,7 @@ import { UseQueryOptions, useQuery } from '@tanstack/react-query';
import { APIError, APIList, errorCauses, fetchAPI } from '@/api';
import { Access } from './types';
import { Access } from '../types';
export type TeamAccessesAPIParams = {
page: number;

View File

@@ -5,9 +5,10 @@ import {
} from '@tanstack/react-query';
import { APIError, errorCauses, fetchAPI } from '@/api';
import { KEY_TEAM } from '@/features/teams/api/useTeam';
import { Access, Role } from '../types';
import { Access, Role } from './types';
import { KEY_TEAM } from './useTeam';
import { KEY_LIST_TEAM_ACCESSES } from './useTeamsAccesses';
interface UpdateTeamAccessProps {

View File

@@ -3,7 +3,8 @@ import React, { useState } from 'react';
import { useTranslation } from 'react-i18next';
import { DropButton, Text } from '@/components';
import { Access, Role } from '@/features/teams/api';
import { Access, Role } from '../types';
import { ModalRole } from './ModalRole';

View File

@@ -5,8 +5,10 @@ import { useTranslation } from 'react-i18next';
import IconUser from '@/assets/icons/icon-user.svg';
import { Box, Card, TextErrors } from '@/components';
import { useCunninghamTheme } from '@/cunningham';
import { Role, useTeamAccesses } from '@/features/teams/api/';
import { PAGE_SIZE } from '@/features/teams/conf';
import { useTeamAccesses } from '../api/useTeamsAccesses';
import { PAGE_SIZE } from '../conf';
import { Role } from '../types';
import { MemberAction } from './MemberAction';

View File

@@ -12,7 +12,9 @@ import { useState } from 'react';
import { Box, Text, TextErrors } from '@/components';
import { useAuthStore } from '@/features/auth';
import { Access, Role, useUpdateTeamAccess } from '@/features/teams/api/';
import { useUpdateTeamAccess } from '../api/useUpdateTeamAccess';
import { Access, Role } from '../types';
interface ModalRoleProps {
access: Access;

View File

@@ -0,0 +1,2 @@
export * from './types';
export * from './components/MemberGrid';

View File

@@ -0,0 +1,20 @@
import { User } from '@/features/auth/';
export enum Role {
MEMBER = 'member',
ADMIN = 'administrator',
OWNER = 'owner',
}
export interface Access {
id: string;
role: Role;
user: User;
abilities: {
delete: boolean;
get: boolean;
patch: boolean;
put: boolean;
set_role_to: Role[];
};
}

View File

@@ -2,5 +2,3 @@ export * from './types';
export * from './useCreateTeam';
export * from './useTeam';
export * from './useTeams';
export * from './useTeamsAccesses';
export * from './useUpdateTeamAccess';

View File

@@ -1,23 +1,4 @@
import { User } from '@/features/auth/';
export enum Role {
MEMBER = 'member',
ADMIN = 'administrator',
OWNER = 'owner',
}
export interface Access {
id: string;
role: Role;
user: User;
abilities: {
delete: boolean;
get: boolean;
patch: boolean;
put: boolean;
set_role_to: Role[];
};
}
import { Access } from '@/features/members';
export interface Team {
id: string;

View File

@@ -1,3 +1,2 @@
export * from './Panel/Panel';
export * from './TeamInfo';
export * from './Member/MemberGrid';

View File

@@ -5,7 +5,8 @@ import { ReactElement } from 'react';
import { Box } from '@/components';
import { TextErrors } from '@/components/TextErrors';
import { MemberGrid, Role, TeamInfo, useTeam } from '@/features/teams/';
import { MemberGrid, Role } from '@/features/members';
import { TeamInfo, useTeam } from '@/features/teams/';
import { NextPageWithLayout } from '@/types/next';
import TeamLayout from './TeamLayout';