Style tuning

This commit is contained in:
Leo Vasanko
2023-11-04 20:54:14 +00:00
parent 41fbd3d122
commit 047facaacb
114 changed files with 246 additions and 179 deletions

View File

@@ -4,7 +4,7 @@ import type {
FileEntry,
FUID,
DirList,
SelectedItems,
SelectedItems
} from '@/repositories/Document'
import { formatSize, formatUnixDate } from '@/utils'
import { defineStore } from 'pinia'
@@ -74,7 +74,14 @@ export const useDocumentStore = defineStore({
}
// Pre sort directory entries folders first then files, names in natural ordering
dataMapped.sort((a, b) =>
a.type === b.type ? a.name.localeCompare(b.name, undefined, {numeric: true, sensitivity: 'base'}) : a.type === 'folder' ? -1 : 1
a.type === b.type
? a.name.localeCompare(b.name, undefined, {
numeric: true,
sensitivity: 'base'
})
: a.type === 'folder'
? -1
: 1
)
this.document = dataMapped
},
@@ -183,7 +190,7 @@ export const useDocumentStore = defineStore({
ret.fullpath[attr.id] = fullname
ret.relpath[attr.id] = r
ret.ids.push(attr.id)
if (!("dir" in attr)) ret.url[attr.id] = `/files/${fullname}`
if (!('dir' in attr)) ret.url[attr.id] = `/files/${fullname}`
}
traverseDir(attr, fullname, r)
}
@@ -205,7 +212,12 @@ export const useDocumentStore = defineStore({
if (!ret.selected.has(id)) ret.missing.add(id)
}
// Sorted array of FUIDs for easy traversal
ret.ids.sort((a, b) => ret.relpath[a].localeCompare(ret.relpath[b] , undefined, {numeric: true, sensitivity: 'base'}))
ret.ids.sort((a, b) =>
ret.relpath[a].localeCompare(ret.relpath[b], undefined, {
numeric: true,
sensitivity: 'base'
})
)
return ret
}
}