@@ -219,68 +302,25 @@ export function Files() {
-
- {items.length ? (
- items.map((c) => (
-
-
-
-
-
-
-
-
{c.manifest.filename}
-
-
- {PrettyBytes(c.manifest.datasetSize)} -{" "}
- {Dates.format(c.manifest.uploadedAt).toString()} - ...
- {c.cid.slice(-5)}
-
-
-
-
- window.open(url + c.cid, "_blank")}
- Icon={() => }>
-
- [
- folder,
- files.includes(c.cid),
- ])}
- onFolderToggle={(folder) => onFolderToggle(c.cid, folder)}
- />
-
- onCopy(c.cid)}
- animation="buzz"
- Icon={() => }>
-
- onDetails(c.cid)}
- Icon={() => (
-
- )}>
-
-
-
-
- ))
- ) : (
-
-
-
- )}
+
+ {types.map((type) => (
+ onToggleFilter(type)}>
+ {type}
+
+ ))}
- {/*
*/}
+
+
+
);
}
diff --git a/src/proxy.ts b/src/proxy.ts
index 04a8f54..a82ace6 100644
--- a/src/proxy.ts
+++ b/src/proxy.ts
@@ -22,6 +22,11 @@ class CodexDataMock extends CodexData {
abort,
result: result.then((safe) => {
if (!safe.error) {
+ FilesStorage.set(safe.data, {
+ mimetype: file.type,
+ uploadedAt: new Date().toJSON(),
+ name: file.name,
+ })
return WebStorage.set(safe.data, {
type: file.type,
name: file.name,
diff --git a/src/utils/files.ts b/src/utils/files.ts
index 7ab1ad7..44dd6ec 100644
--- a/src/utils/files.ts
+++ b/src/utils/files.ts
@@ -2,6 +2,10 @@ export const Files = {
isImage(type: string) {
return type.startsWith("image");
},
+ type(mimetype: string) {
+ const [type] = mimetype.split("/")
+ return type
+ }
};
export type CodexFileMetadata = {
diff --git a/src/utils/purchases-storage.ts b/src/utils/purchases-storage.ts
index f3a278a..3aafea1 100644
--- a/src/utils/purchases-storage.ts
+++ b/src/utils/purchases-storage.ts
@@ -1,4 +1,4 @@
-import { createStore, get, set } from "idb-keyval";
+import { createStore, entries, get, set } from "idb-keyval";
const store = createStore("purchases", "purchases");
const storeDates = createStore("purchases", "dates");
@@ -11,6 +11,10 @@ export const PurchaseStorage = {
async set(key: string, cid: string) {
return set(key, cid, store);
},
+
+ async entries() {
+ return entries(store);
+ },
};
export const PurchaseDatesStorage = {
diff --git a/src/utils/web-storage.ts b/src/utils/web-storage.ts
index bcf5751..56927cb 100644
--- a/src/utils/web-storage.ts
+++ b/src/utils/web-storage.ts
@@ -1,4 +1,4 @@
-import { createStore, del, entries, get, keys, set } from "idb-keyval";
+import { createStore, del, entries, get, set } from "idb-keyval";
const folders = createStore("folders", "folders");