🚚(frontend) change teams feature architecture
Changes the teams feature architecture, centralizing all the teams-related features inside a teams folder.
@@ -2,10 +2,9 @@ import { useMutation } from '@tanstack/react-query';
|
|||||||
|
|
||||||
import { APIError, errorCauses, fetchAPI } from '@/api';
|
import { APIError, errorCauses, fetchAPI } from '@/api';
|
||||||
import { User } from '@/core/auth';
|
import { User } from '@/core/auth';
|
||||||
import { Invitation } from '@/features/members';
|
import { Role, Team } from '@/features/teams/team-management';
|
||||||
import { Role, Team } from '@/features/teams';
|
|
||||||
|
|
||||||
import { OptionType } from '../types';
|
import { Invitation, OptionType } from '../types';
|
||||||
|
|
||||||
interface CreateInvitationParams {
|
interface CreateInvitationParams {
|
||||||
email: User['email'];
|
email: User['email'];
|
||||||
@@ -2,8 +2,16 @@ import { useMutation, useQueryClient } from '@tanstack/react-query';
|
|||||||
|
|
||||||
import { APIError, errorCauses, fetchAPI } from '@/api';
|
import { APIError, errorCauses, fetchAPI } from '@/api';
|
||||||
import { User } from '@/core/auth';
|
import { User } from '@/core/auth';
|
||||||
import { Access, KEY_LIST_TEAM_ACCESSES } from '@/features/members';
|
import {
|
||||||
import { KEY_LIST_TEAM, KEY_TEAM, Role, Team } from '@/features/teams';
|
Access,
|
||||||
|
KEY_LIST_TEAM_ACCESSES,
|
||||||
|
} from '@/features/teams/member-management';
|
||||||
|
import {
|
||||||
|
KEY_LIST_TEAM,
|
||||||
|
KEY_TEAM,
|
||||||
|
Role,
|
||||||
|
Team,
|
||||||
|
} from '@/features/teams/team-management';
|
||||||
|
|
||||||
import { OptionType } from '../types';
|
import { OptionType } from '../types';
|
||||||
|
|
||||||
@@ -2,7 +2,7 @@ import { UseQueryOptions, useQuery } from '@tanstack/react-query';
|
|||||||
|
|
||||||
import { APIError, APIList, errorCauses, fetchAPI } from '@/api';
|
import { APIError, APIList, errorCauses, fetchAPI } from '@/api';
|
||||||
import { User } from '@/core/auth';
|
import { User } from '@/core/auth';
|
||||||
import { Team } from '@/features/teams';
|
import { Team } from '@/features/teams/team-management';
|
||||||
|
|
||||||
export type UsersParams = {
|
export type UsersParams = {
|
||||||
query: string;
|
query: string;
|
||||||
|
Before Width: | Height: | Size: 925 B After Width: | Height: | Size: 925 B |
@@ -12,8 +12,8 @@ import { createGlobalStyle } from 'styled-components';
|
|||||||
import { APIError } from '@/api';
|
import { APIError } from '@/api';
|
||||||
import { Box, Text } from '@/components';
|
import { Box, Text } from '@/components';
|
||||||
import { useCunninghamTheme } from '@/cunningham';
|
import { useCunninghamTheme } from '@/cunningham';
|
||||||
import { ChooseRole } from '@/features/members';
|
import { ChooseRole } from '@/features/teams/member-management';
|
||||||
import { Role, Team } from '@/features/teams';
|
import { Role, Team } from '@/features/teams/team-management';
|
||||||
|
|
||||||
import { useCreateInvitation, useCreateTeamAccess } from '../api';
|
import { useCreateInvitation, useCreateTeamAccess } from '../api';
|
||||||
import IconAddMember from '../assets/add-member.svg';
|
import IconAddMember from '../assets/add-member.svg';
|
||||||
@@ -3,7 +3,7 @@ import { useTranslation } from 'react-i18next';
|
|||||||
import { Options } from 'react-select';
|
import { Options } from 'react-select';
|
||||||
import AsyncSelect from 'react-select/async';
|
import AsyncSelect from 'react-select/async';
|
||||||
|
|
||||||
import { Team } from '@/features/teams';
|
import { Team } from '@/features/teams/team-management';
|
||||||
import { isValidEmail } from '@/utils';
|
import { isValidEmail } from '@/utils';
|
||||||
|
|
||||||
import { KEY_LIST_USER, useUsers } from '../api/useUsers';
|
import { KEY_LIST_USER, useUsers } from '../api/useUsers';
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
import { User } from '@/core/auth';
|
import { User } from '@/core/auth';
|
||||||
|
|
||||||
|
import { Role, Team } from '../team-management';
|
||||||
|
|
||||||
export enum OptionType {
|
export enum OptionType {
|
||||||
INVITATION = 'invitation',
|
INVITATION = 'invitation',
|
||||||
NEW_MEMBER = 'new_member',
|
NEW_MEMBER = 'new_member',
|
||||||
@@ -24,3 +26,13 @@ export interface OptionNewMember {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export type OptionSelect = OptionNewMember | OptionInvitation;
|
export type OptionSelect = OptionNewMember | OptionInvitation;
|
||||||
|
|
||||||
|
export interface Invitation {
|
||||||
|
id: string;
|
||||||
|
created_at: string;
|
||||||
|
email: string;
|
||||||
|
team: Team['id'];
|
||||||
|
role: Role;
|
||||||
|
issuer: User['id'];
|
||||||
|
is_expired: boolean;
|
||||||
|
}
|
||||||
@@ -2,7 +2,7 @@ import '@testing-library/jest-dom';
|
|||||||
import { render, screen } from '@testing-library/react';
|
import { render, screen } from '@testing-library/react';
|
||||||
import fetchMock from 'fetch-mock';
|
import fetchMock from 'fetch-mock';
|
||||||
|
|
||||||
import { Role, Team } from '@/features/teams';
|
import { Role, Team } from '@/features/teams/team-management';
|
||||||
import { AppWrapper } from '@/tests/utils';
|
import { AppWrapper } from '@/tests/utils';
|
||||||
|
|
||||||
import { MemberAction } from '../components/MemberAction';
|
import { MemberAction } from '../components/MemberAction';
|
||||||
@@ -3,7 +3,7 @@ import { render, screen, waitFor } from '@testing-library/react';
|
|||||||
import userEvent from '@testing-library/user-event';
|
import userEvent from '@testing-library/user-event';
|
||||||
import fetchMock from 'fetch-mock';
|
import fetchMock from 'fetch-mock';
|
||||||
|
|
||||||
import { Role, Team } from '@/features/teams';
|
import { Role, Team } from '@/features/teams/team-management';
|
||||||
import { AppWrapper } from '@/tests/utils';
|
import { AppWrapper } from '@/tests/utils';
|
||||||
|
|
||||||
import { MemberGrid } from '../components/MemberGrid';
|
import { MemberGrid } from '../components/MemberGrid';
|
||||||
@@ -4,7 +4,7 @@ import userEvent from '@testing-library/user-event';
|
|||||||
import fetchMock from 'fetch-mock';
|
import fetchMock from 'fetch-mock';
|
||||||
|
|
||||||
import { useAuthStore } from '@/core/auth';
|
import { useAuthStore } from '@/core/auth';
|
||||||
import { Role } from '@/features/teams';
|
import { Role } from '@/features/teams/team-management';
|
||||||
import { AppWrapper } from '@/tests/utils';
|
import { AppWrapper } from '@/tests/utils';
|
||||||
|
|
||||||
import { ModalRole } from '../components/ModalRole';
|
import { ModalRole } from '../components/ModalRole';
|
||||||
@@ -5,7 +5,7 @@ import {
|
|||||||
} from '@tanstack/react-query';
|
} from '@tanstack/react-query';
|
||||||
|
|
||||||
import { APIError, errorCauses, fetchAPI } from '@/api';
|
import { APIError, errorCauses, fetchAPI } from '@/api';
|
||||||
import { KEY_LIST_TEAM, KEY_TEAM } from '@/features/teams/';
|
import { KEY_LIST_TEAM, KEY_TEAM } from '@/features/teams/team-management';
|
||||||
|
|
||||||
import { KEY_LIST_TEAM_ACCESSES } from './useTeamsAccesses';
|
import { KEY_LIST_TEAM_ACCESSES } from './useTeamsAccesses';
|
||||||
|
|
||||||
@@ -5,7 +5,7 @@ import {
|
|||||||
} from '@tanstack/react-query';
|
} from '@tanstack/react-query';
|
||||||
|
|
||||||
import { APIError, errorCauses, fetchAPI } from '@/api';
|
import { APIError, errorCauses, fetchAPI } from '@/api';
|
||||||
import { KEY_TEAM, Role } from '@/features/teams/';
|
import { KEY_TEAM, Role } from '@/features/teams/team-management';
|
||||||
|
|
||||||
import { Access } from '../types';
|
import { Access } from '../types';
|
||||||
|
|
||||||
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
@@ -1,7 +1,7 @@
|
|||||||
import { Radio, RadioGroup } from '@openfun/cunningham-react';
|
import { Radio, RadioGroup } from '@openfun/cunningham-react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
import { Role } from '@/features/teams';
|
import { Role } from '@/features/teams/team-management';
|
||||||
|
|
||||||
interface ChooseRoleProps {
|
interface ChooseRoleProps {
|
||||||
currentRole: Role;
|
currentRole: Role;
|
||||||
@@ -3,7 +3,7 @@ import React, { useState } from 'react';
|
|||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
import { Box, DropButton, IconOptions, Text } from '@/components';
|
import { Box, DropButton, IconOptions, Text } from '@/components';
|
||||||
import { Role, Team } from '@/features/teams';
|
import { Role, Team } from '@/features/teams/team-management';
|
||||||
|
|
||||||
import { Access } from '../types';
|
import { Access } from '../types';
|
||||||
|
|
||||||
@@ -10,10 +10,10 @@ import { useTranslation } from 'react-i18next';
|
|||||||
import IconUser from '@/assets/icons/icon-user.svg';
|
import IconUser from '@/assets/icons/icon-user.svg';
|
||||||
import { Box, Card, TextErrors } from '@/components';
|
import { Box, Card, TextErrors } from '@/components';
|
||||||
import { useCunninghamTheme } from '@/cunningham';
|
import { useCunninghamTheme } from '@/cunningham';
|
||||||
import { ModalAddMembers } from '@/features/addMembers';
|
import { ModalAddMembers } from '@/features/teams/member-add';
|
||||||
import { Role, Team } from '@/features/teams';
|
import { Role, Team } from '@/features/teams/team-management';
|
||||||
|
|
||||||
import { useTeamAccesses } from '../api/';
|
import { useTeamAccesses } from '../api';
|
||||||
import { PAGE_SIZE } from '../conf';
|
import { PAGE_SIZE } from '../conf';
|
||||||
|
|
||||||
import { MemberAction } from './MemberAction';
|
import { MemberAction } from './MemberAction';
|
||||||
@@ -11,7 +11,7 @@ import { useRouter } from 'next/navigation';
|
|||||||
import IconUser from '@/assets/icons/icon-user.svg';
|
import IconUser from '@/assets/icons/icon-user.svg';
|
||||||
import { Box, Text, TextErrors } from '@/components';
|
import { Box, Text, TextErrors } from '@/components';
|
||||||
import { useCunninghamTheme } from '@/cunningham';
|
import { useCunninghamTheme } from '@/cunningham';
|
||||||
import { Role, Team } from '@/features/teams/';
|
import { Role, Team } from '@/features/teams/team-management';
|
||||||
|
|
||||||
import { useDeleteTeamAccess } from '../api/useDeleteTeamAccess';
|
import { useDeleteTeamAccess } from '../api/useDeleteTeamAccess';
|
||||||
import { useWhoAmI } from '../hooks/useWhoAmI';
|
import { useWhoAmI } from '../hooks/useWhoAmI';
|
||||||
@@ -9,7 +9,7 @@ import { useState } from 'react';
|
|||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
import { Box, Text, TextErrors } from '@/components';
|
import { Box, Text, TextErrors } from '@/components';
|
||||||
import { Role } from '@/features/teams';
|
import { Role } from '@/features/teams/team-management';
|
||||||
|
|
||||||
import { useUpdateTeamAccess } from '../api/useUpdateTeamAccess';
|
import { useUpdateTeamAccess } from '../api/useUpdateTeamAccess';
|
||||||
import { useWhoAmI } from '../hooks/useWhoAmI';
|
import { useWhoAmI } from '../hooks/useWhoAmI';
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import { useAuthStore } from '@/core/auth';
|
import { useAuthStore } from '@/core/auth';
|
||||||
import { Role } from '@/features/teams';
|
import { Role } from '@/features/teams/team-management';
|
||||||
|
|
||||||
import { Access } from '../types';
|
import { Access } from '../types';
|
||||||
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import { User } from '@/core/auth';
|
import { User } from '@/core/auth';
|
||||||
import { Role, Team } from '@/features/teams/';
|
import { Role } from '@/features/teams/team-management';
|
||||||
|
|
||||||
export interface Access {
|
export interface Access {
|
||||||
id: string;
|
id: string;
|
||||||
@@ -13,13 +13,3 @@ export interface Access {
|
|||||||
set_role_to: Role[];
|
set_role_to: Role[];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Invitation {
|
|
||||||
id: string;
|
|
||||||
created_at: string;
|
|
||||||
email: string;
|
|
||||||
team: Team['id'];
|
|
||||||
role: Role;
|
|
||||||
issuer: User['id'];
|
|
||||||
is_expired: boolean;
|
|
||||||
}
|
|
||||||
|
Before Width: | Height: | Size: 259 B After Width: | Height: | Size: 259 B |
|
Before Width: | Height: | Size: 747 B After Width: | Height: | Size: 747 B |
@@ -3,7 +3,7 @@ import { PropsWithChildren } from 'react';
|
|||||||
import { Box } from '@/components';
|
import { Box } from '@/components';
|
||||||
import { MainLayout } from '@/core';
|
import { MainLayout } from '@/core';
|
||||||
import { useCunninghamTheme } from '@/cunningham';
|
import { useCunninghamTheme } from '@/cunningham';
|
||||||
import { Panel } from '@/features/teams';
|
import { Panel } from '@/features/teams/teams-panel';
|
||||||
|
|
||||||
export function TeamLayout({ children }: PropsWithChildren) {
|
export function TeamLayout({ children }: PropsWithChildren) {
|
||||||
const { colorsTokens } = useCunninghamTheme();
|
const { colorsTokens } = useCunninghamTheme();
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
export * from './CardCreateTeam';
|
export * from './CardCreateTeam';
|
||||||
export * from './Panel/Panel';
|
|
||||||
export * from './TeamInfo';
|
export * from './TeamInfo';
|
||||||
export * from './TeamLayout';
|
export * from './TeamLayout';
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
export * from './api';
|
export * from './api';
|
||||||
export * from './components';
|
export * from './components';
|
||||||
export * from './types';
|
export * from './types';
|
||||||
export * from './store';
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Access } from '@/features/members';
|
import { Access } from '@/features/teams/member-management';
|
||||||
|
|
||||||
export enum Role {
|
export enum Role {
|
||||||
MEMBER = 'member',
|
MEMBER = 'member',
|
||||||
@@ -3,10 +3,10 @@ import { render, screen } from '@testing-library/react';
|
|||||||
import userEvent from '@testing-library/user-event';
|
import userEvent from '@testing-library/user-event';
|
||||||
import fetchMock from 'fetch-mock';
|
import fetchMock from 'fetch-mock';
|
||||||
|
|
||||||
import { Panel } from '@/features/teams';
|
|
||||||
import { AppWrapper } from '@/tests/utils';
|
import { AppWrapper } from '@/tests/utils';
|
||||||
|
|
||||||
import { TeamList } from '../components/Panel/TeamList';
|
import { Panel } from '../components/Panel';
|
||||||
|
import { TeamList } from '../components/TeamList';
|
||||||
|
|
||||||
window.HTMLElement.prototype.scroll = function () {};
|
window.HTMLElement.prototype.scroll = function () {};
|
||||||
|
|
||||||
|
Before Width: | Height: | Size: 617 B After Width: | Height: | Size: 617 B |
|
Before Width: | Height: | Size: 578 B After Width: | Height: | Size: 578 B |
|
Before Width: | Height: | Size: 500 B After Width: | Height: | Size: 500 B |
|
Before Width: | Height: | Size: 429 B After Width: | Height: | Size: 429 B |
@@ -3,7 +3,8 @@ import { useTranslation } from 'react-i18next';
|
|||||||
|
|
||||||
import { Box, BoxButton, Text } from '@/components';
|
import { Box, BoxButton, Text } from '@/components';
|
||||||
import { useCunninghamTheme } from '@/cunningham';
|
import { useCunninghamTheme } from '@/cunningham';
|
||||||
import IconOpenClose from '@/features/teams/assets/icon-open-close.svg';
|
|
||||||
|
import IconOpenClose from '../assets/icon-open-close.svg';
|
||||||
|
|
||||||
import { PanelActions } from './PanelActions';
|
import { PanelActions } from './PanelActions';
|
||||||
import { TeamList } from './TeamList';
|
import { TeamList } from './TeamList';
|
||||||
@@ -3,10 +3,11 @@ import { useTranslation } from 'react-i18next';
|
|||||||
|
|
||||||
import { Box, BoxButton, StyledLink } from '@/components';
|
import { Box, BoxButton, StyledLink } from '@/components';
|
||||||
import { useCunninghamTheme } from '@/cunningham';
|
import { useCunninghamTheme } from '@/cunningham';
|
||||||
import { TeamsOrdering } from '@/features/teams/api/';
|
import { TeamsOrdering } from '@/features/teams/team-management/api';
|
||||||
import IconAdd from '@/features/teams/assets/icon-add.svg';
|
|
||||||
import IconSort from '@/features/teams/assets/icon-sort.svg';
|
import IconAdd from '../assets/icon-add.svg';
|
||||||
import { useTeamStore } from '@/features/teams/store/useTeamsStore';
|
import IconSort from '../assets/icon-sort.svg';
|
||||||
|
import { useTeamStore } from '../store/useTeamsStore';
|
||||||
|
|
||||||
export const PanelActions = () => {
|
export const PanelActions = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@@ -5,8 +5,9 @@ import { useTranslation } from 'react-i18next';
|
|||||||
import IconGroup from '@/assets/icons/icon-group.svg';
|
import IconGroup from '@/assets/icons/icon-group.svg';
|
||||||
import { Box, StyledLink, Text } from '@/components';
|
import { Box, StyledLink, Text } from '@/components';
|
||||||
import { useCunninghamTheme } from '@/cunningham';
|
import { useCunninghamTheme } from '@/cunningham';
|
||||||
import { Team } from '@/features/teams/';
|
import { Team } from '@/features/teams/team-management';
|
||||||
import IconNone from '@/features/teams/assets/icon-none.svg';
|
|
||||||
|
import IconNone from '../assets/icon-none.svg';
|
||||||
|
|
||||||
interface TeamProps {
|
interface TeamProps {
|
||||||
team: Team;
|
team: Team;
|
||||||
@@ -4,7 +4,9 @@ import { useTranslation } from 'react-i18next';
|
|||||||
|
|
||||||
import { Box, Text } from '@/components';
|
import { Box, Text } from '@/components';
|
||||||
import { InfiniteScroll } from '@/components/InfiniteScroll';
|
import { InfiniteScroll } from '@/components/InfiniteScroll';
|
||||||
import { Team, useTeamStore, useTeams } from '@/features/teams/';
|
import { Team, useTeams } from '@/features/teams/team-management';
|
||||||
|
|
||||||
|
import { useTeamStore } from '../store';
|
||||||
|
|
||||||
import { TeamItem } from './TeamItem';
|
import { TeamItem } from './TeamItem';
|
||||||
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
export * from './Panel';
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
export * from './components';
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import { create } from 'zustand';
|
import { create } from 'zustand';
|
||||||
|
|
||||||
import { TeamsOrdering } from '../api/useTeams';
|
import { TeamsOrdering } from '@/features/teams/team-management/api';
|
||||||
|
|
||||||
interface TeamsStore {
|
interface TeamsStore {
|
||||||
ordering: TeamsOrdering;
|
ordering: TeamsOrdering;
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import type { ReactElement } from 'react';
|
import type { ReactElement } from 'react';
|
||||||
|
|
||||||
import { TeamLayout } from '@/features/teams/';
|
import { TeamLayout } from '@/features/teams/team-management';
|
||||||
import { NextPageWithLayout } from '@/types/next';
|
import { NextPageWithLayout } from '@/types/next';
|
||||||
|
|
||||||
import Teams from './teams/';
|
import Teams from './teams/';
|
||||||
|
|||||||
@@ -5,8 +5,13 @@ import { ReactElement } from 'react';
|
|||||||
|
|
||||||
import { Box } from '@/components';
|
import { Box } from '@/components';
|
||||||
import { TextErrors } from '@/components/TextErrors';
|
import { TextErrors } from '@/components/TextErrors';
|
||||||
import { MemberGrid } from '@/features/members';
|
import { MemberGrid } from '@/features/teams/member-management';
|
||||||
import { Role, TeamInfo, TeamLayout, useTeam } from '@/features/teams/';
|
import {
|
||||||
|
Role,
|
||||||
|
TeamInfo,
|
||||||
|
TeamLayout,
|
||||||
|
useTeam,
|
||||||
|
} from '@/features/teams/team-management';
|
||||||
import { NextPageWithLayout } from '@/types/next';
|
import { NextPageWithLayout } from '@/types/next';
|
||||||
|
|
||||||
const Page: NextPageWithLayout = () => {
|
const Page: NextPageWithLayout = () => {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { ReactElement } from 'react';
|
import { ReactElement } from 'react';
|
||||||
|
|
||||||
import { Box } from '@/components';
|
import { Box } from '@/components';
|
||||||
import { CardCreateTeam, TeamLayout } from '@/features/teams/';
|
import { CardCreateTeam, TeamLayout } from '@/features/teams/team-management';
|
||||||
import { NextPageWithLayout } from '@/types/next';
|
import { NextPageWithLayout } from '@/types/next';
|
||||||
|
|
||||||
const Page: NextPageWithLayout = () => {
|
const Page: NextPageWithLayout = () => {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { useTranslation } from 'react-i18next';
|
|||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
|
|
||||||
import { Box, StyledLink } from '@/components';
|
import { Box, StyledLink } from '@/components';
|
||||||
import { TeamLayout } from '@/features/teams/';
|
import { TeamLayout } from '@/features/teams/team-management';
|
||||||
import { NextPageWithLayout } from '@/types/next';
|
import { NextPageWithLayout } from '@/types/next';
|
||||||
|
|
||||||
const StyledButton = styled(Button)`
|
const StyledButton = styled(Button)`
|
||||||
|
|||||||