Skip to content

Commit

Permalink
Merge pull request #9 from elliotsayes/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
elliotsayes authored Apr 25, 2024
2 parents ded44a8 + 5ecfb9c commit 190d936
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 47 deletions.
4 changes: 2 additions & 2 deletions .env
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
VITE_CONFIG_ARSEEDING_URL="https://arseed.web3infra.dev"
VITE_CONFIG_ARSEEDING_DEFAULT_SYMBOL="AR"
VITE_CONFIG_BUNDLR_NODE="node2"
VITE_CONFIG_UPLOADER="bundlr"
VITE_CONFIG_BUNDLER_URL="https://turbo.ardrive.io"
VITE_CONFIG_UPLOADER="turbo"
VITE_CONFIG_RENDERER_ARNS="udl-video-renderer"
VITE_CONFIG_RENDERER_TX_ID="sAmG5LJGY9c7LFz24MXULeC_v73qNwotEUpbis3QSHQ"
2 changes: 1 addition & 1 deletion src/components/GameLoader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ export const GameLoader = () => {
return true;
}}
/>
<Toaster position="top-left" />
<Toaster position="bottom-left" />
</div>
);
};
2 changes: 1 addition & 1 deletion src/components/GatherChat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export const GatherChat = ({
key={post.id}
className={`${toon?.isFollowing ? "bg-blue-100" : ""} ${
isUser ? "bg-gray-200" : ""
}`}
} break-words max-w-sm`}
>
<span
className={`text-muted-foreground text-underline px-1 ${
Expand Down
9 changes: 8 additions & 1 deletion src/components/upload/SubmitSuccessDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import type { ContentType, UploadResult } from "@/lib/upload";
import { Button } from "../ui/button";
import TextView from "./TextView";
import { VideoPreview } from "./VideoPreview";
import { useState } from "react";

interface Props {
contentType: ContentType;
Expand All @@ -20,6 +21,8 @@ interface Props {
export const SubmitSuccessDialog = (props: Props) => {
const { contentType, mainVideoResult, onAccept } = props;

const [isDone, setIsDone] = useState(false);

const renderResult = (
// title: string,
result: UploadResult,
Expand Down Expand Up @@ -88,7 +91,11 @@ export const SubmitSuccessDialog = (props: Props) => {
</DialogDescription> */}
</DialogHeader>
<div className="flex flex-col gap-4">{renderResult(mainVideoResult)}</div>
<Button onClick={() => onAccept()}>Done</Button>
<Button onClick={() => {
onAccept()
setIsDone(true)
}}
disabled={isDone}>Done</Button>
</DialogContent>
);
};
2 changes: 1 addition & 1 deletion src/components/upload/SubmittingDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const SubmittingDialog = (props: Props) => {
<DialogContent className="sm:max-w-[425px]" hasCloseButton={false}>
<DialogHeader>
<DialogTitle>
Uploading with {isArseeding ? "Everpay" : "Bundlr"}
Uploading with {isArseeding ? "Everpay" : "Turbo"}
</DialogTitle>
<DialogDescription>
Please wait while your data is uploading...
Expand Down
2 changes: 1 addition & 1 deletion src/components/upload/UploadPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export const UploadPage = ({ onDone }: UploadPageProps) => {
}`}
disabled={!canSumbit}
>
Upload With Bundlr
Upload With Turbo
</Button>
</TooltipTrigger>
<TooltipContent>
Expand Down
6 changes: 2 additions & 4 deletions src/config.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
export const config = {
arseedingUrl: import.meta.env.VITE_CONFIG_ARSEEDING_URL,
arseedingDefaultSymbol: import.meta.env.VITE_CONFIG_ARSEEDING_DEFAULT_SYMBOL,
bundlrNode: import.meta.env.VITE_CONFIG_BUNDLR_NODE,
uploader: (import.meta.env.VITE_CONFIG_UPLOADER ?? "arseeding") as
| "arseeding"
| "bundlr",
bundlerUrl: import.meta.env.VITE_CONFIG_BUNDLER_URL,
uploader: import.meta.env.VITE_CONFIG_UPLOADER ?? "turbo",
rendererArns: import.meta.env.VITE_CONFIG_RENDERER_ARNS as string,
defaultRendererTxId: import.meta.env.VITE_CONFIG_RENDERER_TX_ID as
| string
Expand Down
4 changes: 2 additions & 2 deletions src/lib/machines/upload_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { ContentType, UploadResult } from "@/lib/upload";
import mime from "mime-types";
import { type EventObject, assign, fromCallback, setup } from "xstate";
import type { z } from "zod";
import { uploadVideosToBundlr } from "../bundlr";
import { uploadVideosToTurbo } from "../turbo";

type Events =
| {
Expand Down Expand Up @@ -144,7 +144,7 @@ export const uploadPageMachine = setup({
: "text"
: "text";

uploadVideosToBundlr(
uploadVideosToTurbo(
contentType,
mainVideo!,
"arweave",
Expand Down
24 changes: 12 additions & 12 deletions src/lib/bundlr.ts → src/lib/turbo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,33 +16,33 @@ import {
export const getUploadFee = async (fileSize: number, token: string) => {
if (fileSize < 10 * 1024) return BigNumber(0);

const bundlr = new WebIrys({
url: config.bundlrNode,
const turbo = new WebIrys({
url: config.bundlerUrl,
token,
});
const fee = await bundlr.getPrice(fileSize);
const fee = await turbo.getPrice(fileSize);
return fee;
};

// Function to connect to bundlr instance
// Function to connect to turbo instance
const connectInstance = async (token: string) => {
const injectedArweave = window.arweaveWallet;
await injectedArweave.connect([
"ACCESS_PUBLIC_KEY",
"SIGNATURE",
"SIGN_TRANSACTION",
]);
const bundlr = new WebIrys({
url: config.bundlrNode,
const turbo = new WebIrys({
url: config.bundlerUrl,
token,
wallet: {
provider: injectedArweave,
},
});
await bundlr.ready();
await turbo.ready();
return {
instance: bundlr,
address: bundlr.address!,
instance: turbo,
address: turbo.address!,
};
};

Expand All @@ -51,7 +51,7 @@ const getBalance = async (instance: WebIrys) => {
return instance.getLoadedBalance();
};

// Function to upload file to bundlr
// Function to upload file to turbo
const uploadFile = async (
instance: WebIrys,
file: File,
Expand All @@ -76,7 +76,7 @@ const uploadFile = async (
};
};

export const uploadVideosToBundlr = async (
export const uploadVideosToTurbo = async (
contentType: ContentType,
mainVideo: File,
token: string,
Expand Down Expand Up @@ -140,7 +140,7 @@ export const uploadVideosToBundlr = async (
const mainVideoResult = await uploadFile(instance, mainVideo, mainVideoTags);

log?.("SKIPPING: Registering atomic asset with Warp...");
// const result = await ensureRegistered(mainVideoResult.id, config.bundlrNode);
// const result = await ensureRegistered(mainVideoResult.id, config.turboNode);
// log?.(`Registered with Warp: ${JSON.stringify(await result.json())}`);

try {
Expand Down
44 changes: 22 additions & 22 deletions src/routeTree.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,46 +8,46 @@

// This file is auto-generated by TanStack Router

import { createFileRoute } from "@tanstack/react-router";
import { createFileRoute } from '@tanstack/react-router'

// Import Routes

import { Route as rootRoute } from "./routes/__root";
import { Route as rootRoute } from './routes/__root'

// Create Virtual Routes

const GameLazyImport = createFileRoute("/game")();
const IndexLazyImport = createFileRoute("/")();
const GameLazyImport = createFileRoute('/game')()
const IndexLazyImport = createFileRoute('/')()

// Create/Update Routes

const GameLazyRoute = GameLazyImport.update({
path: "/game",
getParentRoute: () => rootRoute,
} as any).lazy(() => import("./routes/game.lazy").then((d) => d.Route));
path: '/game',
getParentRoute: () => rootRoute,
} as any).lazy(() => import('./routes/game.lazy').then((d) => d.Route))

const IndexLazyRoute = IndexLazyImport.update({
path: "/",
getParentRoute: () => rootRoute,
} as any).lazy(() => import("./routes/index.lazy").then((d) => d.Route));
path: '/',
getParentRoute: () => rootRoute,
} as any).lazy(() => import('./routes/index.lazy').then((d) => d.Route))

// Populate the FileRoutesByPath interface

declare module "@tanstack/react-router" {
interface FileRoutesByPath {
"/": {
preLoaderRoute: typeof IndexLazyImport;
parentRoute: typeof rootRoute;
};
"/game": {
preLoaderRoute: typeof GameLazyImport;
parentRoute: typeof rootRoute;
};
}
declare module '@tanstack/react-router' {
interface FileRoutesByPath {
'/': {
preLoaderRoute: typeof IndexLazyImport
parentRoute: typeof rootRoute
}
'/game': {
preLoaderRoute: typeof GameLazyImport
parentRoute: typeof rootRoute
}
}
}

// Create and export the route tree

export const routeTree = rootRoute.addChildren([IndexLazyRoute, GameLazyRoute]);
export const routeTree = rootRoute.addChildren([IndexLazyRoute, GameLazyRoute])

/* prettier-ignore-end */

0 comments on commit 190d936

Please sign in to comment.