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

feat: generic items list #1035

Merged
merged 49 commits into from
May 22, 2022
Merged
Changes from 1 commit
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
2008511
feat: make notes list generic to display files
amanharwara May 18, 2022
88940b6
fix: file context menu
amanharwara May 19, 2022
b943bc6
chore: remove unnecessary console log
amanharwara May 19, 2022
85360a1
feat: prepare for snjs#743
amanharwara May 20, 2022
aa39321
Merge branch 'develop' of github.com:standardnotes/web into feat/gene…
moughxyz May 20, 2022
aca8086
fix: display options type compatibility
moughxyz May 20, 2022
582a8ee
fix: make webDisplayOptions observable
moughxyz May 20, 2022
2f85df4
refactor: fix file names
amanharwara May 20, 2022
a476b9f
Merge branch 'feat/generic-items-list' of github.com:standardnotes/we…
amanharwara May 20, 2022
79400f1
fix: file selection issues
amanharwara May 20, 2022
fa1844e
chore: merge develop
moughxyz May 20, 2022
e12af41
Merge branch 'feat/generic-items-list' of github.com:standardnotes/we…
moughxyz May 20, 2022
e68fae2
Merge branch 'develop' of github.com:standardnotes/web into feat/gene…
amanharwara May 20, 2022
bd3b1b6
feat: use single-click to preview file list item
amanharwara May 20, 2022
dd267fb
feat(wip): theming improvements
moughxyz May 13, 2022
102be38
feat: extend color variables available to themes
moughxyz May 21, 2022
f9ab039
feat: use file icon for files smart view
amanharwara May 21, 2022
7e40ed7
fix: file item authorization
amanharwara May 21, 2022
d1070b7
fix: note/file list item hover
amanharwara May 21, 2022
977a23f
Merge branch 'feat/generic-items-list' of github.com:standardnotes/we…
amanharwara May 21, 2022
e2abe2f
Revert "fix: file item authorization"
amanharwara May 21, 2022
6f97720
chore: bump deps
amanharwara May 21, 2022
cbf9156
feat: use useCallback
amanharwara May 21, 2022
812ace6
feat: consolidate item stream
amanharwara May 21, 2022
3967284
refactor: use object-based params
amanharwara May 21, 2022
f3803d1
refactor: move long function invocation above jsx
amanharwara May 21, 2022
4c46f0f
feat: use better css variable
amanharwara May 21, 2022
8c2b41f
feat: use generic protected access authorization
amanharwara May 21, 2022
0956c5f
feat: expose getSelectedItems function in SelectedItemsState
amanharwara May 21, 2022
d22740f
feat: use named return value
amanharwara May 21, 2022
794efd3
refactor: conditional improvements
amanharwara May 21, 2022
fce1f5c
feat: expose firstSelectedNote getter
amanharwara May 21, 2022
760e6b2
feat: remove unnecessary reload calls
amanharwara May 21, 2022
0bc0fde
fix: type errors
amanharwara May 21, 2022
fc76e2b
refactor: better control flow and props
amanharwara May 21, 2022
d3e1a94
refactor: remove unnecessary prop
amanharwara May 21, 2022
5fed838
refactor: get only required properties
amanharwara May 21, 2022
0edb7dc
refactor: move conditional to named const
amanharwara May 21, 2022
fb66083
feat: make getSelectedItems generic
amanharwara May 21, 2022
4a76e84
feat: return didSelect after selecting item
amanharwara May 21, 2022
a2c19ba
feat: support optional files navigation
moughxyz May 22, 2022
e0d4e09
fix: web display options
amanharwara May 22, 2022
6b26000
feat: add new utility class
amanharwara May 22, 2022
a02c5c5
refactor: pass whole item for params
amanharwara May 22, 2022
6bd94f5
refactor: use early returns
amanharwara May 22, 2022
8661188
fix: hidden icon styling
amanharwara May 22, 2022
d92c20b
chore: bump deps
amanharwara May 22, 2022
36719e0
refactor: rename to AbstractListItemProps
amanharwara May 22, 2022
3a77a6e
feat: add file selection const
amanharwara May 22, 2022
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
Prev Previous commit
Next Next commit
feat: support optional files navigation
  • Loading branch information
moughxyz committed May 22, 2022
commit a2c19ba3d063859eca9df5e999cba7f871104641
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ import { WebApplication } from '@/UIModels/Application'
import { Component } from 'preact'
import { ApplicationView } from '@/Components/ApplicationView/ApplicationView'
import { WebOrDesktopDevice } from '@/Device/WebOrDesktopDevice'
import { ApplicationGroupEvent, Runtime, ApplicationGroupEventData, DeinitSource } from '@standardnotes/snjs'
import { ApplicationGroupEvent, ApplicationGroupEventData, DeinitSource } from '@standardnotes/snjs'
import { unmountComponentAtNode, findDOMNode } from 'preact/compat'
import { DialogContent, DialogOverlay } from '@reach/dialog'
import { isDesktopApplication } from '@/Utils'
@@ -39,12 +39,7 @@ export class ApplicationGroupView extends Component<Props, State> {
return
}

this.group = new ApplicationGroup(
props.server,
props.device,
props.enableUnfinished ? Runtime.Dev : Runtime.Prod,
props.websocketUrl,
)
this.group = new ApplicationGroup(props.server, props.device, props.websocketUrl)

window.mainApplicationGroup = this.group

Original file line number Diff line number Diff line change
@@ -243,10 +243,11 @@ export class ContentListViewState extends AbstractState {
}

const selectedItem = Object.values(appState.selectedItems.selectedItems)[0]
const shouldReturnIfSelectedFile =

const isSelectedItemFile =
this.items.includes(selectedItem) && selectedItem && selectedItem.content_type === ContentType.File

if (shouldReturnIfSelectedFile) {
if (isSelectedItemFile) {
return
}

4 changes: 1 addition & 3 deletions app/assets/javascripts/UIModels/Application.ts
Original file line number Diff line number Diff line change
@@ -14,7 +14,6 @@ import {
NoteGroupController,
removeFromArray,
IconsController,
Runtime,
DesktopDeviceInterface,
isDesktopDevice,
DeinitMode,
@@ -49,7 +48,6 @@ export class WebApplication extends SNApplication {
identifier: string,
defaultSyncServerHost: string,
webSocketUrl: string,
runtime: Runtime,
) {
super({
environment: deviceInterface.environment,
@@ -61,7 +59,7 @@ export class WebApplication extends SNApplication {
defaultHost: defaultSyncServerHost,
appVersion: deviceInterface.appVersion,
webSocketUrl: webSocketUrl,
runtime,
supportsFileNavigation: window.enabledUnfinishedFeatures,
})

deviceInterface.setApplication(this)
13 changes: 2 additions & 11 deletions app/assets/javascripts/UIModels/ApplicationGroup.ts
Original file line number Diff line number Diff line change
@@ -3,7 +3,6 @@ import {
ApplicationDescriptor,
SNApplicationGroup,
Platform,
Runtime,
InternalEventBus,
isDesktopDevice,
} from '@standardnotes/snjs'
@@ -21,7 +20,6 @@ const createApplication = (
deviceInterface: WebOrDesktopDevice,
defaultSyncServerHost: string,
device: WebOrDesktopDevice,
runtime: Runtime,
webSocketUrl: string,
) => {
const platform = getPlatform()
@@ -32,7 +30,6 @@ const createApplication = (
descriptor.identifier,
defaultSyncServerHost,
webSocketUrl,
runtime,
)

const appState = new AppState(application, device)
@@ -54,23 +51,17 @@ const createApplication = (
}

export class ApplicationGroup extends SNApplicationGroup<WebOrDesktopDevice> {
constructor(
private defaultSyncServerHost: string,
device: WebOrDesktopDevice,
private runtime: Runtime,
private webSocketUrl: string,
) {
constructor(private defaultSyncServerHost: string, device: WebOrDesktopDevice, private webSocketUrl: string) {
super(device)
}

override async initialize(): Promise<void> {
const defaultSyncServerHost = this.defaultSyncServerHost
const runtime = this.runtime
const webSocketUrl = this.webSocketUrl

await super.initialize({
applicationCreator: async (descriptor, device) => {
return createApplication(descriptor, device, defaultSyncServerHost, device, runtime, webSocketUrl)
return createApplication(descriptor, device, defaultSyncServerHost, device, webSocketUrl)
},
})