Compare commits

..

No commits in common. "6252979d28417ad0c134787af65dafaf3d95eeb9" and "20d8905a673d7b667616e56288a1cc0975172390" have entirely different histories.

3 changed files with 19 additions and 14 deletions

View File

@ -3,7 +3,9 @@ import {S5Client} from "@lumeweb/s5-js";
import {PROTOCOL_S5} from "@lumeweb/portal-sdk"; import {PROTOCOL_S5} from "@lumeweb/portal-sdk";
import {Multihash} from "@lumeweb/libs5/lib/multihash.js"; import {Multihash} from "@lumeweb/libs5/lib/multihash.js";
import {AxiosProgressEvent} from "axios"; import {AxiosProgressEvent} from "axios";
import {CID, CID_TYPES, METADATA_TYPES, metadataMagicByte, Unpacker} from "@lumeweb/libs5"; import {CancelablePromise} from "@lumeweb/s5-js/lib/axios.js";
import {MetadataResult} from "@lumeweb/s5-js/lib/options/download.js";
import {metadataMagicByte, Unpacker, CID, METADATA_TYPES, CID_TYPES} from "@lumeweb/libs5";
async function getIsManifest(s5: S5Client, hash: string): Promise<boolean | number> { async function getIsManifest(s5: S5Client, hash: string): Promise<boolean | number> {
@ -61,7 +63,6 @@ export interface FileItem {
cid: string; cid: string;
type: string; type: string;
mimeType: string; mimeType: string;
pinned: string;
} }
export const fileProvider: SdkProvider = { export const fileProvider: SdkProvider = {
@ -80,14 +81,12 @@ export const fileProvider: SdkProvider = {
cid: new CID(manifest, mHash, pin.size).toString(), cid: new CID(manifest, mHash, pin.size).toString(),
type: "manifest", type: "manifest",
mimeType: "application/octet-stream", mimeType: "application/octet-stream",
pinned: pin.pinned_at,
}); });
} else { } else {
items.push({ items.push({
cid: new CID(CID_TYPES.RAW, Multihash.fromBase64Url(pin.hash), pin.size).toString(), cid: new CID(CID_TYPES.RAW, Multihash.fromBase64Url(pin.hash), pin.size).toString(),
type: "raw", type: "raw",
mimeType: pin.mime_type, mimeType: pin.mime_type,
pinned: pin.pinned_at,
}); });
} }
} }

View File

@ -4,8 +4,15 @@ import { FileIcon, MoreIcon } from "~/components/icons";
import { Checkbox } from "~/components/ui/checkbox"; import { Checkbox } from "~/components/ui/checkbox";
import { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from "~/components/ui/dropdown-menu"; import { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from "~/components/ui/dropdown-menu";
import { cn } from "~/utils"; import { cn } from "~/utils";
import {FileItem} from "~/data/file-provider.js";
import {format} from "date-fns/fp"; // This type is used to define the shape of our data.
// You can use a Zod schema here if you want.
export type File = {
name: string;
cid: string;
size: string;
createdOn: string;
};
declare module '@tanstack/table-core' { declare module '@tanstack/table-core' {
interface TableMeta<TData extends RowData> { interface TableMeta<TData extends RowData> {
@ -13,7 +20,7 @@ declare module '@tanstack/table-core' {
} }
} }
export const columns: ColumnDef<FileItem>[] = [ export const columns: ColumnDef<File>[] = [
{ {
id: "select", id: "select",
size: 20, size: 20,
@ -57,12 +64,12 @@ export const columns: ColumnDef<FileItem>[] = [
header: "Size", header: "Size",
}, },
{ {
accessorKey: "pinnedOn", accessorKey: "createdOn",
size: 200, size: 200,
header: "Pinned On", header: "Created On",
cell: ({ row }) => ( cell: ({ row }) => (
<div className="flex items-center justify-between"> <div className="flex items-center justify-between">
{format(row.getValue("pinned")) as unknown as string} {row.getValue("createdOn")}
<DropdownMenu> <DropdownMenu>
<DropdownMenuTrigger className={ <DropdownMenuTrigger className={
cn("hidden group-hover:block data-[state=open]:block", row.getIsSelected() && "block") cn("hidden group-hover:block data-[state=open]:block", row.getIsSelected() && "block")

View File

@ -16,7 +16,7 @@
"@conform-to/react": "^1.0.2", "@conform-to/react": "^1.0.2",
"@conform-to/zod": "^1.0.2", "@conform-to/zod": "^1.0.2",
"@fontsource-variable/manrope": "^5.0.19", "@fontsource-variable/manrope": "^5.0.19",
"@lumeweb/portal-sdk": "0.0.0-20240321203634", "@lumeweb/portal-sdk": "0.0.0-20240321203143",
"@radix-ui/react-avatar": "^1.0.4", "@radix-ui/react-avatar": "^1.0.4",
"@radix-ui/react-checkbox": "^1.0.4", "@radix-ui/react-checkbox": "^1.0.4",
"@radix-ui/react-dialog": "^1.0.5", "@radix-ui/react-dialog": "^1.0.5",
@ -42,7 +42,6 @@
"@visx/visx": "^3.10.2", "@visx/visx": "^3.10.2",
"class-variance-authority": "^0.7.0", "class-variance-authority": "^0.7.0",
"clsx": "^2.1.0", "clsx": "^2.1.0",
"date-fns": "^3.6.0",
"react": "^18.2.0", "react": "^18.2.0",
"react-dom": "^18.2.0", "react-dom": "^18.2.0",
"tailwind-merge": "^2.2.1", "tailwind-merge": "^2.2.1",