Skip to content

Commit

Permalink
Changed upload filesize and small UI fix
Browse files Browse the repository at this point in the history
  • Loading branch information
luloxi committed Sep 23, 2024
1 parent 8d0bf9b commit f2000e4
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/nextjs/app/api/ipfs/upload-image/route.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { NextRequest, NextResponse } from "next/server";
import { ipfsClient } from "~~/utils/simpleNFT/ipfs";

const MAX_FILE_SIZE = 2 * 1024 * 1024; // 2 MB in bytes (2 * 1024 * 1024 = 2,097,152 bytes)
const MAX_FILE_SIZE = 5 * 1024 * 1024; // 5 MB in bytes (2 * 1024 * 1024 = 2,097,152 bytes)

export async function POST(request: NextRequest) {
try {
Expand Down
4 changes: 2 additions & 2 deletions packages/nextjs/app/create/_components/ImageUploader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ export const ImageUploader: React.FC<ImageUploaderProps> = ({ image, setUploaded
const [loading, setLoading] = useState(false);
const [hovered, setHovered] = useState(false);

// File size validation (2MB)
const MAX_FILE_SIZE_MB = 2 * 1024 * 1024; // 2 MB in bytes
// File size validation (5MB)
const MAX_FILE_SIZE_MB = 5 * 1024 * 1024; // 5 MB in bytes

// Handle file drop or selection
const handleFileUpload = async (file: File) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ export const ProfilePictureUpload: React.FC<ProfilePictureUploadProps> = ({
const [loading, setLoading] = useState(false);
const [hovered, setHovered] = useState(false);

// File size validation (2MB)
const MAX_FILE_SIZE_MB = 2 * 1024 * 1024; // 2 MB in bytes
// File size validation (5MB)
const MAX_FILE_SIZE_MB = 5 * 1024 * 1024; // 5 MB in bytes

const defaultProfilePicture = "https://ipfs.io/ipfs/QmVCvzEQHFKzAYSsou8jEJtWdFj31n2XgPpbLjbZqui4YY";

// Handle file drop or selection
const handleFileUpload = async (file: File) => {
Expand Down Expand Up @@ -127,7 +129,7 @@ export const ProfilePictureUpload: React.FC<ProfilePictureUploadProps> = ({
</div>
) : (
<Image
src={profilePicture}
src={defaultProfilePicture}
alt="Profile Picture Preview"
className="rounded-full object-cover"
width={128}
Expand Down
1 change: 1 addition & 0 deletions packages/nextjs/scaffold.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export type ScaffoldConfig = {
const scaffoldConfig = {
// The networks on which your DApp is live
targetNetworks: [chains.sepolia, chains.foundry],
// targetNetworks: [chains.foundry],

// The interval at which your front-end polls the RPC servers for new data
// it has no effect if you only target the local network (default is 4000)
Expand Down

0 comments on commit f2000e4

Please sign in to comment.