This repository has been archived by the owner on Jan 23, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(dropzone): modify parent divs heights feat(dropzone): add dropzone helper feat(dropzone): modify text fix(dropzone): hide dropzone in favorite screen feat(dropzone): add prop to control dropzone helper visibility fix(dropzone): modify redirection test to match dropzone behavior fix(dropzone): add id, change styles and texts feat: update mode button, refactor (#1030) * refactor: update mode button, refactor * refactor: apply PR requested changes * refactor: update cypress * refactor: mock item layout in commands * refactor: import automatically env in cypress * refactor: env in cypress * refactor: import VITE_GRAASP_REDIRECTION_HOST * refactor: use cypress baseurl feat: move the description in ItemsToolbar to display it directly below the title (#1045) chore(deps): update eslint packages (#1034) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> fix(deps): update ag-grid monorepo to v31.1.1 (#1035) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> fix(deps): update dependency @emotion/react to v11.11.4 (#1036) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> fix(deps): update dependency @sentry/react to v7.105.0 (#1037) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> fix(deps): update react-router monorepo to v6.22.2 (#1023) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> fix(deps): update mui (non-major) (#884) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> fix: remove qs dependency (#1041) * fix: remove qs dependency * fix: update deps chore(deps): update yarn to v4.1.1 (#1052) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> chore(deps): update eslint packages to v7.1.1 (#1051) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> fix: remove duplicate none doc flavor (#1055) chore(main): release 2.9.0 (#1043) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> fix(deps): update dependency @graasp/ui to v4.8.5 (#1046) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> chore(main): release 2.9.1 (#1062) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> fix: revert previous published item layout (#1058) * fix: revert previous published item layout * refactor: fix publish button chore(main): release 2.9.2 (#1063) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> fix: fix mobile platform switch colors (#1064) chore(main): release 2.9.3 (#1065) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> fix: invert colors for mobile platform switch (#1066) chore(main): release 2.9.4 (#1069) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> feat(dropzone): hide dropzone when use has no permission fix(dropzone): home screen styling test(dropzone): add dropzone tests
- Loading branch information
Showing
12 changed files
with
171 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { buildItemPath } from '@/config/paths'; | ||
import { DROPZONE_HELPER_ID } from '@/config/selectors'; | ||
|
||
import { SAMPLE_ITEMS, SAMPLE_PUBLIC_ITEMS } from '../../../fixtures/items'; | ||
|
||
describe('home screen - dropzone helper visibility', () => { | ||
beforeEach(() => { | ||
cy.setUpApi(); | ||
}); | ||
|
||
it('should display dropzone helper on the home screen when no items', () => { | ||
cy.visit('/'); | ||
cy.get(`#${DROPZONE_HELPER_ID}`).should('be.visible'); | ||
}); | ||
}); | ||
|
||
describe('empty folder - dropzone helper visibility', () => { | ||
it('user logs in - show dropzone helper when no items', () => { | ||
cy.setUpApi(SAMPLE_ITEMS); | ||
cy.visit(buildItemPath(SAMPLE_ITEMS.items[1].id)); | ||
cy.get(`#${DROPZONE_HELPER_ID}`).should('be.visible'); | ||
}); | ||
|
||
it('user logs out - hide dropzone helper', () => { | ||
cy.setUpApi({ ...SAMPLE_PUBLIC_ITEMS, currentMember: null }); | ||
cy.visit(buildItemPath(SAMPLE_PUBLIC_ITEMS.items[2].id)); | ||
cy.get(`#${DROPZONE_HELPER_ID}`).should('not.exist'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import { useContext, useRef } from 'react'; | ||
|
||
import FolderOutlinedIcon from '@mui/icons-material/FolderOutlined'; | ||
import UploadFileOutlinedIcon from '@mui/icons-material/UploadFileOutlined'; | ||
import { Button, Stack, Typography } from '@mui/material'; | ||
|
||
import { useBuilderTranslation } from '@/config/i18n'; | ||
import { DROPZONE_HELPER_ID } from '@/config/selectors'; | ||
import { BUILDER } from '@/langs/constants'; | ||
|
||
import { UppyContext } from './UppyContext'; | ||
|
||
const DropzoneHelper = (): JSX.Element => { | ||
const { t } = useBuilderTranslation(); | ||
const { uppy } = useContext(UppyContext); | ||
const ref = useRef<HTMLInputElement>(null); | ||
|
||
const handleClick = () => { | ||
const { current } = ref; | ||
if (current) { | ||
current.click(); | ||
} | ||
}; | ||
|
||
const handleFiles = () => { | ||
const { current } = ref; | ||
if (current) { | ||
const { files } = current; | ||
if (files) { | ||
// add files selected to uppy, this will upload them | ||
[...files].map((file) => | ||
// add name to display file name in the ItemsTable | ||
uppy?.addFile({ data: file, name: file.name }), | ||
); | ||
} else { | ||
console.error('no files found !'); | ||
} | ||
} | ||
}; | ||
|
||
return ( | ||
<Stack | ||
justifyContent="flex-start" | ||
alignItems="center" | ||
direction="column" | ||
flexGrow={1} | ||
spacing={3} | ||
sx={{ height: '100%', position: 'relative', top: '15%' }} | ||
id={DROPZONE_HELPER_ID} | ||
> | ||
<UploadFileOutlinedIcon color="primary" sx={{ fontSize: '50px' }} /> | ||
<Typography align="center" variant="h4" color="text.secondary"> | ||
{t(BUILDER.DROPZONE_HELPER_TEXT)} | ||
</Typography> | ||
<Typography variant="h5" color="text.secondary"> | ||
{t(BUILDER.DROPZONE_HELPER_OPTIONAL_ACTION_TEXT)} | ||
</Typography> | ||
<Button | ||
variant="contained" | ||
size="large" | ||
onClick={handleClick} | ||
startIcon={<FolderOutlinedIcon />} | ||
> | ||
{t(BUILDER.DROPZONE_HELPER_ACTION)} | ||
</Button> | ||
<input | ||
style={{ display: 'none' }} | ||
type="file" | ||
multiple | ||
ref={ref} | ||
onChange={handleFiles} | ||
/> | ||
<Typography variant="body1" sx={{ color: '#757575' }}> | ||
{t(BUILDER.DROPZONE_HELPER_LIMIT_REMINDER_TEXT)} | ||
</Typography> | ||
</Stack> | ||
); | ||
}; | ||
|
||
export default DropzoneHelper; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters