Skip to content

Commit

Permalink
Merge branch 'develop' into fix/collection-tab-count-error
Browse files Browse the repository at this point in the history
  • Loading branch information
wlliaml committed Oct 12, 2023
2 parents 5a4be57 + 1851bf4 commit cffa8c1
Show file tree
Hide file tree
Showing 7 changed files with 116 additions and 103 deletions.
5 changes: 2 additions & 3 deletions public/static/icons/16px/copy.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 2 additions & 4 deletions public/static/icons/16px/external-link.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 10 additions & 20 deletions src/components/Dialogs/FingerprintDialog/ArticleSecret.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,7 @@ import { useQuery } from '@apollo/react-hooks'
import gql from 'graphql-tag'
import { useIntl } from 'react-intl'

import {
Button,
CopyToClipboard,
IconCopy16,
IconLocked24,
TextIcon,
Translate,
} from '~/components'
import { CopyToClipboard, IconCopy16, TextIcon, Translate } from '~/components'
import { ArticleSecretQuery } from '~/gql/graphql'

import styles from './styles.module.css'
Expand Down Expand Up @@ -56,21 +49,18 @@ const ArticleSecretSection: React.FC<ArticleSecretSectionProps> = ({ id }) => {

<section className={styles.key}>
<CopyToClipboard text={secret}>
<Button
<button
aria-label={intl.formatMessage({ defaultMessage: 'Copy' })}
spacing={['xtight', 'base']}
bgColor="yellowLighter"
className={styles.copyButton}
>
<TextIcon icon={<IconLocked24 size="md" />} spacing="xxtight">
<TextIcon
icon={<IconCopy16 />}
textPlacement="left"
spacing="xtight"
>
{secret.slice(0, 3)}...{secret.slice(-2)}
</TextIcon>
<TextIcon
icon={<IconCopy16 />}
textPlacement="left"
spacing="xtight"
>
{secret.slice(0, 4)}...{secret.slice(-4)}
</TextIcon>
</Button>
</button>
</CopyToClipboard>
</section>
</section>
Expand Down
145 changes: 77 additions & 68 deletions src/components/Dialogs/FingerprintDialog/Content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,10 @@ const FingerprintDialogContent = ({
<SectionCard
title={
<TextIcon
icon={<IconIPFSGreen24 size="md" />}
icon={<IconIPFSGreen24 size="mdXS" />}
spacing="xtight"
size="lg"
size="xm"
weight="md"
>
IPFS
</TextIcon>
Expand All @@ -135,7 +136,7 @@ const FingerprintDialogContent = ({
/>
}
>
<Spacer size="xtight" />
<Spacer size="base" />
<hr />
<Spacer size="base" />

Expand All @@ -157,7 +158,7 @@ const FingerprintDialogContent = ({
/>
</p>

<ul>
<ul className={styles.gatewayUrls}>
{(!data || loading) && <Spinner />}

{gateways.slice(0, 4).map((url) => {
Expand Down Expand Up @@ -222,71 +223,79 @@ const FingerprintDialogContent = ({

{/* iscnId */}
{iscnPublish && (isAuthor || iscnId) && !timeCooling && (
<SectionCard
title={
<TextIcon
icon={<IconISCN24 size="md" />}
size="lg"
spacing="xtight"
>
ISCN
</TextIcon>
}
description={
iscnId ? (
<Translate
zh_hant="已在 LikeCoin 鏈上註冊的元數據"
zh_hans="已在 LikeCoin 鏈上註冊的元數據"
en="The metadata registered on LikeCoin chain"
/>
) : (
<Translate
zh_hant="ISCN 寫入未成功"
zh_hans="ISCN 写入未成功"
en="ISCN is failed to register on LikeCoin chain"
/>
)
}
warning={!iscnId}
right={
iscnId ? (
<a href={iscnLinkUrl(iscnId)} target="_blank" rel="noreferrer">
<IconExternalLink16 color="greyDarker" />
</a>
) : isAuthor ? (
<Button
spacing={[0, 'xtight']}
size={[null, '1.5rem']}
bgColor="green"
textColor="white"
aria-label={translate({ id: 'retry', lang })}
disabled={!pending && (timeCooling || retryPublishing)}
onClick={() => {
editArticle({
variables: {
id: articleId,
iscnPublish: true,
},
})
setTimeCooling(true)
pooling(Date.now())
}}
<>
<Spacer size="base" />
<SectionCard
title={
<TextIcon
icon={<IconISCN24 size="mdXS" />}
spacing="xtight"
size="xm"
weight="md"
>
<TextIcon size="smS">
{timeCooling ? (
<Translate id="publishing2" />
) : retryPublishing ? (
<Translate id="retrying" />
) : (
<Translate id="retry" />
)}
</TextIcon>
</Button>
) : (
<></>
)
}
/>
ISCN
</TextIcon>
}
description={
iscnId ? (
<Translate
zh_hant="已在 LikeCoin 鏈上註冊的元數據"
zh_hans="已在 LikeCoin 鏈上註冊的元數據"
en="The metadata registered on LikeCoin chain"
/>
) : (
<Translate
zh_hant="ISCN 寫入未成功"
zh_hans="ISCN 写入未成功"
en="ISCN is failed to register on LikeCoin chain"
/>
)
}
warning={!iscnId}
right={
iscnId ? (
<a
href={iscnLinkUrl(iscnId)}
target="_blank"
rel="noreferrer"
>
<IconExternalLink16 color="greyDarker" />
</a>
) : isAuthor ? (
<Button
spacing={[0, 'xtight']}
size={[null, '1.5rem']}
bgColor="green"
textColor="white"
aria-label={translate({ id: 'retry', lang })}
disabled={!pending && (timeCooling || retryPublishing)}
onClick={() => {
editArticle({
variables: {
id: articleId,
iscnPublish: true,
},
})
setTimeCooling(true)
pooling(Date.now())
}}
>
<TextIcon size="smS">
{timeCooling ? (
<Translate id="publishing2" />
) : retryPublishing ? (
<Translate id="retrying" />
) : (
<Translate id="retry" />
)}
</TextIcon>
</Button>
) : (
<></>
)
}
/>
</>
)}
</section>
</Dialog.Content>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,8 @@
& .description {
margin-top: var(--spacing-xx-tight);
}

& .error {
color: var(--color-red);
}
}
27 changes: 20 additions & 7 deletions src/components/Dialogs/FingerprintDialog/styles.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
}

.gateways {
& ul {
& .gatewayUrls {
@mixin hide-scrollbar;

padding: var(--spacing-x-tight) var(--spacing-base) 0;
margin: 0 calc(var(--spacing-base) * -1);
margin: var(--spacing-x-tight) calc(var(--spacing-base) * -1);

& li {
@mixin flex-center-space-between;
Expand All @@ -31,9 +31,9 @@
width: 100%;
padding-left: var(--spacing-x-tight);
margin-right: var(--spacing-x-tight);
font-size: var(--font-size-md);
line-height: 2.5rem;
color: var(--color-grey-darker);
font-size: var(--font-size-sm);
line-height: 2.375rem;
color: var(--color-grey-dark);

&.disabled {
opacity: 0.5;
Expand All @@ -57,14 +57,27 @@
@mixin flex-center-space-between;
}

& .copyButton {
height: 2.5rem;
padding: 0 var(--spacing-base);
background: var(--color-yellow-lighter);
border-radius: 0.5rem;
}

& .description {
color: var(--color-matters-gold);
}
}

.title {
font-size: var(--font-size-sm);
line-height: 1.375rem;
}

.description {
font-size: var(--font-size-sm-s);
font-size: var(--font-size-xs);
font-weight: var(--font-weight-normal);
line-height: 1.125rem;
color: var(--color-grey);

&.error {
Expand All @@ -78,7 +91,7 @@

position: relative;
padding: var(--spacing-tight) var(--spacing-x-tight);
margin-top: var(--spacing-x-tight);
margin-top: var(--spacing-base);
color: var(--color-matters-green);
background: var(--color-green-lighter);
border-radius: 0.25rem;
Expand Down
2 changes: 1 addition & 1 deletion src/components/Dialogs/RssFeedDialog/Content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ const BaseRssFeedDialogContent: React.FC<RssFeedDialogContentProps> = ({
/>
</p>

<ul>
<ul className={styles.gatewayUrls}>
{(!data || loading) && <Spinner />}

{/* FIXME: remove filebase.io and meson.network */}
Expand Down

0 comments on commit cffa8c1

Please sign in to comment.