+
- {(id) => (
-
- {(item) => (
-
- )}
-
- )}
+ {(id) => {(item) => props.children(item())}}
@@ -435,7 +445,7 @@ const yearFormat = new Intl.DateTimeFormat(undefined, { year: "numeric", month:
const timeFormat = new Intl.DateTimeFormat(undefined, { hour: "numeric", minute: "2-digit" })
-function FileRow(props: { item: FileItem; openPath: (path: string) => void }) {
+function FileRow(props: { item: FileItem; directory: string; openPath: (path: string) => void }) {
const ctx = usePlugin
()
const href = () => {
@@ -444,34 +454,41 @@ function FileRow(props: { item: FileItem; openPath: (path: string) => void }) {
return source?.type === "url" ? source.url : undefined
}
+ // The folder the file sits in, relative to the session's directory when it is inside it.
+ const folder = () => {
+ const path = props.item.path
+
+ if (!path) return undefined
+ const root = props.directory.replace(/\/+$/, "") + "/"
+ const relative = path.startsWith(root) ? path.slice(root.length) : path
+ const split = relative.lastIndexOf("/")
+
+ return split > 0 ? relative.slice(0, split) : undefined
+ }
+
const content = () => (
- <>
-
-
-
-
- {props.item.name}
-
- {ctx.t(`file.${props.item.action}`)}
- {(path) => {path()}}
-
-
-
- >
+
}
+ title={props.item.name}
+ place={folder()}
+ action={ctx.t(`file.${props.item.from}.${props.item.action}`)}
+ time={props.item.time}
+ opens={!!props.item.path || !!href()}
+ />
)
return (
- {content()} }>
+