-
Notifications
You must be signed in to change notification settings - Fork 2.4k
🔨 Refactored, 🧠 Overmind, Hacktober | Refactor StorageManagementModal to use overmind #2753
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
| @@ -0,0 +1,56 @@ | ||||
| import React from 'react'; | ||||
| import filesize from 'filesize'; | ||||
| import { useOvermind } from 'app/overmind'; | ||||
| import { | ||||
| Container, | ||||
| Title, | ||||
| JustifiedArea, | ||||
| SubTitle, | ||||
| Description, | ||||
| SubDescription, | ||||
| Rule, | ||||
| LoadingAnimationContainer, | ||||
| } from './elements'; | ||||
| import FilesList from './FilesList'; | ||||
|
|
||||
| const StorageManagementModal = () => { | ||||
| const { | ||||
| state: { uploadedFiles, usedStorage, maxStorage }, | ||||
| actions: { | ||||
| files: { deletedUploadedFile, addedFileToSandbox }, | ||||
| }, | ||||
| } = useOvermind(); | ||||
|
|
||||
| const isLoading = uploadedFiles === null; | ||||
| const isEmpty = !isLoading && uploadedFiles.length === 0; | ||||
|
|
||||
| return ( | ||||
| <Container> | ||||
| <JustifiedArea> | ||||
| <Title>Storage Management</Title> | ||||
| <SubTitle> | ||||
| Used {filesize(usedStorage)} | ||||
| {' / '} | ||||
| Total {filesize(maxStorage)} | ||||
| </SubTitle> | ||||
| </JustifiedArea> | ||||
| <Description> | ||||
| This is where you can manage your uploaded files. | ||||
| </Description> | ||||
| <Rule /> | ||||
| {!isEmpty && !isLoading && ( | ||||
| <FilesList | ||||
| files={uploadedFiles} | ||||
| deleteFile={deletedUploadedFile} | ||||
| deleteFiles={files => files.map(id => deletedUploadedFile({ id }))} | ||||
| addFilesToSandbox={files => files.map(addedFileToSandbox)} | ||||
| addFileToSandbox={addedFileToSandbox} | ||||
| /> | ||||
| )} | ||||
| {isEmpty && <SubDescription>You have no uploaded files.</SubDescription>} | ||||
| {isLoading && <LoadingAnimationContainer />} | ||||
| </Container> | ||||
| ); | ||||
| }; | ||||
|
|
||||
| export default StorageManagementModal; | ||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
And we can remove this one. Last thing I'd need you to do for me is to search the project for imports of |
||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'd like to move everything to named exports instead, so let's change this line.