diff --git a/src/frontend/apps/impress/src/features/teams/__tests__/PanelTeams.test.tsx b/src/frontend/apps/impress/src/features/teams/__tests__/PanelTeams.test.tsx
deleted file mode 100644
index 585ac30f..00000000
--- a/src/frontend/apps/impress/src/features/teams/__tests__/PanelTeams.test.tsx
+++ /dev/null
@@ -1,174 +0,0 @@
-import '@testing-library/jest-dom';
-import { render, screen } from '@testing-library/react';
-import userEvent from '@testing-library/user-event';
-import fetchMock from 'fetch-mock';
-
-import { Panel } from '@/features/teams';
-import { AppWrapper } from '@/tests/utils';
-
-import { TeamList } from '../components/Panel/TeamList';
-
-window.HTMLElement.prototype.scroll = function () {};
-
-jest.mock('next/router', () => ({
- ...jest.requireActual('next/router'),
- useRouter: () => ({
- query: {},
- }),
-}));
-
-describe('PanelTeams', () => {
- afterEach(() => {
- fetchMock.restore();
- });
-
- it('renders with no team to display', async () => {
- fetchMock.mock(`/api/teams/?page=1&ordering=-created_at`, {
- count: 0,
- results: [],
- });
-
- render(, { wrapper: AppWrapper });
-
- expect(screen.getByRole('status')).toBeInTheDocument();
-
- expect(
- await screen.findByText(
- 'Create your first team by clicking on the "Create a new team" button.',
- ),
- ).toBeInTheDocument();
- });
-
- it('renders an empty team', async () => {
- fetchMock.mock(`/api/teams/?page=1&ordering=-created_at`, {
- count: 1,
- results: [
- {
- id: '1',
- name: 'Team 1',
- accesses: [],
- },
- ],
- });
-
- render(, { wrapper: AppWrapper });
-
- expect(screen.getByRole('status')).toBeInTheDocument();
-
- expect(
- await screen.findByLabelText('Empty teams icon'),
- ).toBeInTheDocument();
- });
-
- it('renders a team with only 1 member', async () => {
- fetchMock.mock(`/api/teams/?page=1&ordering=-created_at`, {
- count: 1,
- results: [
- {
- id: '1',
- name: 'Team 1',
- accesses: [
- {
- id: '1',
- role: 'owner',
- },
- ],
- },
- ],
- });
-
- render(, { wrapper: AppWrapper });
-
- expect(screen.getByRole('status')).toBeInTheDocument();
-
- expect(
- await screen.findByLabelText('Empty teams icon'),
- ).toBeInTheDocument();
- });
-
- it('renders a non-empty team', async () => {
- fetchMock.mock(`/api/teams/?page=1&ordering=-created_at`, {
- count: 1,
- results: [
- {
- id: '1',
- name: 'Team 1',
- accesses: [
- {
- id: '1',
- role: 'admin',
- },
- {
- id: '2',
- role: 'member',
- },
- ],
- },
- ],
- });
-
- render(, { wrapper: AppWrapper });
-
- expect(screen.getByRole('status')).toBeInTheDocument();
-
- expect(await screen.findByLabelText('Teams icon')).toBeInTheDocument();
- });
-
- it('renders the error', async () => {
- fetchMock.mock(`/api/teams/?page=1&ordering=-created_at`, {
- status: 500,
- });
-
- render(, { wrapper: AppWrapper });
-
- expect(screen.getByRole('status')).toBeInTheDocument();
-
- expect(
- await screen.findByText(
- 'Something bad happens, please refresh the page.',
- ),
- ).toBeInTheDocument();
- });
-
- it('renders with team panel open', async () => {
- fetchMock.mock(`/api/teams/?page=1&ordering=-created_at`, {
- count: 1,
- results: [],
- });
-
- render(, { wrapper: AppWrapper });
-
- expect(
- screen.getByRole('button', { name: 'Close the teams panel' }),
- ).toBeVisible();
-
- expect(await screen.findByText('Recents')).toBeVisible();
- });
-
- it('closes and opens the team panel', async () => {
- fetchMock.mock(`/api/teams/?page=1&ordering=-created_at`, {
- count: 1,
- results: [],
- });
-
- render(, { wrapper: AppWrapper });
-
- expect(await screen.findByText('Recents')).toBeVisible();
-
- await userEvent.click(
- screen.getByRole('button', {
- name: 'Close the teams panel',
- }),
- );
-
- expect(await screen.findByText('Recents')).not.toBeVisible();
-
- await userEvent.click(
- screen.getByRole('button', {
- name: 'Open the teams panel',
- }),
- );
-
- expect(await screen.findByText('Recents')).toBeVisible();
- });
-});
diff --git a/src/frontend/apps/impress/src/features/teams/api/index.ts b/src/frontend/apps/impress/src/features/teams/api/index.ts
deleted file mode 100644
index 82a556e0..00000000
--- a/src/frontend/apps/impress/src/features/teams/api/index.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-export * from './useCreateTeam';
-export * from './useRemoveTeam';
-export * from './useTeam';
-export * from './useTeams';
-export * from './useUpdateTeam';
diff --git a/src/frontend/apps/impress/src/features/teams/api/useCreateTeam.tsx b/src/frontend/apps/impress/src/features/teams/api/useCreateTeam.tsx
deleted file mode 100644
index 97dbd1b5..00000000
--- a/src/frontend/apps/impress/src/features/teams/api/useCreateTeam.tsx
+++ /dev/null
@@ -1,45 +0,0 @@
-import { useMutation, useQueryClient } from '@tanstack/react-query';
-
-import { APIError, errorCauses, fetchAPI } from '@/api';
-
-import { KEY_LIST_TEAM } from './useTeams';
-
-type CreateTeamResponse = {
- id: string;
- name: string;
-};
-
-export const createTeam = async (name: string): Promise => {
- const response = await fetchAPI(`teams/`, {
- method: 'POST',
- body: JSON.stringify({
- name,
- }),
- });
-
- if (!response.ok) {
- throw new APIError(
- 'Failed to create the team',
- await errorCauses(response),
- );
- }
-
- return response.json() as Promise;
-};
-
-interface CreateTeamProps {
- onSuccess: (data: CreateTeamResponse) => void;
-}
-
-export function useCreateTeam({ onSuccess }: CreateTeamProps) {
- const queryClient = useQueryClient();
- return useMutation({
- mutationFn: createTeam,
- onSuccess: (data) => {
- void queryClient.invalidateQueries({
- queryKey: [KEY_LIST_TEAM],
- });
- onSuccess(data);
- },
- });
-}
diff --git a/src/frontend/apps/impress/src/features/teams/api/useRemoveTeam.tsx b/src/frontend/apps/impress/src/features/teams/api/useRemoveTeam.tsx
deleted file mode 100644
index 8e78c542..00000000
--- a/src/frontend/apps/impress/src/features/teams/api/useRemoveTeam.tsx
+++ /dev/null
@@ -1,51 +0,0 @@
-import {
- UseMutationOptions,
- useMutation,
- useQueryClient,
-} from '@tanstack/react-query';
-
-import { APIError, errorCauses, fetchAPI } from '@/api';
-
-import { KEY_LIST_TEAM } from './useTeams';
-
-interface RemoveTeamProps {
- teamId: string;
-}
-
-export const removeTeam = async ({
- teamId,
-}: RemoveTeamProps): Promise => {
- const response = await fetchAPI(`teams/${teamId}/`, {
- method: 'DELETE',
- });
-
- if (!response.ok) {
- throw new APIError(
- 'Failed to delete the team',
- await errorCauses(response),
- );
- }
-};
-
-type UseRemoveTeamOptions = UseMutationOptions;
-
-export const useRemoveTeam = (options?: UseRemoveTeamOptions) => {
- const queryClient = useQueryClient();
- return useMutation({
- mutationFn: removeTeam,
- ...options,
- onSuccess: (data, variables, context) => {
- void queryClient.invalidateQueries({
- queryKey: [KEY_LIST_TEAM],
- });
- if (options?.onSuccess) {
- options.onSuccess(data, variables, context);
- }
- },
- onError: (error, variables, context) => {
- if (options?.onError) {
- options.onError(error, variables, context);
- }
- },
- });
-};
diff --git a/src/frontend/apps/impress/src/features/teams/api/useTeam.tsx b/src/frontend/apps/impress/src/features/teams/api/useTeam.tsx
deleted file mode 100644
index b1e6af34..00000000
--- a/src/frontend/apps/impress/src/features/teams/api/useTeam.tsx
+++ /dev/null
@@ -1,32 +0,0 @@
-import { UseQueryOptions, useQuery } from '@tanstack/react-query';
-
-import { APIError, errorCauses, fetchAPI } from '@/api';
-
-import { Team } from '../types';
-
-export type TeamParams = {
- id: string;
-};
-
-export const getTeam = async ({ id }: TeamParams): Promise => {
- const response = await fetchAPI(`teams/${id}`);
-
- if (!response.ok) {
- throw new APIError('Failed to get the team', await errorCauses(response));
- }
-
- return response.json() as Promise;
-};
-
-export const KEY_TEAM = 'team';
-
-export function useTeam(
- param: TeamParams,
- queryConfig?: UseQueryOptions,
-) {
- return useQuery({
- queryKey: [KEY_TEAM, param],
- queryFn: () => getTeam(param),
- ...queryConfig,
- });
-}
diff --git a/src/frontend/apps/impress/src/features/teams/api/useTeams.tsx b/src/frontend/apps/impress/src/features/teams/api/useTeams.tsx
deleted file mode 100644
index f259f263..00000000
--- a/src/frontend/apps/impress/src/features/teams/api/useTeams.tsx
+++ /dev/null
@@ -1,71 +0,0 @@
-import {
- DefinedInitialDataInfiniteOptions,
- InfiniteData,
- QueryKey,
- useInfiniteQuery,
-} from '@tanstack/react-query';
-
-import { APIError, APIList, errorCauses, fetchAPI } from '@/api';
-
-import { Team } from '../types';
-
-export enum TeamsOrdering {
- BY_CREATED_ON = 'created_at',
- BY_CREATED_ON_DESC = '-created_at',
-}
-
-export type TeamsParams = {
- ordering: TeamsOrdering;
-};
-type TeamsAPIParams = TeamsParams & {
- page: number;
-};
-
-type TeamsResponse = APIList;
-
-export const getTeams = async ({
- ordering,
- page,
-}: TeamsAPIParams): Promise => {
- const orderingQuery = ordering ? `&ordering=${ordering}` : '';
- const response = await fetchAPI(`teams/?page=${page}${orderingQuery}`);
-
- if (!response.ok) {
- throw new APIError('Failed to get the teams', await errorCauses(response));
- }
-
- return response.json() as Promise;
-};
-
-export const KEY_LIST_TEAM = 'teams';
-
-export function useTeams(
- param: TeamsParams,
- queryConfig?: DefinedInitialDataInfiniteOptions<
- TeamsResponse,
- APIError,
- InfiniteData,
- QueryKey,
- number
- >,
-) {
- return useInfiniteQuery<
- TeamsResponse,
- APIError,
- InfiniteData,
- QueryKey,
- number
- >({
- initialPageParam: 1,
- queryKey: [KEY_LIST_TEAM, param],
- queryFn: ({ pageParam }) =>
- getTeams({
- ...param,
- page: pageParam,
- }),
- getNextPageParam(lastPage, allPages) {
- return lastPage.next ? allPages.length + 1 : undefined;
- },
- ...queryConfig,
- });
-}
diff --git a/src/frontend/apps/impress/src/features/teams/api/useUpdateTeam.tsx b/src/frontend/apps/impress/src/features/teams/api/useUpdateTeam.tsx
deleted file mode 100644
index 4520d7ab..00000000
--- a/src/frontend/apps/impress/src/features/teams/api/useUpdateTeam.tsx
+++ /dev/null
@@ -1,51 +0,0 @@
-import { useMutation, useQueryClient } from '@tanstack/react-query';
-
-import { APIError, errorCauses, fetchAPI } from '@/api';
-
-import { Team } from '../types';
-
-import { KEY_TEAM } from './useTeam';
-import { KEY_LIST_TEAM } from './useTeams';
-
-type UpdateTeamProps = Pick;
-
-export const updateTeam = async ({
- name,
- id,
-}: UpdateTeamProps): Promise => {
- const response = await fetchAPI(`teams/${id}/`, {
- method: 'PATCH',
- body: JSON.stringify({
- name,
- }),
- });
-
- if (!response.ok) {
- throw new APIError(
- 'Failed to update the team',
- await errorCauses(response),
- );
- }
-
- return response.json() as Promise;
-};
-
-interface UseUpdateTeamProps {
- onSuccess: (data: Team) => void;
-}
-
-export function useUpdateTeam({ onSuccess }: UseUpdateTeamProps) {
- const queryClient = useQueryClient();
- return useMutation({
- mutationFn: updateTeam,
- onSuccess: (data) => {
- void queryClient.invalidateQueries({
- queryKey: [KEY_LIST_TEAM],
- });
- void queryClient.invalidateQueries({
- queryKey: [KEY_TEAM],
- });
- onSuccess(data);
- },
- });
-}
diff --git a/src/frontend/apps/impress/src/features/teams/assets/icon-add.svg b/src/frontend/apps/impress/src/features/teams/assets/icon-add.svg
deleted file mode 100644
index d561aae3..00000000
--- a/src/frontend/apps/impress/src/features/teams/assets/icon-add.svg
+++ /dev/null
@@ -1,3 +0,0 @@
-
diff --git a/src/frontend/apps/impress/src/features/teams/assets/icon-edit.svg b/src/frontend/apps/impress/src/features/teams/assets/icon-edit.svg
deleted file mode 100644
index 5e316214..00000000
--- a/src/frontend/apps/impress/src/features/teams/assets/icon-edit.svg
+++ /dev/null
@@ -1,6 +0,0 @@
-
diff --git a/src/frontend/apps/impress/src/features/teams/assets/icon-none.svg b/src/frontend/apps/impress/src/features/teams/assets/icon-none.svg
deleted file mode 100644
index 9f80850e..00000000
--- a/src/frontend/apps/impress/src/features/teams/assets/icon-none.svg
+++ /dev/null
@@ -1,13 +0,0 @@
-
diff --git a/src/frontend/apps/impress/src/features/teams/assets/icon-open-close.svg b/src/frontend/apps/impress/src/features/teams/assets/icon-open-close.svg
deleted file mode 100644
index c87764ac..00000000
--- a/src/frontend/apps/impress/src/features/teams/assets/icon-open-close.svg
+++ /dev/null
@@ -1,4 +0,0 @@
-
diff --git a/src/frontend/apps/impress/src/features/teams/assets/icon-sort.svg b/src/frontend/apps/impress/src/features/teams/assets/icon-sort.svg
deleted file mode 100644
index ac4565d3..00000000
--- a/src/frontend/apps/impress/src/features/teams/assets/icon-sort.svg
+++ /dev/null
@@ -1,13 +0,0 @@
-
diff --git a/src/frontend/apps/impress/src/features/teams/assets/icon-trash.svg b/src/frontend/apps/impress/src/features/teams/assets/icon-trash.svg
deleted file mode 100644
index caa4e96d..00000000
--- a/src/frontend/apps/impress/src/features/teams/assets/icon-trash.svg
+++ /dev/null
@@ -1,3 +0,0 @@
-
diff --git a/src/frontend/apps/impress/src/features/teams/components/CardCreateTeam.tsx b/src/frontend/apps/impress/src/features/teams/components/CardCreateTeam.tsx
deleted file mode 100644
index 9cb02101..00000000
--- a/src/frontend/apps/impress/src/features/teams/components/CardCreateTeam.tsx
+++ /dev/null
@@ -1,66 +0,0 @@
-import { Button } from '@openfun/cunningham-react';
-import { useRouter } from 'next/navigation';
-import { useState } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import IconGroup from '@/assets/icons/icon-group2.svg';
-import { Box, Card, StyledLink, Text } from '@/components';
-import { useCunninghamTheme } from '@/cunningham';
-
-import { useCreateTeam } from '../api';
-
-import { InputTeamName } from './InputTeamName';
-
-export const CardCreateTeam = () => {
- const { t } = useTranslation();
- const router = useRouter();
- const {
- mutate: createTeam,
- isError,
- isPending,
- error,
- } = useCreateTeam({
- onSuccess: (team) => {
- router.push(`/teams/${team.id}`);
- },
- });
- const [teamName, setTeamName] = useState('');
- const { colorsTokens } = useCunninghamTheme();
-
- return (
-
-
-
-
-
- {t('Name the team')}
-
-
-
-
-
-
-
-
-
-
-
- );
-};
diff --git a/src/frontend/apps/impress/src/features/teams/components/InputTeamName.tsx b/src/frontend/apps/impress/src/features/teams/components/InputTeamName.tsx
deleted file mode 100644
index fe8df73a..00000000
--- a/src/frontend/apps/impress/src/features/teams/components/InputTeamName.tsx
+++ /dev/null
@@ -1,54 +0,0 @@
-import { Input, Loader } from '@openfun/cunningham-react';
-import { useEffect, useState } from 'react';
-
-import { APIError } from '@/api';
-import { Box, TextErrors } from '@/components';
-
-interface InputTeamNameProps {
- error: APIError | null;
- isError: boolean;
- isPending: boolean;
- label: string;
- setTeamName: (newTeamName: string) => void;
- defaultValue?: string;
-}
-
-export const InputTeamName = ({
- defaultValue,
- error,
- isError,
- isPending,
- label,
- setTeamName,
-}: InputTeamNameProps) => {
- const [isInputError, setIsInputError] = useState(isError);
-
- useEffect(() => {
- if (isError) {
- setIsInputError(true);
- }
- }, [isError]);
-
- return (
- <>
- {
- setTeamName(e.target.value);
- setIsInputError(false);
- }}
- rightIcon={edit}
- state={isInputError ? 'error' : 'default'}
- />
- {isError && error && }
- {isPending && (
-
-
-
- )}
- >
- );
-};
diff --git a/src/frontend/apps/impress/src/features/teams/components/ModalRemoveTeam.tsx b/src/frontend/apps/impress/src/features/teams/components/ModalRemoveTeam.tsx
deleted file mode 100644
index 04d2d82d..00000000
--- a/src/frontend/apps/impress/src/features/teams/components/ModalRemoveTeam.tsx
+++ /dev/null
@@ -1,119 +0,0 @@
-import {
- Button,
- Modal,
- ModalSize,
- VariantType,
- useToastProvider,
-} from '@openfun/cunningham-react';
-import { t } from 'i18next';
-import { useRouter } from 'next/navigation';
-
-import IconGroup from '@/assets/icons/icon-group.svg';
-import { Box, Text, TextErrors } from '@/components';
-import useCunninghamTheme from '@/cunningham/useCunninghamTheme';
-
-import { useRemoveTeam } from '../api/useRemoveTeam';
-import IconRemove from '../assets/icon-trash.svg';
-import { Team } from '../types';
-
-interface ModalRemoveTeamProps {
- onClose: () => void;
- team: Team;
-}
-
-export const ModalRemoveTeam = ({ onClose, team }: ModalRemoveTeamProps) => {
- const { colorsTokens } = useCunninghamTheme();
- const { toast } = useToastProvider();
- const router = useRouter();
-
- const {
- mutate: removeTeam,
- isError,
- error,
- } = useRemoveTeam({
- onSuccess: () => {
- toast(t('The team has been removed.'), VariantType.SUCCESS, {
- duration: 4000,
- });
- router.push('/');
- },
- });
-
- return (
- onClose()}
- >
- {t('Cancel')}
-
- }
- onClose={() => onClose()}
- rightActions={
-
- }
- size={ModalSize.MEDIUM}
- title={
-
-
-
- {t('Deleting the {{teamName}} team', { teamName: team.name })}
-
-
- }
- >
-
-
- {t('Are you sure you want to delete {{teamName}} team?', {
- teamName: team.name,
- })}
-
-
- {isError && }
-
-
-
-
- {team.name}
-
-
-
-
- );
-};
diff --git a/src/frontend/apps/impress/src/features/teams/components/ModalUpdateTeam.tsx b/src/frontend/apps/impress/src/features/teams/components/ModalUpdateTeam.tsx
deleted file mode 100644
index 60d0fc6f..00000000
--- a/src/frontend/apps/impress/src/features/teams/components/ModalUpdateTeam.tsx
+++ /dev/null
@@ -1,98 +0,0 @@
-import {
- Button,
- Modal,
- ModalSize,
- VariantType,
- useToastProvider,
-} from '@openfun/cunningham-react';
-import { t } from 'i18next';
-import { useState } from 'react';
-
-import { Box, Text } from '@/components';
-import useCunninghamTheme from '@/cunningham/useCunninghamTheme';
-
-import { useUpdateTeam } from '../api';
-import IconEdit from '../assets/icon-edit.svg';
-import { Team } from '../types';
-
-import { InputTeamName } from './InputTeamName';
-
-interface ModalUpdateTeamProps {
- onClose: () => void;
- team: Team;
-}
-
-export const ModalUpdateTeam = ({ onClose, team }: ModalUpdateTeamProps) => {
- const { colorsTokens } = useCunninghamTheme();
- const [teamName, setTeamName] = useState(team.name);
- const { toast } = useToastProvider();
-
- const {
- mutate: updateTeam,
- isError,
- isPending,
- error,
- } = useUpdateTeam({
- onSuccess: () => {
- toast(t('The team has been updated.'), VariantType.SUCCESS, {
- duration: 4000,
- });
- onClose();
- },
- });
-
- return (
- onClose()}
- >
- {t('Cancel')}
-
- }
- onClose={() => onClose()}
- rightActions={
-
- }
- size={ModalSize.MEDIUM}
- title={
-
-
-
- {t('Update team {{teamName}}', { teamName: team.name })}
-
-
- }
- >
-
-
- {t('Enter the new name of the selected team')}
-
-
-
-
-
- );
-};
diff --git a/src/frontend/apps/impress/src/features/teams/components/Panel/Panel.tsx b/src/frontend/apps/impress/src/features/teams/components/Panel/Panel.tsx
deleted file mode 100644
index f519cfe2..00000000
--- a/src/frontend/apps/impress/src/features/teams/components/Panel/Panel.tsx
+++ /dev/null
@@ -1,80 +0,0 @@
-import React, { useState } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import { Box, BoxButton, Text } from '@/components';
-import { useCunninghamTheme } from '@/cunningham';
-import IconOpenClose from '@/features/teams/assets/icon-open-close.svg';
-
-import { PanelActions } from './PanelActions';
-import { TeamList } from './TeamList';
-
-export const Panel = () => {
- const { t } = useTranslation();
- const { colorsTokens } = useCunninghamTheme();
-
- const [isOpen, setIsOpen] = useState(true);
-
- const closedOverridingStyles = !isOpen && {
- $width: '0',
- $maxWidth: '0',
- $minWidth: '0',
- };
-
- const transition = 'all 0.5s ease-in-out';
-
- return (
-
- setIsOpen(!isOpen)}
- >
-
-
-
-
-
- {t('Recents')}
-
-
-
-
-
-
- );
-};
diff --git a/src/frontend/apps/impress/src/features/teams/components/Panel/PanelActions.tsx b/src/frontend/apps/impress/src/features/teams/components/Panel/PanelActions.tsx
deleted file mode 100644
index cfe16d44..00000000
--- a/src/frontend/apps/impress/src/features/teams/components/Panel/PanelActions.tsx
+++ /dev/null
@@ -1,55 +0,0 @@
-import React from 'react';
-import { useTranslation } from 'react-i18next';
-
-import { Box, BoxButton, StyledLink } from '@/components';
-import { useCunninghamTheme } from '@/cunningham';
-import { TeamsOrdering } from '@/features/teams/api/';
-import IconAdd from '@/features/teams/assets/icon-add.svg';
-import IconSort from '@/features/teams/assets/icon-sort.svg';
-import { useTeamStore } from '@/features/teams/store/useTeamsStore';
-
-export const PanelActions = () => {
- const { t } = useTranslation();
- const { changeOrdering, ordering } = useTeamStore();
- const { colorsTokens } = useCunninghamTheme();
-
- const isSortAsc = ordering === TeamsOrdering.BY_CREATED_ON;
-
- return (
-
-
-
-
-
-
-
-
-
-
- );
-};
diff --git a/src/frontend/apps/impress/src/features/teams/components/Panel/TeamItem.tsx b/src/frontend/apps/impress/src/features/teams/components/Panel/TeamItem.tsx
deleted file mode 100644
index 81c3dfca..00000000
--- a/src/frontend/apps/impress/src/features/teams/components/Panel/TeamItem.tsx
+++ /dev/null
@@ -1,101 +0,0 @@
-import { useRouter } from 'next/router';
-import React from 'react';
-import { useTranslation } from 'react-i18next';
-
-import IconGroup from '@/assets/icons/icon-group.svg';
-import { Box, StyledLink, Text } from '@/components';
-import { useCunninghamTheme } from '@/cunningham';
-import { Team } from '@/features/teams/';
-import IconNone from '@/features/teams/assets/icon-none.svg';
-
-interface TeamProps {
- team: Team;
-}
-
-export const TeamItem = ({ team }: TeamProps) => {
- const { t } = useTranslation();
- const { colorsTokens } = useCunninghamTheme();
- const {
- query: { id },
- } = useRouter();
-
- // There is at least 1 owner in the team
- const hasMembers = team.accesses.length > 1;
- const isActive = team.id === id;
-
- const commonProps = {
- className: 'p-t',
- width: 52,
- style: {
- borderRadius: '10px',
- flexShrink: 0,
- background: '#fff',
- },
- };
-
- const activeStyle = `
- border-right: 4px solid ${colorsTokens()['primary-600']};
- background: ${colorsTokens()['primary-400']};
- span{
- color: ${colorsTokens()['primary-text']};
- }
- `;
-
- const hoverStyle = `
- &:hover{
- border-right: 4px solid ${colorsTokens()['primary-400']};
- background: ${colorsTokens()['primary-300']};
-
- span{
- color: ${colorsTokens()['primary-text']};
- }
- }
- `;
-
- return (
-
-
-
- {hasMembers ? (
-
- ) : (
-
- )}
-
- {team.name}
-
-
-
-
- );
-};
diff --git a/src/frontend/apps/impress/src/features/teams/components/Panel/TeamList.tsx b/src/frontend/apps/impress/src/features/teams/components/Panel/TeamList.tsx
deleted file mode 100644
index c042b088..00000000
--- a/src/frontend/apps/impress/src/features/teams/components/Panel/TeamList.tsx
+++ /dev/null
@@ -1,92 +0,0 @@
-import { Loader } from '@openfun/cunningham-react';
-import React, { useMemo, useRef } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import { Box, Text } from '@/components';
-import { InfiniteScroll } from '@/components/InfiniteScroll';
-import { Team, useTeamStore, useTeams } from '@/features/teams/';
-
-import { TeamItem } from './TeamItem';
-
-interface PanelTeamsStateProps {
- isLoading: boolean;
- isError: boolean;
- teams?: Team[];
-}
-
-const TeamListState = ({ isLoading, isError, teams }: PanelTeamsStateProps) => {
- const { t } = useTranslation();
-
- if (isError) {
- return (
-
-
- {t('Something bad happens, please refresh the page.')}
-
-
- );
- }
-
- if (isLoading) {
- return (
-
-
-
- );
- }
-
- if (!teams?.length) {
- return (
-
-
- {t('0 group to display.')}
-
-
- {t(
- 'Create your first team by clicking on the "Create a new team" button.',
- )}
-
-
- );
- }
-
- return teams.map((team) => );
-};
-
-export const TeamList = () => {
- const ordering = useTeamStore((state) => state.ordering);
- const {
- data,
- isError,
- isLoading,
- fetchNextPage,
- hasNextPage,
- isFetchingNextPage,
- } = useTeams({
- ordering,
- });
- const containerRef = useRef(null);
- const teams = useMemo(() => {
- return data?.pages.reduce((acc, page) => {
- return acc.concat(page.results);
- }, [] as Team[]);
- }, [data?.pages]);
-
- return (
-
- {
- void fetchNextPage();
- }}
- scrollContainer={containerRef.current}
- as="ul"
- className="p-0 mt-0"
- role="listbox"
- >
-
-
-
- );
-};
diff --git a/src/frontend/apps/impress/src/features/teams/components/TeamActions.tsx b/src/frontend/apps/impress/src/features/teams/components/TeamActions.tsx
deleted file mode 100644
index d29c65a5..00000000
--- a/src/frontend/apps/impress/src/features/teams/components/TeamActions.tsx
+++ /dev/null
@@ -1,78 +0,0 @@
-import { Button } from '@openfun/cunningham-react';
-import React, { useState } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import { Box, DropButton, IconOptions, Text } from '@/components';
-
-import { Role, Team } from '../types';
-
-import { ModalRemoveTeam } from './ModalRemoveTeam';
-import { ModalUpdateTeam } from './ModalUpdateTeam';
-
-interface TeamActionsProps {
- currentRole: Role;
- team: Team;
-}
-
-export const TeamActions = ({ currentRole, team }: TeamActionsProps) => {
- const { t } = useTranslation();
- const [isModalUpdateOpen, setIsModalUpdateOpen] = useState(false);
- const [isModalRemoveOpen, setIsModalRemoveOpen] = useState(false);
- const [isDropOpen, setIsDropOpen] = useState(false);
-
- if (currentRole === Role.MEMBER) {
- return null;
- }
-
- return (
- <>
-
- }
- onOpenChange={(isOpen) => setIsDropOpen(isOpen)}
- isOpen={isDropOpen}
- >
-
-
- {currentRole === Role.OWNER && (
-
- )}
-
-
- {isModalUpdateOpen && (
- setIsModalUpdateOpen(false)}
- team={team}
- />
- )}
- {isModalRemoveOpen && (
- setIsModalRemoveOpen(false)}
- team={team}
- />
- )}
- >
- );
-};
diff --git a/src/frontend/apps/impress/src/features/teams/components/TeamInfo.tsx b/src/frontend/apps/impress/src/features/teams/components/TeamInfo.tsx
deleted file mode 100644
index 823874a0..00000000
--- a/src/frontend/apps/impress/src/features/teams/components/TeamInfo.tsx
+++ /dev/null
@@ -1,103 +0,0 @@
-import { DateTime, DateTimeFormatOptions } from 'luxon';
-import React, { useState } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import IconGroup from '@/assets/icons/icon-group2.svg';
-import { Box, Card, Text } from '@/components';
-import { useCunninghamTheme } from '@/cunningham';
-
-import { Role, Team } from '../types';
-
-import { ModalUpdateTeam } from './ModalUpdateTeam';
-import { TeamActions } from './TeamActions';
-
-const format: DateTimeFormatOptions = {
- month: '2-digit',
- day: '2-digit',
- year: 'numeric',
-};
-
-interface TeamInfoProps {
- team: Team;
- currentRole: Role;
-}
-
-export const TeamInfo = ({ team, currentRole }: TeamInfoProps) => {
- const { t } = useTranslation();
- const { colorsTokens } = useCunninghamTheme();
- const { i18n } = useTranslation();
- const [isModalUpdateOpen, setIsModalUpdateOpen] = useState(false);
-
- const created_at = DateTime.fromISO(team.created_at)
- .setLocale(i18n.language)
- .toLocaleString(format);
-
- const updated_at = DateTime.fromISO(team.updated_at)
- .setLocale(i18n.language)
- .toLocaleString(format);
-
- return (
- <>
-
-
-
-
-
-
-
-
- {t('Members of “{{teamName}}“', {
- teamName: team.name,
- })}
-
-
- {t('Add people to the “{{teamName}}“ group.', {
- teamName: team.name,
- })}
-
-
-
-
-
- {t('{{count}} member', { count: team.accesses.length })}
-
-
- {t('Created at')}
-
- {created_at}
-
-
-
- {t('Last update at')}
-
- {updated_at}
-
-
-
-
- {isModalUpdateOpen && (
- setIsModalUpdateOpen(false)}
- team={team}
- />
- )}
- >
- );
-};
diff --git a/src/frontend/apps/impress/src/features/teams/components/TeamLayout.tsx b/src/frontend/apps/impress/src/features/teams/components/TeamLayout.tsx
deleted file mode 100644
index ec818228..00000000
--- a/src/frontend/apps/impress/src/features/teams/components/TeamLayout.tsx
+++ /dev/null
@@ -1,25 +0,0 @@
-import { PropsWithChildren } from 'react';
-
-import { Box } from '@/components';
-import { MainLayout } from '@/core';
-import { useCunninghamTheme } from '@/cunningham';
-import { Panel } from '@/features/teams';
-
-export function TeamLayout({ children }: PropsWithChildren) {
- const { colorsTokens } = useCunninghamTheme();
-
- return (
-
-
-
-
- {children}
-
-
-
- );
-}
diff --git a/src/frontend/apps/impress/src/features/teams/components/index.ts b/src/frontend/apps/impress/src/features/teams/components/index.ts
deleted file mode 100644
index e1efbc26..00000000
--- a/src/frontend/apps/impress/src/features/teams/components/index.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-export * from './CardCreateTeam';
-export * from './Panel/Panel';
-export * from './TeamInfo';
-export * from './TeamLayout';
diff --git a/src/frontend/apps/impress/src/features/teams/index.tsx b/src/frontend/apps/impress/src/features/teams/index.tsx
deleted file mode 100644
index 47fce0a5..00000000
--- a/src/frontend/apps/impress/src/features/teams/index.tsx
+++ /dev/null
@@ -1,4 +0,0 @@
-export * from './api';
-export * from './components';
-export * from './types';
-export * from './store';
diff --git a/src/frontend/apps/impress/src/features/teams/store/index.ts b/src/frontend/apps/impress/src/features/teams/store/index.ts
deleted file mode 100644
index 24797267..00000000
--- a/src/frontend/apps/impress/src/features/teams/store/index.ts
+++ /dev/null
@@ -1 +0,0 @@
-export * from './useTeamsStore';
diff --git a/src/frontend/apps/impress/src/features/teams/store/useTeamsStore.tsx b/src/frontend/apps/impress/src/features/teams/store/useTeamsStore.tsx
deleted file mode 100644
index d9a79d2d..00000000
--- a/src/frontend/apps/impress/src/features/teams/store/useTeamsStore.tsx
+++ /dev/null
@@ -1,19 +0,0 @@
-import { create } from 'zustand';
-
-import { TeamsOrdering } from '../api/useTeams';
-
-interface TeamsStore {
- ordering: TeamsOrdering;
- changeOrdering: () => void;
-}
-
-export const useTeamStore = create((set) => ({
- ordering: TeamsOrdering.BY_CREATED_ON_DESC,
- changeOrdering: () =>
- set(({ ordering }) => ({
- ordering:
- ordering === TeamsOrdering.BY_CREATED_ON
- ? TeamsOrdering.BY_CREATED_ON_DESC
- : TeamsOrdering.BY_CREATED_ON,
- })),
-}));
diff --git a/src/frontend/apps/impress/src/features/teams/types.tsx b/src/frontend/apps/impress/src/features/teams/types.tsx
deleted file mode 100644
index ee8ad508..00000000
--- a/src/frontend/apps/impress/src/features/teams/types.tsx
+++ /dev/null
@@ -1,22 +0,0 @@
-import { Access } from '@/features/members';
-
-export enum Role {
- MEMBER = 'member',
- ADMIN = 'administrator',
- OWNER = 'owner',
-}
-
-export interface Team {
- id: string;
- name: string;
- accesses: Access[];
- created_at: string;
- updated_at: string;
- abilities: {
- delete: boolean;
- get: boolean;
- manage_accesses: boolean;
- patch: boolean;
- put: boolean;
- };
-}