Skip to content

Commit

Permalink
Merge branch 'main' into ipfs
Browse files Browse the repository at this point in the history
  • Loading branch information
PedroRosalba authored Oct 7, 2024
2 parents 63fda03 + c033cf0 commit c342fba
Show file tree
Hide file tree
Showing 29 changed files with 2,748 additions and 312 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<h4 align="center">
<a href="https://docs.mediolano.app/">Documentation (Soon)</a> |
<a href="https://www.mediolano.com.br/">Institutional Website</a> |
<a href="https://mediolano.com.br/">Institutional Website</a> |
<a href="#">Demo (Soon)</a>
</h4>

Expand Down Expand Up @@ -120,8 +120,7 @@ yarn test

#### Configuration of Third-Party Services for Production-Grade Apps

By default, 🏗 Scaffold-Stark provides predefined Open API endpoint for some services such as Blast. This allows you to begin developing and testing your applications more easily, avoiding the need to register for these services.
This is great to complete your **SpeedRunStark**.
By default, Scaffold-Stark provides predefined Open API endpoint for some services such as Blast. This allows you to begin developing and testing your applications more easily, avoiding the need to register for these services.

For production-grade applications, it's recommended to obtain your own API keys (to prevent rate limiting issues). You can configure these at:

Expand Down
109 changes: 109 additions & 0 deletions packages/nextjs/app/account/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
"use client";

import type { NextPage } from "next";
import { useAccount } from "@starknet-react/core";
import { CustomConnectButton } from "~~/components/scaffold-stark/CustomConnectButton";
import Link from 'next/link'
import { useState } from 'react'

const settingsDapp: NextPage = () => {
const { address: connectedAddress, isConnected, isConnecting } = useAccount();

const [account, setAccount] = useState({
fullName: 'Mediolano',
nickname: 'Demo',
country: 'Brazil',
address: '',
description: 'Dapp demonstration',
website: 'https://mediolano.app',
twitter: '',
facebook: '',
instagram: '',
tiktok: '',
walletAddress: 'mediolano.braavos.stark.id',
mobile: '',
email: '[email protected]',
})

const handleChange = (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => {
const { name, value } = e.target
setAccount(prev => ({ ...prev, [name]: value }))
}

const handleSubmit = (e: React.FormEvent) => {
e.preventDefault()
console.log('Account information saved:', account)
// Here you would typically save the account information to a backend or blockchain
}

return (
<>



<div className="flex justify-center flex-col pt-10" >


<div className="flex items-center flex-col flex-grow pt-10">
<h1 className="text-center mb-4">
<span className="block text-4xl font-bold">Account Settings</span>
</h1>
</div>



{!isConnected || isConnecting ? (
<CustomConnectButton />
) : (


<div className="container py-12 max-w-7xl mx-auto">

<div className="max-w-2xl mx-auto bg-base-300 p-6 rounded shadow">

<form onSubmit={handleSubmit} className="space-y-4">
{Object.entries(account).map(([key, value]) => (
<div key={key}>
<label htmlFor={key} className="block mb-1 capitalize">{key.replace(/([A-Z])/g, ' $1').trim()}</label>
{key === 'description' ? (
<textarea
id={key}
name={key}
value={value}
onChange={handleChange}
className="w-full p-2 border rounded"
rows={3}
/>
) : (
<input
type={key === 'email' ? 'email' : key === 'mobile' ? 'tel' : 'text'}
id={key}
name={key}
value={value}
onChange={handleChange}
className="w-full p-2 border rounded"
/>
)}
</div>
))}
<button type="submit" disabled className="bg-blue-500 text-white px-4 py-2 rounded hover:bg-blue-600">
Save
</button>
</form>
</div>


</div>


)}
</div>




</>
);
};

export default settingsDapp;
112 changes: 107 additions & 5 deletions packages/nextjs/app/ipfsDownload/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ import type { NextPage } from "next";
import { notification } from "~~/utils/scaffold-stark/notification";
import { getMetadataFromIPFS } from "~~/utils/simpleNFT/ipfs-fetch";

import { Button } from "~~/components/ui/button"
import { Input } from "~~/components/ui/input"
import { Textarea } from "~~/components/ui/textarea"
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "~~/components/ui/card"
import { Select } from "~~/components/ui/select"

const LazyReactJson = lazy(() => import("react-json-view"));

const IpfsDownload: NextPage = () => {
Expand All @@ -16,6 +22,17 @@ const IpfsDownload: NextPage = () => {
setMounted(true);
}, []);



const [selectedIP, setSelectedIP] = useState('')

const ipOptions = [
{ value: "ip1", label: "Intellectual Property 1" },
{ value: "ip2", label: "Intellectual Property 2" },
{ value: "ip3", label: "Intellectual Property 3" },
]


const handleIpfsDownload = async () => {
setLoading(true);
const notificationId = notification.loading("Getting data from IPFS");
Expand All @@ -36,12 +53,67 @@ const IpfsDownload: NextPage = () => {

return (
<>
<div className="flex items-center flex-col flex-grow pt-10">
<h1 className="text-center mb-4">
<span className="block text-4xl font-bold">Download from IPFS</span>

<div className="flex items-center flex-col flex-grow pt-10">
<h1 className="text-center mb-4">
<span className="block text-4xl font-bold">Licence your IP</span>
</h1>
</div>


<div className="flex items-center flex-col flex-grow pt-10">
<Card className="bg-main border-accent/50 rounded-full" >
<CardHeader>
<CardTitle>IP Licensing Form</CardTitle>
<CardDescription>Create a license for your registered intellectual property.</CardDescription>
</CardHeader>
<CardContent>
<form>
<div className="grid w-full items-center gap-4">
<div className="flex flex-col space-y-1.5">
<Select
options={ipOptions}
value={selectedIP}
onChange={(e) => setSelectedIP(e.target.value)}
/>
</div>
<div className="flex flex-col space-y-1.5">
<Input id="licensee" placeholder="Licensee Name" />
</div>
<div className="flex flex-col space-y-1.5">
<Textarea placeholder="License Terms" />
</div>
<div className="flex flex-col space-y-1.5">
<Input id="duration" placeholder="License Duration" />
</div>
<div className="flex flex-col space-y-1.5">
<Input id="fee" placeholder="License Fee" />
</div>
</div>
</form>
</CardContent>
<CardFooter className="flex justify-between">
<Button variant="outline">Cancel</Button>
<Button>Create License</Button>
</CardFooter>
</Card>


</div>



<div className="flex items-center flex-col flex-grow pt-10">
<Card className="bg-main border-accent/50 rounded-full" >
<CardHeader>
<CardTitle>Create your Digital Property</CardTitle>
<CardDescription>Load your metadata from IPFS and edit your contract information.</CardDescription>
</CardHeader>
<CardContent>
<form>
<div className="grid w-full items-center gap-4">
<div
className={`flex border-2 border-accent/95 bg-base-200 rounded-full text-accent w-96`}
className={`flex border-2 border-accent/50 rounded-full w-100`}
>
<input
className="input input-ghost focus:outline-none focus:bg-transparent focus:text-secondary-content h-[2.2rem] min-h-[2.2rem] px-4 border w-full font-medium placeholder:text-accent/50 text-secondary-content/75"
Expand All @@ -52,7 +124,7 @@ const IpfsDownload: NextPage = () => {
/>
</div>
<button
className={`btn btn-secondary text-white my-6 ${loading ? "loading" : ""}`}
className={`btn btn-primary my-6 ${loading ? "loading" : ""}`}
disabled={loading}
onClick={handleIpfsDownload}
>
Expand All @@ -76,7 +148,37 @@ const IpfsDownload: NextPage = () => {
}}
/>
)}


<div className="flex flex-col space-y-1.5">
<Input id="licensee" placeholder="Asset Name" />
</div>
<div className="flex flex-col space-y-1.5">
<Textarea placeholder="Asset Content" />
</div>
<div className="flex flex-col space-y-1.5">
<Input id="duration" placeholder="Author Name" />
</div>
<div className="flex flex-col space-y-1.5">
<Input id="fee" placeholder="Asset Type" />
</div>


</div> </form>
</CardContent>
<CardFooter className="flex justify-between">
<Button variant="outline">Cancel</Button>
<Button className="btn btn-primary my-6">Create Asset</Button>
</CardFooter>
</Card>


</div>





</>
);
};
Expand Down
Loading

0 comments on commit c342fba

Please sign in to comment.