Skip to content
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

Copyrightform debug #428

Merged
merged 26 commits into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
d9bbcec
v1 UI for custom copyright
ryangtanaka-org Jul 10, 2024
2416506
Merge branch 'main' of https://github.com/ryangtanaka-org/teia-ui int…
ryangtanaka-org Jul 10, 2024
c5f7644
[WIP] Custom License Object Data
ryangtanaka-org Jul 11, 2024
b8be332
working(ish) copyright
ryangtanaka-org Jul 12, 2024
9443d37
push license to ipfs
Zir0h Jul 13, 2024
11aa034
Custom URI input and clauses updates
ryangtanaka-org Jul 13, 2024
f150c69
Copyright Tab on objkt page
ryangtanaka-org Jul 14, 2024
f1a7bf0
fixed metadata link, modified clauses for collabs
ryangtanaka-org Jul 14, 2024
b9a7a8c
rightUri => rightsUri
Zir0h Jul 17, 2024
a83005f
translate ipfs:// link to ipfs gateway url
Zir0h Jul 18, 2024
a6f222a
copyright form v2 plus UI fixes
ryangtanaka-org Jul 18, 2024
e0133d1
addendum display fix (yes/no)
ryangtanaka-org Jul 20, 2024
ce1efc7
Leave addendum (not an actual data point) blank in asset page
ryangtanaka-org Jul 20, 2024
da54008
require attribution clause and right_uri fix
ryangtanaka-org Sep 2, 2024
7b4300b
fallback fix
ryangtanaka-org Sep 2, 2024
8eb50ce
code cleanup
ryangtanaka-org Sep 2, 2024
cef8c2a
typo 🙄
ryangtanaka-org Sep 2, 2024
97417ce
copyrightform v2 (attribution, transfer of rights)
ryangtanaka-org Sep 8, 2024
04dd50d
expiration dates
ryangtanaka-org Jul 18, 2024
744c28b
Merge branch 'main' into copyrightform_v3
ryangtanaka-org Sep 9, 2024
782d6bc
copyright form v3 (added title/fa2 to documentText, fixed TS errors)
ryangtanaka-org Sep 16, 2024
7adb68d
typo fix and copyright tab empty fallbacks
ryangtanaka-org Sep 19, 2024
d46fbcd
typescript fix for swapping
ryangtanaka-org Sep 27, 2024
35e1fea
Merge branch 'main' of https://github.com/ryangtanaka-org/teia-ui int…
ryangtanaka-org Oct 14, 2024
c89ed51
[WIP] transferable rights Debug
ryangtanaka-org Oct 14, 2024
9aa0152
date input fix
ryangtanaka-org Oct 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 53 additions & 43 deletions src/components/form/CustomCopyrightForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,14 @@
<div>
<strong>Copyright Permissions Granted on Ownership:</strong>
<ul>
{clauses.customUriEnabled ? (
{clauses?.customUriEnabled ? (
<>
<li>Custom URI Enabled: {descriptions?.customUriEnabled[true]}</li>
<li>Custom URI: {clauses?.customUri || 'No URI Set'}</li>
<li key="customUriEnabled">
Custom URI Enabled: {descriptions?.customUriEnabled[true]}
</li>
<li key="customUri">
Custom URI: {clauses?.customUri || 'No URI Set'}
</li>
</>
) : (
Object.entries(clauses).map(([key, value]) => {
Expand Down Expand Up @@ -190,6 +194,7 @@
)}" under the Minting Contract managed by the TEIA DAO LLC [${HEN_CONTRACT_FA2}]. This Agreement outlines the rights and obligations associated with the ownership and use of the NFT's likeness and any derivatives thereof ("Work").
\n“Editions” refers to the total number of authorized copies of the NFT that the Creator issues at the time of minting. Each copy represents an "Edition" of the NFT, allowing multiple Owners (or one Owner holding multiple copies) to hold rights to the Work under the terms of this Agreement.`

documentText += `\n\nIn all cases, the written text in this document will take precedence over any data or metadata displays on or off-chain as the authoritative permissions for the Work, applied to both the Creator(s) and Owner(s). Statements in the Addendums have the ability to overrule or nullify statements in the auto-generated portions of this document in cases of conflicts or inconsistencies.`
documentText += `\n\nIn cases where multiple Creators or Collaborators have contributed to the creation of the Work, the rights and obligations stipulated herein apply equally to all Creators. Each Creator is entitled to the rights granted under this Agreement, and such rights are shared collectively among all Creators unless specified otherwise.`

if (clauses.releasePublicDomain) {
Expand Down Expand Up @@ -217,10 +222,22 @@
documentText += `\n\n${clauseNumber++}. Requirement for Attribution:
The Owner(s) of the Work are required to give proper and visible attribution to the Creator(s) whenever the Work is used in public settings, broadcasts, or any other form of public display or performance.acknowledge the Creator(s) by name or wallet address, unless otherwise agreed upon in writing by all parties involved. Failure to provide such attribution constitutes a breach of this Agreement, subject to the remedies available under applicable law.`
}
if (clauses.rightsAreTransferable) {
if (
clauses.rightsAreTransferable &&
(clauses.reproduce ||
clauses.broadcast ||
clauses.publicDisplay ||
clauses.createDerivativeWorks)
) {
documentText += `\n\n${clauseNumber++}. Transferable Rights:
The rights granted under this Agreement to the Owner(s) of the Work are transferable. The Owner(s) may assign, transfer, or sublicense the rights to the Work, subject to maintaining proper and visible attribution to the Creator(s) whenever the Work is used in public settings, broadcasts, or any other form of public display or performance. This clause is applicable to all sales and edition numbers (unless stated otherwise), including both primary and secondary sales, promoting continuous and flexible utilization of the Work across different owners. In case of a dispute, ledger records from sales transactions will serve to confirm or deny claims as necessary. Failure to comply with attribution requirements constitutes a breach of this Agreement, subject to the remedies available under applicable law.`
} else if (!clauses.rightsAreTransferable) {
} else if (
!clauses.rightsAreTransferable &&
(clauses.reproduce ||
clauses.broadcast ||
clauses.publicDisplay ||
clauses.createDerivativeWorks)
) {
documentText += `\n\n${clauseNumber++}. Non-Transferable Rights:
The rights granted under this Agreement to the Owner(s) of the Work are non-transferable. Any attempt to transfer, assign, or sublicense the rights without explicit written consent from the Creator(s) is void. The Owner(s) must maintain proper and visible attribution to the Creator(s) whenever the Work is used in public settings, broadcasts, or any other form of public display or performance. This clause is applicable to Primary Sales, as defined as a direct sale from the Creator(s) to the first Owner(s) of an Edition of the Work from any Marketplace Contract. Upon any Secondary Sale, the rights and privileges initially granted are nullified. In case of a dispute, ledger records from sales transactions will serve to confirm or deny claims as necessary.`
}
Expand All @@ -233,8 +250,7 @@
!clauses.broadcast &&
!clauses.createDerivativeWorks &&
!clauses.releasePublicDomain &&
!clauses.requireAttribution &&
!clauses.rightsAreTransferable
!clauses.requireAttribution
) {
documentText += `\n\n${clauseNumber++}. All Rights Reserved:
No rights are granted under this Agreement. All rights for the Work are reserved solely by the Creator.`
Expand Down Expand Up @@ -292,29 +308,34 @@
}

return documentText
}, [address, clauseNumber, clauses, minterName])

Check warning on line 311 in src/components/form/CustomCopyrightForm.jsx

View workflow job for this annotation

GitHub Actions / build (18)

React Hook useCallback has a missing dependency: 'watch'. Either include it or remove the dependency array

// logic for checkboxes
const handleChange = useCallback((value, name) => {
const newValue = Object.prototype.hasOwnProperty.call(value, 'value')
? value?.value
: value
let newValue

if (value === null || value === undefined) {
newValue = ''
} else if (typeof value === 'object' && 'value' in value) {
newValue = value.value
} else {
newValue = value
}
if (name === 'customUriEnabled') {
if (newValue) {
setClauses((prev) => ({
...prev,
reproduce: false,
broadcast: false,
publicDisplay: false,
createDerivativeWorks: false,
exclusiveRights: 'none',
retainCreatorRights: true,
requireAttribution: true,
rightsAreTransferable: true,
expirationDateExists: false,
expirationDate: null,
releasePublicDomain: false,
reproduce: null,
broadcast: null,
publicDisplay: null,
createDerivativeWorks: null,
exclusiveRights: null,
retainCreatorRights: null,
requireAttribution: null,
rightsAreTransferable: null,
expirationDateExists: null,
expirationDate: '',
releasePublicDomain: null,
customUriEnabled: true,
}))
} else {
Expand All @@ -333,10 +354,10 @@
publicDisplay: false,
createDerivativeWorks: false,
exclusiveRights: 'none',
retainCreatorRights: true,
rightsAreTransferable: true,
retainCreatorRights: false,
rightsAreTransferable: false,
expirationDateExists: false,
expirationDate: null,
expirationDate: '',
releasePublicDomain: true,
customUriEnabled: false,
customUri: '',
Expand All @@ -345,7 +366,7 @@
// Normal handling for other checkboxes
setClauses((prev) => ({
...prev,
[name]: newValue || '',
[name]: newValue,
...(name !== 'releasePublicDomain' && prev.releasePublicDomain
? { releasePublicDomain: false }
: null),
Expand Down Expand Up @@ -401,8 +422,7 @@
clauses.publicDisplay ||
clauses.createDerivativeWorks ||
clauses.releasePublicDomain ||
clauses.requireAttribution ||
clauses.rightsAreTransferable
clauses.requireAttribution

if (clauses.customUriEnabled) {
documentText = `Custom URI: ${clauses.customUri}`
Expand Down Expand Up @@ -474,21 +494,13 @@
}
}

const handleDateChange = (eventOrValue, name) => {
let value
if (eventOrValue.target) {
// Standard input change
value = eventOrValue?.target?.value || '' // Fallback to empty string if undefined
} else {
// Custom handling if it's directly passed a value
value = eventOrValue || ''
}

const handleDateChange = (checked) => {
setClauses((prev) => ({
...prev,
[name]: value || '',
expirationDateExists: checked,
}))
}

return (
<div style={{ borderBottom: '1px solid var(--gray-20)' }}>
<h3>
Expand Down Expand Up @@ -599,9 +611,7 @@
name="expirationDateExists"
label="Add an Expiration Date to Clauses"
checked={clauses.expirationDateExists}
onCheck={(checked) =>
handleDateChange(checked, 'expirationDateExists')
}
onCheck={handleDateChange}
className={styles.field}
/>
<span
Expand All @@ -621,8 +631,8 @@
<h4>{clauseLabels.expirationDate}</h4>
<Input
type="date"
value={clauses.expirationDate || ''}
onChange={(e) => handleChange(e?.target?.value, 'expirationDate')}
value={clauses.expirationDate}
onChange={(e) => handleChange(e, 'expirationDate')}
className={styles.field}
/>
</div>
Expand Down
1 change: 1 addition & 0 deletions src/components/form/copyrightmodaltext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const copyrightModalText = {
</ul>
<p>Note that some digital mediums (e.g. software, websites, video games) often fall into several categories, depending on how it's use. If you want a "permissive" contract, choose as many as applicable. If you want more granularity, think about use-cases and scope them as necessary. (e.g. for video games, reproduction rights will allow the developer to sell assets like art and music directly, whereas broadcasting rights will only allow to "use" them in-game.)
<p>If geography, timelines (i.e. expiration dates), or frequency of usage (e.g. each Owner is only allowed to make X copies) is of importance, Creators can add those details in the Addendum sections to scope the Agreement as necessary.</p>
<p>In all cases, the written text in this document will take precident over any data or metadata displays as the authoritative permissions for the Work, applied to both the Creator(s) and Owner(s), with the statements in the Addendums having the ability to overrule or nullify statements in the auto-generated portions of the document itself in cases of conflicts or inconsistencies. (Though it is recommended that you don't create contradictions in the document itself to avoid misunderstandings or misinterpretations.)</p>
`,
reproduce: `
<p>This right allows the Owner of the Work to make direct copies of the work, for both commercial and non-commercial purposes.</p>
Expand Down
Loading