refactor: rename files (#1034)

This commit is contained in:
Aman Harwara
2022-05-20 23:20:05 +05:30
committed by GitHub
parent 95d539587a
commit 1643311d08
92 changed files with 98 additions and 98 deletions

View File

@@ -0,0 +1,72 @@
import { NoteViewController } from '@standardnotes/snjs'
import { PureComponent } from '@/Components/Abstract/PureComponent'
import { WebApplication } from '@/UIModels/Application'
import { MultipleSelectedNotes } from '@/Components/MultipleSelectedNotes/MultipleSelectedNotes'
import { NoteView } from '@/Components/NoteView/NoteView'
import { ElementIds } from '@/ElementIDs'
type State = {
showMultipleSelectedNotes: boolean
controllers: NoteViewController[]
}
type Props = {
application: WebApplication
}
export class NoteGroupView extends PureComponent<Props, State> {
private removeChangeObserver!: () => void
constructor(props: Props) {
super(props, props.application)
this.state = {
showMultipleSelectedNotes: false,
controllers: [],
}
}
override componentDidMount(): void {
super.componentDidMount()
const controllerGroup = this.application.noteControllerGroup
this.removeChangeObserver = this.application.noteControllerGroup.addActiveControllerChangeObserver(() => {
const controllers = controllerGroup.noteControllers
this.setState({
controllers: controllers,
})
})
this.autorun(() => {
if (this.appState && this.appState.notes) {
this.setState({
showMultipleSelectedNotes: this.appState.notes.selectedNotesCount > 1,
})
}
})
}
override deinit() {
this.removeChangeObserver?.()
;(this.removeChangeObserver as unknown) = undefined
super.deinit()
}
override render() {
return (
<div id={ElementIds.EditorColumn} className="h-full app-column app-column-third">
{this.state.showMultipleSelectedNotes && (
<MultipleSelectedNotes application={this.application} appState={this.appState} />
)}
{!this.state.showMultipleSelectedNotes && (
<>
{this.state.controllers.map((controller) => {
return <NoteView key={controller.note.uuid} application={this.application} controller={controller} />
})}
</>
)}
</div>
)
}
}