Skip to content

Commit

Permalink
Migrate to Lens v3
Browse files Browse the repository at this point in the history
  • Loading branch information
Yoginth committed Dec 10, 2024
1 parent 453ce27 commit 0273860
Show file tree
Hide file tree
Showing 7 changed files with 961 additions and 944 deletions.
2 changes: 1 addition & 1 deletion apps/og/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"apollo-utilities": "^1.3.4",
"graphql": "^16.9.0",
"next": "^15.0.4",
"react": "^19.0.0"
"react": "18.3.1"
},
"devDependencies": {
"@types/node": "^22.10.1",
Expand Down
4 changes: 2 additions & 2 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@
"plyr-react": "^5.3.0",
"prosekit": "^0.11.0",
"rc-slider": "^11.1.7",
"react": "^19.0.0",
"react": "18.3.1",
"react-chartjs-2": "^5.2.0",
"react-device-detect": "^2.2.3",
"react-dom": "^19.0.0",
"react-dom": "18.3.1",
"react-hot-toast": "^2.4.1",
"react-markdown": "^9.0.0",
"react-tracked": "^2.0.1",
Expand Down
16 changes: 9 additions & 7 deletions apps/web/src/helpers/uploadToIPFS.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { IPFSResponse } from "@hey/types/misc";
import type { StorageNodeResponse } from "@hey/types/misc";
import { StorageClient, testnet } from "@lens-protocol/storage-node-client";

const storageClient = StorageClient.create(testnet);
Expand All @@ -11,7 +11,7 @@ const FALLBACK_TYPE = "image/jpeg";
* @param onProgress Callback to be called when the upload progress changes.
* @returns Array of MediaSet objects.
*/
const uploadToIPFS = async (data: File[]): Promise<IPFSResponse[]> => {
const uploadToIPFS = async (data: File[]): Promise<StorageNodeResponse[]> => {
try {
const { files } = await storageClient.uploadFolder(data);
const attachments = files.map(({ uri }, index) => {
Expand All @@ -30,14 +30,16 @@ const uploadToIPFS = async (data: File[]): Promise<IPFSResponse[]> => {
* @param file File to upload to IPFS.
* @returns MediaSet object or null if the upload fails.
*/
export const uploadFileToIPFS = async (file: File): Promise<IPFSResponse> => {
export const uploadFileToIPFS = async (
file: File
): Promise<StorageNodeResponse> => {
try {
const ipfsResponse = await uploadToIPFS([file]);
const metadata = ipfsResponse[0];
const response = await uploadToIPFS([file]);
const { uri, mimeType } = response[0];

return { mimeType: file.type || FALLBACK_TYPE, uri: metadata.uri };
return { mimeType, uri };
} catch {
return { mimeType: file.type || FALLBACK_TYPE, uri: "" };
return { mimeType: "", uri: "" };
}
};

Expand Down
2 changes: 1 addition & 1 deletion packages/image-cropper/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"@hey/ui": "workspace:*",
"normalize-wheel": "^1.0.1",
"rc-slider": "^11.1.7",
"react": "^19.0.0"
"react": "18.3.1"
},
"devDependencies": {
"@hey/config": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/types/misc.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { AccountMention, Maybe, MetadataLicenseType } from "@hey/indexer";
import type { OptmisticTransactionType } from "./enums";

export interface IPFSResponse {
export interface StorageNodeResponse {
mimeType: string;
uri: string;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"@radix-ui/react-tooltip": "^1.1.4",
"clsx": "^2.1.1",
"next": "^15.0.4",
"react": "^19.0.0",
"react": "18.3.1",
"react-hook-form": "^7.54.0",
"tailwind-merge": "^2.5.5",
"zod": "^3.23.8"
Expand Down
Loading

0 comments on commit 0273860

Please sign in to comment.