- {map(
- ({
- id,
- displayUri,
- name,
- description,
- }: Token) => (
-
-
-
-
-
-
{id}
-
-
{description}
-
+ {map(({ id, displayUri, name, description }: Token) => (
+
+
+
+
+
+
{id}
+
+
{description}
+
- ),
- )(items)}
+
+ ))(items)}
diff --git a/apps/envited.ascs.digital/modules/Mint/Mint.tsx b/apps/envited.ascs.digital/modules/Mint/Mint.tsx
index c8aa5749..943d6efb 100644
--- a/apps/envited.ascs.digital/modules/Mint/Mint.tsx
+++ b/apps/envited.ascs.digital/modules/Mint/Mint.tsx
@@ -1,5 +1,7 @@
'use client'
+import { IconButtonWithTooltip } from '@envited-x-data-space/design-system'
+import { RocketLaunchIcon } from '@heroicons/react/24/outline'
import React, { FC } from 'react'
import { useTranslation } from '../../common/i18n'
@@ -10,9 +12,10 @@ import { ShowSpecificBeaconWallets } from './Mint.utils'
interface MintProps {
assetId: string
+ disabled: boolean
}
-export const Mint: FC
= ({ assetId }) => {
+export const Mint: FC = ({ assetId, disabled }) => {
const { t } = useTranslation('Mint')
const { error, success } = useNotification()
@@ -40,12 +43,12 @@ export const Mint: FC = ({ assetId }) => {
}
}
return (
- }
onClick={() => mintAsset(assetId)}
>
{t('[Button] mint')}
-
+
)
}
diff --git a/apps/envited.ascs.digital/modules/UploadedAsset/UploadAsset.constants.ts b/apps/envited.ascs.digital/modules/UploadedAsset/UploadAsset.constants.ts
new file mode 100644
index 00000000..b3b3be8f
--- /dev/null
+++ b/apps/envited.ascs.digital/modules/UploadedAsset/UploadAsset.constants.ts
@@ -0,0 +1,9 @@
+import { AssetAction, AssetStatus } from '../../common/types'
+
+export const enabledActionsMap = {
+ [AssetStatus.processing]: [],
+ [AssetStatus.rejected]: [AssetAction.delete],
+ [AssetStatus.minted]: [AssetAction.view],
+ [AssetStatus.completed]: [AssetAction.view],
+ [AssetStatus.pending]: [AssetAction.mint, AssetAction.delete],
+}
diff --git a/apps/envited.ascs.digital/modules/UploadedAsset/UploadedAsset.buttons.tsx b/apps/envited.ascs.digital/modules/UploadedAsset/UploadedAsset.buttons.tsx
new file mode 100644
index 00000000..5506a0bb
--- /dev/null
+++ b/apps/envited.ascs.digital/modules/UploadedAsset/UploadedAsset.buttons.tsx
@@ -0,0 +1,71 @@
+'use client'
+
+import { IconButtonWithTooltip } from '@envited-x-data-space/design-system'
+import { EyeIcon, TrashIcon } from '@heroicons/react/24/outline'
+import { useRouter } from 'next/navigation'
+import { includes } from 'ramda'
+import { FC } from 'react'
+
+import { useTranslation } from '../../common/i18n'
+import { useNotification } from '../../common/notifications'
+import { AssetAction, AssetStatus } from '../../common/types'
+import { Mint } from '../Mint'
+import { enabledActionsMap } from './UploadAsset.constants'
+import { deleteAsset } from './UploadedAsset.actions'
+
+interface UploadedAssetProps {
+ id: string
+ status: AssetStatus
+}
+
+export const View: FC<{ id: string; disabled: boolean }> = ({ id, disabled }) => {
+ const { t } = useTranslation('UploadedAsset')
+ const router = useRouter()
+
+ return (
+ }
+ onClick={() => router.push(`/assets/${id}`)}
+ >
+ {t('[Button] view')}
+
+ )
+}
+
+export const Delete: FC<{ id: string; disabled: boolean }> = ({ id, disabled }) => {
+ const { t } = useTranslation('UploadedAsset')
+ const { error, success } = useNotification()
+
+ const cancel = async (id: string) => {
+ try {
+ await deleteAsset(id)
+ success(t('[Notification] asset deleted'))
+ } catch (e) {
+ error(t('[Notification] error deleting asset'))
+ }
+ }
+
+ return (
+ }
+ onClick={() => cancel(id)}
+ >
+ {t('[Button] delete')}
+
+ )
+}
+
+export const UploadedAssetButtons: FC = ({ id, status }) => {
+ return (
+
+
+
+
+ {''}
+
+
+
+ )
+}
diff --git a/apps/envited.ascs.digital/modules/UploadedAsset/UploadedAsset.tsx b/apps/envited.ascs.digital/modules/UploadedAsset/UploadedAsset.tsx
index 41ded052..ee49e556 100644
--- a/apps/envited.ascs.digital/modules/UploadedAsset/UploadedAsset.tsx
+++ b/apps/envited.ascs.digital/modules/UploadedAsset/UploadedAsset.tsx
@@ -1,27 +1,24 @@
'use client'
import { LoadingIndicator } from '@envited-x-data-space/design-system'
-import { TrashIcon } from '@heroicons/react/24/outline'
-import { useSession } from 'next-auth/react'
-import { equals, last, propOr } from 'ramda'
+import { CheckIcon, EllipsisHorizontalIcon, XMarkIcon } from '@heroicons/react/24/outline'
+import { equals } from 'ramda'
import { FC, useEffect, useState } from 'react'
import { match } from 'ts-pattern'
import { useTranslation } from '../../common/i18n'
-import { useNotification } from '../../common/notifications'
-import { Asset, AssetMetadata, AssetStatus } from '../../common/types'
-import { Mint } from '../Mint'
-import { deleteAsset, getAsset } from './UploadedAsset.actions'
+import { Asset, AssetStatus } from '../../common/types'
+import { formatDate, truncateCID } from '../../common/utils'
+import { getAsset } from './UploadedAsset.actions'
+import { UploadedAssetButtons } from './UploadedAsset.buttons'
interface UploadedAssetProps {
assetIdx: number
asset: Asset
- metadata: AssetMetadata
}
-export const UploadedAsset: FC = ({ assetIdx, asset, metadata }) => {
+export const UploadedAsset: FC = ({ assetIdx, asset }) => {
const { t } = useTranslation('UploadedAsset')
- const { error, success } = useNotification()
const [assetStatus, setAssetStatus] = useState(asset.status)
useEffect(() => {
@@ -50,29 +47,13 @@ export const UploadedAsset: FC = ({ assetIdx, asset, metadat
}
}, [asset.id, assetStatus])
- const cancel = async (id: string) => {
- try {
- await deleteAsset(id)
- success(t('[Notification] asset deleted'))
- } catch (e) {
- error(t('[Notification] error deleting asset'))
- }
- }
-
return (
- {asset.name}
- {asset.cid}
-
-
-
-
-
- {propOr('', 'type')(metadata)}
- ยท
- {propOr('', 'size')(metadata)}
+ {asset.name}
+
+ {truncateCID(asset.cid)}
{assetIdx !== 0 ? : null}
|
@@ -81,12 +62,12 @@ export const UploadedAsset: FC = ({ assetIdx, asset, metadat
equals(assetIdx)(0) ? '' : 'border-t border-gray-200'
} hidden px-3 py-3.5 text-sm text-gray-500 lg:table-cell`}
>
- {equals(assetStatus)(AssetStatus.processing) ? <>…> : last(propOr('', 'tags')(metadata))}
+ {equals(asset.status)(AssetStatus.processing) ? <>…> : formatDate(asset.createdAt)}
{match(assetStatus)
.with(AssetStatus.processing, () => (
@@ -95,31 +76,32 @@ export const UploadedAsset: FC = ({ assetIdx, asset, metadat
{t('[Status] processing')}
))
- .with(AssetStatus.minted, () => {t('[Status] minted')})
- .with(AssetStatus.rejected, () => (
-
- {t('[Status] rejected')}
-
+ .with(AssetStatus.pending, () => (
+
+
+ {t('[Status] pending')}
))
- .otherwise(() => (
-
-
-
+ .with(AssetStatus.minted, () => (
+
+
+ {t('[Status] minted')}
- ))}
+ ))
+ .with(AssetStatus.rejected, () => (
+
+
+ {t('[Status] rejected')}
+
+ ))
+ .otherwise(() => '')}
+ |
+
+
{!equals(assetIdx)(0) ? : null}
|
diff --git a/apps/envited.ascs.digital/modules/UploadedAsset/locales/de_DE.json b/apps/envited.ascs.digital/modules/UploadedAsset/locales/de_DE.json
index ff511f24..713b9f35 100644
--- a/apps/envited.ascs.digital/modules/UploadedAsset/locales/de_DE.json
+++ b/apps/envited.ascs.digital/modules/UploadedAsset/locales/de_DE.json
@@ -1,8 +1,10 @@
{
- "[Status] minted": "Completed",
+ "[Status] minted": "Minted",
"[Status] processing": "Processing...",
+ "[Status] pending": "Ready for minting",
"[Status] rejected": "Rejected",
"[Button] delete": "Cancel",
- "[Notification] error deleting asset": "Something went wrong",
+ "[Button] view": "View",
+ "[Notification] error deleting asset": "Cannot delete asset",
"[Notification] asset deleted": "Asset successfully cancelled"
}
diff --git a/apps/envited.ascs.digital/modules/UploadedAsset/locales/en_GB.json b/apps/envited.ascs.digital/modules/UploadedAsset/locales/en_GB.json
index fbcf9346..0e6c2057 100644
--- a/apps/envited.ascs.digital/modules/UploadedAsset/locales/en_GB.json
+++ b/apps/envited.ascs.digital/modules/UploadedAsset/locales/en_GB.json
@@ -1,8 +1,11 @@
{
- "[Status] minted": "Completed",
+ "[Status] minted": "Minted",
"[Status] processing": "Processing...",
+ "[Status] pending": "Ready for minting",
"[Status] rejected": "Rejected",
- "[Button] delete": "Cancel",
+ "[Button] mint": "Mint",
+ "[Button] delete": "Delete",
+ "[Button] view": "View",
"[Notification] error deleting asset": "Cannot delete asset",
"[Notification] asset deleted": "Asset successfully cancelled"
}
diff --git a/apps/envited.ascs.digital/modules/UploadedAssets/UploadedAssets.tsx b/apps/envited.ascs.digital/modules/UploadedAssets/UploadedAssets.tsx
index 1322bd8f..f3818952 100644
--- a/apps/envited.ascs.digital/modules/UploadedAssets/UploadedAssets.tsx
+++ b/apps/envited.ascs.digital/modules/UploadedAssets/UploadedAssets.tsx
@@ -24,32 +24,24 @@ export const UploadedAssets: FC = ({ assets }) => {