-
Notifications
You must be signed in to change notification settings - Fork 4
Fix/marketplace #366
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Fix/marketplace #366
Changes from 3 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 9 additions & 47 deletions
56
platforms/marketplace/client/src/components/ObjectUploader.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,29 @@ | ||
import { useState } from "react"; | ||
import type { ReactNode } from "react"; | ||
import Uppy from "@uppy/core"; | ||
import { DashboardModal } from "@uppy/react"; | ||
import "@uppy/core/dist/style.min.css"; | ||
import "@uppy/dashboard/dist/style.min.css"; | ||
import AwsS3 from "@uppy/aws-s3"; | ||
import type { UploadResult } from "@uppy/core"; | ||
import { Button } from "@/components/ui/button"; | ||
|
||
interface ObjectUploaderProps { | ||
maxNumberOfFiles?: number; | ||
maxFileSize?: number; | ||
onGetUploadParameters: () => Promise<{ | ||
onGetUploadParameters?: () => Promise<{ | ||
method: "PUT"; | ||
url: string; | ||
}>; | ||
onComplete?: ( | ||
result: UploadResult<Record<string, unknown>, Record<string, unknown>> | ||
) => void; | ||
onComplete?: (result: any) => void; | ||
buttonClassName?: string; | ||
children: ReactNode; | ||
} | ||
|
||
export function ObjectUploader({ | ||
maxNumberOfFiles = 1, | ||
maxFileSize = 10485760, // 10MB default | ||
onGetUploadParameters, | ||
onComplete, | ||
buttonClassName, | ||
children, | ||
}: ObjectUploaderProps) { | ||
const [showModal, setShowModal] = useState(false); | ||
const [uppy] = useState(() => | ||
new Uppy({ | ||
restrictions: { | ||
maxNumberOfFiles, | ||
maxFileSize, | ||
allowedFileTypes: ['image/*'], | ||
}, | ||
autoProceed: false, | ||
}) | ||
.use(AwsS3, { | ||
shouldUseMultipart: false, | ||
getUploadParameters: onGetUploadParameters, | ||
}) | ||
.on("complete", (result) => { | ||
onComplete?.(result); | ||
setShowModal(false); | ||
}) | ||
); | ||
|
||
return ( | ||
<div> | ||
<Button onClick={() => setShowModal(true)} className={buttonClassName} type="button"> | ||
{children} | ||
</Button> | ||
|
||
<DashboardModal | ||
uppy={uppy} | ||
open={showModal} | ||
onRequestClose={() => setShowModal(false)} | ||
proudlyDisplayPoweredByUppy={false} | ||
/> | ||
</div> | ||
<Button | ||
onClick={() => alert('Upload functionality requires backend database')} | ||
className={buttonClassName} | ||
type="button" | ||
> | ||
{children} | ||
</Button> | ||
); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
[ | ||
{ | ||
"id": "eid-wallet", | ||
"name": "eID for W3DS", | ||
"description": "Secure digital identity wallet for W3DS. Maintain sovereign control over your digital identity.", | ||
"category": "Identity", | ||
"logoUrl": "/eid-w3ds.png", | ||
"appStoreUrl": "https://apps.apple.com/in/app/eid-for-w3ds/id6747748667", | ||
"playStoreUrl": "https://play.google.com/store/apps/details?id=foundation.metastate.eid_wallet" | ||
}, | ||
{ | ||
"id": "blabsy", | ||
"name": "Blabsy", | ||
"description": "Micro blogging first style application for sharing thoughts across the W3DS ecosystem.", | ||
"category": "Social", | ||
"logoUrl": "/blabsy.svg", | ||
"url": "https://blabsy.w3ds.metastate.foundation" | ||
}, | ||
{ | ||
"id": "pictique", | ||
"name": "Pictique", | ||
"description": "Photo sharing first style application for sharing moments across the W3DS ecosystem.", | ||
"category": "Social", | ||
"logoUrl": "/pictique.svg", | ||
"url": "https://pictique.w3ds.metastate.foundation" | ||
}, | ||
{ | ||
"id": "evoting", | ||
"name": "eVoting", | ||
"description": "Secure, transparent, and verifiable electronic voting platform with cryptographic guarantees.", | ||
"category": "Governance", | ||
"logoUrl": "/evoting.png", | ||
"url": "https://evoting.w3ds.metastate.foundation" | ||
}, | ||
{ | ||
"id": "group-charter", | ||
"name": "Charter Manager", | ||
"description": "Define rules, manage memberships, and ensure transparent governance for your communities.", | ||
"category": "Governance", | ||
"logoUrl": "/charter.png", | ||
"url": "https://charter.w3ds.metastate.foundation" | ||
}, | ||
{ | ||
"id": "dreamsync", | ||
"name": "DreamSync", | ||
"description": "Individual discovery platform, find people of interest across the W3DS ecosystem.", | ||
"category": "Wellness", | ||
"logoUrl": null, | ||
"url": "https://dreamsync.w3ds.metastate.foundation" | ||
} | ||
] |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion | 🟠 Major
🧩 Analysis chain
Verify null logoUrl is handled gracefully.
The DreamSync app has
logoUrl: null
. Ensure all components that render app logos handle null values correctly (e.g., showing a fallback icon or placeholder).Run this script to check logo rendering logic:
🏁 Script executed:
Length of output: 58
🏁 Script executed:
Length of output: 7185
Add fallback UI for null
logoUrl
home-page.tsx
(around line 119) andapp-detail.tsx
(around line 73), the{app.logoUrl ? <img …/> : null}
branches render nothing whenlogoUrl
is null. Provide a default icon or placeholder in the “else” branch.🤖 Prompt for AI Agents