-
Notifications
You must be signed in to change notification settings - Fork 12
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
fix: Node imports paths #1141
base: main
Are you sure you want to change the base?
fix: Node imports paths #1141
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,10 +3,10 @@ | |
* SPDX-License-Identifier: AGPL-3.0-or-later | ||
*/ | ||
|
||
import { Node } from './files/node.ts' | ||
import { Folder } from './files/folder.ts' | ||
import { View } from './navigation/view.ts' | ||
import logger from './utils/logger.ts' | ||
import type { Node } from './files/node' | ||
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. Why removing the extensions? 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. Consistency |
||
import type { Folder } from './files/folder' | ||
import type { View } from './navigation/view' | ||
import logger from './utils/logger' | ||
|
||
interface ActionContext { | ||
folder: Folder, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
|
||
import { emit } from '@nextcloud/event-bus' | ||
import { TypedEventTarget } from 'typescript-event-target' | ||
import { INode } from './files/node' | ||
import { Node } from './files/node' | ||
|
||
/** | ||
* Active filters can provide one or more "chips" to show the currently active state. | ||
|
@@ -73,7 +73,7 @@ export interface IFileListFilter extends TypedEventTarget<IFileListFilterEvents> | |
* @param nodes Nodes to filter | ||
* @return Subset of the `nodes` parameter to show | ||
*/ | ||
filter(nodes: INode[]): INode[] | ||
filter(nodes: Node[]): Node[] | ||
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. This is a breaking change and I do not see how it would help. 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. Shall we use INode everywhere then? I find the multiple types confusing. |
||
|
||
/** | ||
* If the filter needs a visual element for settings it can provide a function to mount it. | ||
|
@@ -103,7 +103,7 @@ export class FileListFilter extends TypedEventTarget<IFileListFilterEvents> impl | |
this.order = order | ||
} | ||
|
||
public filter(nodes: INode[]): INode[] { | ||
public filter(nodes: Node[]): Node[] { | ||
throw new Error('Not implemented') | ||
return nodes | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors | ||
* SPDX-License-Identifier: AGPL-3.0-or-later | ||
*/ | ||
import type { INode } from '../files/node' | ||
import type { Node } from '../files/node' | ||
import type { SortingOrder } from './sorting' | ||
import { orderBy } from './sorting' | ||
|
||
|
@@ -42,7 +42,7 @@ export interface FilesSortingOptions { | |
* @param nodes Nodes to sort | ||
* @param options Sorting options | ||
*/ | ||
export function sortNodes(nodes: readonly INode[], options: FilesSortingOptions = {}): INode[] { | ||
export function sortNodes(nodes: readonly Node[], options: FilesSortingOptions = {}): Node[] { | ||
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. Same here, breaking and not needed. |
||
const sortingOptions = { | ||
// Default to sort by name | ||
sortingMode: FilesSortingMode.Name, | ||
|
@@ -59,15 +59,15 @@ export function sortNodes(nodes: readonly INode[], options: FilesSortingOptions | |
|
||
const identifiers = [ | ||
// 1: Sort favorites first if enabled | ||
...(sortingOptions.sortFavoritesFirst ? [(v: INode) => v.attributes?.favorite !== 1] : []), | ||
...(sortingOptions.sortFavoritesFirst ? [(v: Node) => v.attributes?.favorite !== 1] : []), | ||
// 2: Sort folders first if sorting by name | ||
...(sortingOptions.sortFoldersFirst ? [(v: INode) => v.type !== 'folder'] : []), | ||
...(sortingOptions.sortFoldersFirst ? [(v: Node) => v.type !== 'folder'] : []), | ||
// 3: Use sorting mode if NOT basename (to be able to use display name too) | ||
...(sortingOptions.sortingMode !== FilesSortingMode.Name ? [(v: INode) => v[sortingOptions.sortingMode]] : []), | ||
...(sortingOptions.sortingMode !== FilesSortingMode.Name ? [(v: Node) => v[sortingOptions.sortingMode]] : []), | ||
// 4: Use display name if available, fallback to name | ||
(v: INode) => basename(v.displayname || v.attributes?.displayname || v.basename), | ||
(v: Node) => basename(v.displayname || v.attributes?.displayname || v.basename), | ||
// 5: Finally, use basename if all previous sorting methods failed | ||
(v: INode) => v.basename, | ||
(v: Node) => v.basename, | ||
] | ||
const orders = [ | ||
// (for 1): always sort favorites before normal files | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
import type { IFileListFilter, Navigation } from './lib' | ||
import type { DavProperty } from './lib/dav/davProperties' | ||
import type { FileAction } from './lib/fileAction' | ||
import type { FileListAction } from './lib/fileListAction.ts' | ||
import type { FileListAction } from './lib/fileListAction' | ||
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. Extension? |
||
import type { Header } from './lib/fileListHeaders' | ||
import type { NewFileMenu } from './lib/newFileMenu' | ||
|
||
|
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.
Why sorting down?
@...
should be before c...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.
I sort the lines, not the libraries, have been doing this everywhere here for... Years 😂
Funny you're only noticing this now 🤭