feat: remove attached files button from files view (#1193)

This commit is contained in:
Aman Harwara
2022-07-02 17:21:51 +05:30
committed by GitHub
parent f437ed6ce4
commit f3a6aaaf2e
6 changed files with 237 additions and 184 deletions

View File

@@ -6,6 +6,7 @@ import NoteView from '@/Components/NoteView/NoteView'
import MultipleSelectedFiles from '../MultipleSelectedFiles/MultipleSelectedFiles'
import { ElementIds } from '@/Constants/ElementIDs'
import FileView from '@/Components/FileView/FileView'
import { FileDnDContext } from '@/Components/FileDragNDropProvider/FileDragNDropProvider'
type State = {
showMultipleSelectedNotes: boolean
@@ -19,6 +20,9 @@ type Props = {
}
class NoteGroupView extends PureComponent<Props, State> {
static override contextType = FileDnDContext
declare context: React.ContextType<typeof FileDnDContext>
private removeChangeObserver!: () => void
constructor(props: Props) {
@@ -77,6 +81,8 @@ class NoteGroupView extends PureComponent<Props, State> {
}
override render() {
const fileDragNDropContext = this.context
const shouldNotShowMultipleSelectedItems =
!this.state.showMultipleSelectedNotes && !this.state.showMultipleSelectedFiles
@@ -98,16 +104,17 @@ class NoteGroupView extends PureComponent<Props, State> {
{this.state.showMultipleSelectedFiles && (
<MultipleSelectedFiles
application={this.application}
filesController={this.viewControllerManager.filesController}
selectionController={this.viewControllerManager.selectionController}
featuresController={this.viewControllerManager.featuresController}
filePreviewModalController={this.viewControllerManager.filePreviewModalController}
navigationController={this.viewControllerManager.navigationController}
notesController={this.viewControllerManager.notesController}
/>
)}
{this.viewControllerManager.navigationController.isInFilesView && fileDragNDropContext?.isDraggingFiles && (
<div className="absolute bottom-8 left-1/2 z-dropdown-menu -translate-x-1/2 rounded bg-info px-5 py-3 text-info-contrast shadow-main">
Drop your files to upload them to Standard Notes
</div>
)}
{shouldNotShowMultipleSelectedItems && this.state.controllers.length > 0 && (
<>
{this.state.controllers.map((controller) => {