Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add view option - show empty projects #2978

Merged
merged 2 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 23 additions & 17 deletions cypress/e2e/dashboard.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import {
participants,
projectListItem,
watch,
sortPanel,
sortPanelDropdownTrigger,
sortPanelEmptyProjectsCheckbox,
} from '../../src/utils/domObjects';
import { keyPredictor } from '../../src/utils/keyPredictor';
import { getTranslation } from '../support/lang';
Expand All @@ -33,16 +36,10 @@ describe('Dashboard', () => {
cy.signInViaEmail();
});

it('filters are active by default', () => {
cy.get('body')
.should('exist')
.then(($body) => {
if ($body.find(projectListItem.query).length > 0) {
cy.get(projectListItem.query).filter(`:contains(${projectOne})`).should('not.exist');
return;
}
cy.get(projectListItem.query).should('not.exist');
});
it.only('filters are active by default', () => {
cy.get('body').should('exist');

cy.get(projectListItem.query).filter(`:contains(${projectOne})`).should('exist');

cy.get(filtersPanelResetButton.query).should('exist').click().should('not.exist');

Expand Down Expand Up @@ -89,23 +86,32 @@ describe('User dashboard', () => {
}).then((res) => Cypress.env('testUserProject', res));
});

it('user dont see own project without goals with applied filters', () => {
cy.get(projectListItem.query).should('not.exist');
it('user see own project without goals with applied filters', () => {
cy.get(projectListItem.query).should('exist').and('include.text', userProjectTitle);
});

it('user see own project without goals with clear filters', () => {
it("user don't see own project without goals with empty projects filters", () => {
cy.get(projectListItem.query).should('exist');

cy.get(sortPanel.query).should('not.exist');
cy.get(sortPanelDropdownTrigger.query).should('exist').click();
cy.get(sortPanel.query).should('exist');
cy.get(sortPanelEmptyProjectsCheckbox.query)
.should('exist')
.and('be.checked')
.click()
.should('not.checked');

cy.get(projectListItem.query).should('not.exist');
});

it('user see own project without goals with clear filters', () => {
cy.get(filtersPanelResetButton.query).should('exist').click().should('not.exist');

cy.get(projectListItem.query).should('exist').and('include.text', userProjectTitle);
});

it("user can create goal from projects's list", () => {
cy.get(projectListItem.query).should('not.exist');

cy.get(filtersPanelResetButton.query).should('exist').click().should('not.exist');

cy.get(projectListItem.query).find(createGoalInlineControl.query).and('not.include.text');
});

Expand Down
1 change: 1 addition & 0 deletions src/components/DashboardPage/DashboardPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ export const DashboardPage = ({ user, ssrTime, defaultPresetFallback }: External
filterPreset={preset}
loading={isLoading}
enableLayoutToggle
enableHideProjectToggle
/>
}
>
Expand Down
7 changes: 5 additions & 2 deletions src/components/FiltersBar/FiltersBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { nullable } from '@taskany/bricks';

import { PageView } from '../../hooks/useUrlFilterParams';
import { Dropdown, DropdownPanel, DropdownTrigger } from '../Dropdown/Dropdown';
import { sortPanel, sortPanelDropdownTrigger } from '../../utils/domObjects';

import s from './FiltersBar.module.css';
import { tr } from './FiltersBar.i18n';
Expand Down Expand Up @@ -37,14 +38,16 @@ export const FiltersBarLayoutSwitch: FC<FiltersBarLayoutSwitchProps> = ({ value
export const FiltersBarViewDropdown: FC<{ children?: ReactNode }> = ({ children }) => {
return (
<Dropdown>
<DropdownTrigger className={s.FiltersBarViewDropdownDrigger} view="fill">
<DropdownTrigger className={s.FiltersBarViewDropdownDrigger} view="fill" {...sortPanelDropdownTrigger.attr}>
<div className={s.FiltersBarViewDropdownDrigger}>
<IconAdjustHorizontalSolid size="xxs" />
<Text size="s">{tr('View')}</Text>
</div>
</DropdownTrigger>
<DropdownPanel width={335} placement="bottom-start" className={s.FiltersBarDropdownPanel}>
<div className={s.FiltersBarDropdownPanelContainer}>{children}</div>
<div className={s.FiltersBarDropdownPanelContainer} {...sortPanel.attr}>
{children}
</div>
</DropdownPanel>
</Dropdown>
);
Expand Down
3 changes: 2 additions & 1 deletion src/components/FiltersPanel/FiltersPanel.i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@
"Reset": "Reset",
"Grouping": "Grouping",
"Visibility": "Visibility",
"Criteria": "Criteria"
"Criteria": "Criteria",
"Empty Projects": "Empty Projects"
}
3 changes: 2 additions & 1 deletion src/components/FiltersPanel/FiltersPanel.i18n/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@
"Reset": "Сбросить",
"Grouping": "Группировка",
"Visibility": "Видимость",
"Criteria": "Критерии"
"Criteria": "Критерии",
"Empty Projects": "Пустые Проекты"
}
Loading
Loading