From 8677a0280c5284a8b196cca469fb4701ba101dcf Mon Sep 17 00:00:00 2001 From: Pankaj Date: Wed, 20 Nov 2024 09:54:32 +0530 Subject: [PATCH] Remove dev flag to show the new UI changes (#1277) * fix: remove dev flag and related test and old UI code * fix: change received value * chore: change component name --- __tests__/Unit/pages/Mine/Mine.test.tsx | 50 ++++++------------------- src/pages/mine/index.tsx | 41 +------------------- 2 files changed, 13 insertions(+), 78 deletions(-) diff --git a/__tests__/Unit/pages/Mine/Mine.test.tsx b/__tests__/Unit/pages/Mine/Mine.test.tsx index 203d30c17..62898270c 100644 --- a/__tests__/Unit/pages/Mine/Mine.test.tsx +++ b/__tests__/Unit/pages/Mine/Mine.test.tsx @@ -79,24 +79,12 @@ describe('Mine Page', () => { ); }); - it('should render no tasks found state when dev is enabled', async () => { - const { getByText } = renderWithRouter( - - - , - { route: '/mine', query: { dev: 'true' } } - ); - await waitFor(() => - expect(getByText(/no tasks found/i)).toBeInTheDocument() - ); - }); - it('should render shimmer cards', async () => { const { getAllByTestId } = renderWithRouter( , - { route: '/mine', query: { dev: 'true' } } + { route: '/mine' } ); await waitFor(() => @@ -106,39 +94,23 @@ describe('Mine Page', () => { ); }); - it('should render old UI component for mine tasks when dev is disabled', async () => { + it('should render filter dropdown', async () => { const { getByText } = renderWithRouter( , - { route: '/mine', query: { dev: 'false' } } - ); - await waitFor(() => - expect( - getByText( - /Collapse non-interesting tasks or PRs in member details page/i - ) - ).toBeInTheDocument() - ); - }); - - it('should render filter dropdown when dev is enabled', async () => { - const { getByText } = renderWithRouter( - - - , - { route: '/mine', query: { dev: 'true' } } + { route: '/mine' } ); await waitFor(() => expect(getByText(/Filter/i)).toBeInTheDocument()); }); - it('should render search input when dev is enabled', async () => { + it('should render search input', async () => { const { getByTestId } = renderWithRouter( , - { route: '/mine', query: { dev: 'true' } } + { route: '/mine' } ); await waitFor(() => @@ -146,12 +118,12 @@ describe('Mine Page', () => { ); }); - it('should render new UI component for mine tasks when dev is enabled', async () => { + it('should render task cards', async () => { const { getAllByTestId } = renderWithRouter( , - { route: '/mine', query: { dev: 'true' } } + { route: '/mine' } ); await waitFor(() => @@ -161,12 +133,12 @@ describe('Mine Page', () => { ); }); - it('should filter tasks based on search input when dev is enabled', async () => { + it('should filter tasks based on search input', async () => { const { findByText, getAllByText, findByTestId } = renderWithRouter( , - { route: '/mine', query: { dev: 'true' } } + { route: '/mine' } ); const searchInput = await findByTestId('search-input'); @@ -179,12 +151,12 @@ describe('Mine Page', () => { }); }); - it('should filter tasks based on filter dropdown select when dev is enabled', async () => { + it('should filter tasks based on filter dropdown select', async () => { const { findByText, getAllByText } = renderWithRouter( , - { route: '/mine', query: { dev: 'true' } } + { route: '/mine' } ); const dropdown = await findByText('Filter'); diff --git a/src/pages/mine/index.tsx b/src/pages/mine/index.tsx index 8e88806bb..dbe9fa448 100644 --- a/src/pages/mine/index.tsx +++ b/src/pages/mine/index.tsx @@ -14,8 +14,6 @@ import { getActiveTab } from '@/utils/getActiveTab'; import TaskList from '@/components/tasks/TaskList/TaskList'; import getInputValueFromTaskField from '@/utils/getInputValueFromTaskField'; import getFilteredTasks from '@/utils/getFilteredTasks'; -import Card from '@/components/tasks/card'; -import { useRouter } from 'next/router'; import CardShimmer from '@/components/Loaders/cardShimmer'; export const searchTasks = ( @@ -34,7 +32,7 @@ export const searchTasks = ( } }; -const ContentDev = () => { +const Content = () => { const [filteredTasks, setFilteredTasks] = useState(); const [selectedTab, setSelectedTab] = useState(Tab.ALL); const [title, setTitle] = useState(''); @@ -91,39 +89,8 @@ const ContentDev = () => { ); }; -function CardList({ tasks }: { tasks: task[] }) { - return ( - <> - {tasks.map((item) => ( - - ))} - - ); -} - -const Content = () => { - const { data: tasks, error, isLoading } = useGetMineTasksQuery(); - - if (isLoading) return

Loading...

; - if (error) return

Something went wrong! Please contact admin

; - if (tasks?.length) - return ( -
- -
- ); - return

{NO_TASKS_FOUND_MESSAGE}

; -}; - const Mine: FC = () => { const { isLoading: isAuthenticating, isLoggedIn } = useAuthenticated(); - const router = useRouter(); - const dev = router.query.dev === 'true' ? true : false; return ( @@ -132,11 +99,7 @@ const Mine: FC = () => { {isAuthenticating ? ( ) : isLoggedIn ? ( - dev ? ( - - ) : ( - - ) + ) : (

You are not Authorized