Skip to content

Commit

Permalink
default license options
Browse files Browse the repository at this point in the history
  • Loading branch information
NickJ202 committed Jun 27, 2024
1 parent e3d5555 commit 5887430
Show file tree
Hide file tree
Showing 17 changed files with 995 additions and 677 deletions.
16 changes: 8 additions & 8 deletions src/components/molecules/AssetInfoLicense/AssetInfoLicense.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,17 @@ export default function AssetDetailLicenses(props: IProps) {
function getValue(element: string) {
if (!props.asset || !props.asset.license || !props.asset.license[element]) return null;
if (typeof props.asset.license[element] === 'object') {
console.log(props.asset.license[element].value);
return (
<S.LFlex>
<p>{getLicenseText(props.asset.license[element].value)}</p>
{props.asset.license[element].icon && !props.asset.license[element].value.includes('None') && (
<S.LFlexValue>
<ReactSVG src={props.asset.license[element].icon} />
</S.LFlexValue>
)}
{props.asset.license[element].icon &&
!props.asset.license[element].value.includes('None') &&
!props.asset.license[element].value.includes('Disallowed') && (
<S.LFlexValue>
<ReactSVG src={props.asset.license[element].icon} />
</S.LFlexValue>
)}
{props.asset.license[element].endText && (
<S.LFlexValue>
<p>{props.asset.license[element].endText}</p>
Expand Down Expand Up @@ -84,9 +87,6 @@ export default function AssetDetailLicenses(props: IProps) {
) : null;
})}
</S.Body>
{/* <S.Action>
<Button type={'primary'} label={language.payLicense} handlePress={() => {}} disabled={true} noMinWidth />
</S.Action> */}
</S.Wrapper>
) : null;
}
21 changes: 11 additions & 10 deletions src/helpers/language.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,39 +114,39 @@ export const language = {
oneTime: `One Time`,
},
},
derivations: {
label: `Derivations`,
commercialUse: {
label: `Commercial Use`,
options: {
disallowed: `Disallowed`,
allowed: `Allowed`,
suboptions: {
credit: `With Credit`,
indication: `With Indication`,
licensePassthrough: `With License Passthrough`,
revenueShare: `With Revenue Share`,
monthlyFee: `With Monthly Fee`,
oneTimeFee: `With One-Time Fee`,
},
},
},
commercialUse: {
label: `Commercial Use`,
dataModelTraining: {
label: `Data Model Training`,
options: {
disallowed: `Disallowed`,
allowed: `Allowed`,
suboptions: {
revenueShare: `With Revenue Share`,
monthlyFee: `With Monthly Fee`,
oneTimeFee: `With One-Time Fee`,
},
},
},
dataModelTraining: {
label: `Data Model Training`,
derivations: {
label: `Derivations`,
options: {
disallowed: `Disallowed`,
allowed: `Allowed`,
suboptions: {
credit: `With Credit`,
indication: `With Indication`,
licensePassthrough: `With License Passthrough`,
revenueShare: `With Revenue Share`,
monthlyFee: `With Monthly Fee`,
oneTimeFee: `With One-Time Fee`,
},
Expand Down Expand Up @@ -259,6 +259,7 @@ export const language = {
valuePercentage: `Value must be between 1 and 100`,
video: `Video`,
videos: `Videos`,
viewAdvancedOptions: `View advanced options`,
viewAsset: `View Asset`,
viewCollection: `View collection`,
viewFullBio: `View full bio`,
Expand Down
4 changes: 3 additions & 1 deletion src/helpers/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,8 @@ export type UploadPayloadType =
| 'idList'
| 'banner'
| 'thumbnail'
| 'hasLicense';
| 'hasLicense'
| 'activeLicense';

export type UploadPayloadDataType = { field: UploadPayloadType; data: any };

Expand All @@ -218,6 +219,7 @@ export type UploadReduxType = {
topics: string[];
type: string;
hasLicense: boolean;
activeLicense: string;
};
currentStep: UploadStepType;
nextStepDisabled: boolean;
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export function getUniqueAddresses(addresses: string[]) {
export function formatAddress(address: string | null, wrap: boolean) {
if (!address) return '';
if (!checkAddress(address)) return address;
const formattedAddress = address.substring(0, 5) + '...' + address.substring(36, address.length - 1);
const formattedAddress = address.substring(0, 5) + '...' + address.substring(36, address.length);
return wrap ? `(${formattedAddress})` : formattedAddress;
}

Expand Down
10 changes: 10 additions & 0 deletions src/store/upload/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
SET_STEP_DISABLED,
SET_UPLOAD,
SET_UPLOAD_ACTIVE,
SET_UPLOAD_ACTIVE_LICENSE,
SET_UPLOAD_COST,
SET_UPLOAD_DISABLED,
SET_UPLOAD_TYPE,
Expand Down Expand Up @@ -77,6 +78,15 @@ export function setUploadType(payload: UploadType) {
};
}

export function setUploadActiveLicense(payload: string) {
return (dispatch: Dispatch) => {
dispatch({
type: SET_UPLOAD_ACTIVE_LICENSE,
payload: payload,
});
};
}

export function changeUpload() {
return (dispatch: Dispatch) => {
dispatch({
Expand Down
1 change: 1 addition & 0 deletions src/store/upload/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export const SET_UPLOAD_ACTIVE = 'SET_UPLOAD_ACTIVE';
export const SET_STEP_DETAILS = 'SET_STEP_DETAILS';
export const SET_STEP_DISABLED = 'SET_STEP_DISABLED';
export const SET_UPLOAD_COST = 'SET_UPLOAD_COST';
export const SET_UPLOAD_ACTIVE_LICENSE = 'SET_UPLOAD_ACTIVE_LICENSE';
export const SET_UPLOAD_DISABLED = 'SET_UPLOAD_DISABLED';
export const SET_UPLOAD_TYPE = 'SET_UPLOAD_TYPE';
export const CHANGE_UPLOAD = 'CHANGE_UPLOAD';
Expand Down
8 changes: 8 additions & 0 deletions src/store/upload/reducers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
SET_STEP_DISABLED,
SET_UPLOAD,
SET_UPLOAD_ACTIVE,
SET_UPLOAD_ACTIVE_LICENSE,
SET_UPLOAD_COST,
SET_UPLOAD_DISABLED,
SET_UPLOAD_TYPE,
Expand All @@ -30,6 +31,7 @@ const initStateUploadReducer = {
topics: [],
type: '',
hasLicense: true,
activeLicense: '',
},
currentStep: 'details' as UploadStepType,
nextStepDisabled: true,
Expand Down Expand Up @@ -72,6 +74,10 @@ export function uploadReducer(state: UploadReduxType = initStateUploadReducer, a
updatedState = { ...state };
updatedState.uploadType = action.payload;
return updatedState;
case SET_UPLOAD_ACTIVE_LICENSE:
updatedState = { ...state };
updatedState.data.activeLicense = action.payload;
return updatedState;
case CLEAR_UPLOAD:
return {
data: {
Expand All @@ -91,6 +97,7 @@ export function uploadReducer(state: UploadReduxType = initStateUploadReducer, a
topics: [],
type: '',
hasLicense: true,
activeLicense: '',
},
currentStep: 'details' as UploadStepType,
nextStepDisabled: true,
Expand Down Expand Up @@ -118,6 +125,7 @@ export function uploadReducer(state: UploadReduxType = initStateUploadReducer, a
topics: [],
type: '',
hasLicense: true,
activeLicense: state.data.activeLicense,
},
currentStep: 'details' as UploadStepType,
nextStepDisabled: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export default function DocsNavigation() {

return (
<S.NWrapper>
<S.NContent className={'border-wrapper-alt1 scroll-wrapper'}>
<S.NContent className={'scroll-wrapper'}>
<Title onClick={desktop ? () => {} : () => setOpen(!open)} open={open}>
<p>
{APP.name} {language.learn}
Expand Down
1 change: 0 additions & 1 deletion src/views/Docs/DocsDetail/DocsNavigation/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export const NContent = styled.div`
z-index: 1;
overflow: auto;
margin: 10.5px 0 0 0;
padding: 15px 20px 0 20px;
@media (max-width: ${STYLING.cutoffs.initial}) {
position: relative;
top: auto;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ export default function UploadStepsChecks() {
</S.InfoLine>
</>
)}
{uploadReducer.data.topics && uploadReducer.data.topics.length && (
<S.InfoLine>
<span>{language.topics}</span>
<S.InfoLine>
<span>{language.topics}</span>
{uploadReducer.data.topics && uploadReducer.data.topics.length > 0 ? (
<S.TWrapper>
{uploadReducer.data.topics.map((topic: string, index: number) => {
return (
Expand All @@ -69,8 +69,10 @@ export default function UploadStepsChecks() {
);
})}
</S.TWrapper>
</S.InfoLine>
)}
) : (
<p>-</p>
)}
</S.InfoLine>
</S.InfoWrapper>
<S.InfoHeader>
<span>{language.assets}</span>
Expand Down
Loading

0 comments on commit 5887430

Please sign in to comment.