diff --git a/src/imageadder.tsx b/src/imageadder.tsx
index a85158c..a15d06d 100644
--- a/src/imageadder.tsx
+++ b/src/imageadder.tsx
@@ -61,15 +61,16 @@ export class ImageAdder extends React.Component< ImageAddedProps, ImageAdderStat
}
@bind
- private async onFileLoad( file: File, result: ArrayBuffer ) //we add the binaries to the ipfs node then convert it into a blob we can display, when accessing this from a remote gadget you'll need to create a blob since we havent uploaded this as one
+ private async onFileLoad( file: File, result: ArrayBuffer )
{
let res = await this.ipfsNode.add( new Uint8Array( result ) );
const url = "/ipfs/" + res.cid;
console.log( `Adding ${ file.name } as ${ url }` );
- const blobData: ArrayBuffer[] = [result];
+ const blobData: ArrayBuffer[] = [result];
const imageBlob = new Blob(blobData);
this.props.addImageCallback( URL.createObjectURL(imageBlob) );
+ //this.props.addImageCallback("https://ipfs.io/ipfs/" + res.cid) <- this system is more efficient but slower as it relies on waiting for a return from the ipfs server and that server gets alot of requests
}
@bind
diff --git a/src/main.tsx b/src/main.tsx
index eb95d2e..321378a 100644
--- a/src/main.tsx
+++ b/src/main.tsx
@@ -6,7 +6,7 @@ import * as ReactDOM from 'react-dom';
import { ImageAdder } from './imageadder';
import * as IPFS from 'ipfs';
-class MenuItem extends React.Component< {displayImage, onClick}, {}> //class for items on the menu, basically just a button
+class MenuItem extends React.Component< {displayImage, onClick, deleteSelfCallback}, {}> //class for items on the menu, basically just a button
{
constructor(props)
{
@@ -16,9 +16,12 @@ class MenuItem extends React.Component< {displayImage, onClick}, {}> //class for
public render()
{
return(
+
+
+
);
}
}
@@ -73,12 +76,18 @@ class ImageMenu extends React.Component< {}, ImageMenuState> //class for the who
this.forceUpdate();
}
+ public deleteListItem(item: string)
+ {
+ this.state.imageUrls.splice(this.state.imageUrls.indexOf(item), 1);
+ this.forceUpdate();
+ }
+
public render()
{
if (this.imageToDisplay){ //if theres an image then show that, and also a back button
return(
-
+
@@ -95,7 +104,7 @@ class ImageMenu extends React.Component< {}, ImageMenuState> //class for the who
};
return(