Skip to content

Commit

Permalink
asset page link
Browse files Browse the repository at this point in the history
  • Loading branch information
NickJ202 committed Aug 27, 2024
1 parent 29934dd commit 53f5316
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/assets/link.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: 6 additions & 0 deletions src/components/atoms/IconButton/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ export const Primary = styled.button<{
disabled: boolean | undefined;
active: boolean | undefined;
}>`
min-height: ${(props) => (props.dimensions ? `${props.dimensions.wrapper.toString()}px` : `42.5px`)};
min-width: ${(props) => (props.dimensions ? `${props.dimensions.wrapper.toString()}px` : `42.5px`)};
height: ${(props) => (props.dimensions ? `${props.dimensions.wrapper.toString()}px` : `42.5px`)};
width: ${(props) => (props.dimensions ? `${props.dimensions.wrapper.toString()}px` : `42.5px`)};
display: flex;
Expand All @@ -42,6 +44,8 @@ export const Primary = styled.button<{
border-radius: 50%;
svg {
min-height: ${(props) => (props.dimensions ? `${props.dimensions.icon.toString()}px` : `24.5px`)};
min-width: ${(props) => (props.dimensions ? `${props.dimensions.icon.toString()}px` : `24.5px`)};
height: ${(props) => (props.dimensions ? `${props.dimensions.icon.toString()}px` : `24.5px`)};
width: ${(props) => (props.dimensions ? `${props.dimensions.icon.toString()}px` : `24.5px`)};
fill: ${(props) =>
Expand Down Expand Up @@ -77,6 +81,8 @@ export const Alt1 = styled(Primary)`
? props.theme.colors.button.primary.disabled.border
: props.theme.colors.button.primary.border};
svg {
min-height: ${(props) => (props.dimensions ? `${props.dimensions.icon.toString()}px` : `24.5px`)};
min-width: ${(props) => (props.dimensions ? `${props.dimensions.icon.toString()}px` : `24.5px`)};
height: ${(props) => (props.dimensions ? `${props.dimensions.icon.toString()}px` : `24.5px`)};
width: ${(props) => (props.dimensions ? `${props.dimensions.icon.toString()}px` : `24.5px`)};
fill: ${(props) =>
Expand Down
2 changes: 2 additions & 0 deletions src/helpers/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import info from 'assets/info.svg';
import leaderboard from 'assets/leaderboard.svg';
import license from 'assets/license.svg';
import light from 'assets/light.svg';
import link from 'assets/link.svg';
import list from 'assets/list.svg';
import logo from 'assets/logo.svg';
import market from 'assets/market.svg';
Expand Down Expand Up @@ -132,6 +133,7 @@ export const ASSETS = {
leaderboard,
license,
light,
link,
list,
logo,
market,
Expand Down
3 changes: 2 additions & 1 deletion src/helpers/language.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ export const language = {
connectWallet: `Connect your wallet`,
connectToContinue: `Connect your wallet to continue`,
copied: `Copied`,
copyWalletAddress: `Copy wallet address`,
copyPageUrl: `Copy URL`,
copyProfileAddress: `Copy profile address`,
copyWalletAddress: `Copy wallet address`,
create: `Create`,
createProfile: `Create your profile`,
createdBy: `Created by`,
Expand Down
24 changes: 23 additions & 1 deletion src/views/Asset/AssetAction/AssetAction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { getRegistryProfiles } from 'api';
import * as GS from 'app/styles';
import { Button } from 'components/atoms/Button';
import { CurrencyLine } from 'components/atoms/CurrencyLine';
import { IconButton } from 'components/atoms/IconButton';
import { Loader } from 'components/atoms/Loader';
import { Modal } from 'components/molecules/Modal';
import { OwnerLine } from 'components/molecules/OwnerLine';
Expand Down Expand Up @@ -79,6 +80,7 @@ export default function AssetAction(props: IProps) {
const [showCurrentListingsModal, setShowCurrentListingsModal] = React.useState<boolean>(false);

const [currentTab, setCurrentTab] = React.useState<string>(ACTION_TABS[0]!.label);
const [urlCopied, setUrlCopied] = React.useState<boolean>(false);

React.useEffect(() => {
if (props.asset && props.asset.state && props.asset.state.balances) {
Expand Down Expand Up @@ -234,6 +236,12 @@ export default function AssetAction(props: IProps) {
return listing.creator === arProvider.profile.id;
}

const copyPageUrl = React.useCallback(async () => {
await navigator.clipboard.writeText(window.location.href);
setUrlCopied(true);
setTimeout(() => setUrlCopied(false), 2000);
}, []);

const getCurrentOwners = React.useMemo(() => {
return (
<>
Expand Down Expand Up @@ -423,7 +431,21 @@ export default function AssetAction(props: IProps) {
<AssetData asset={props.asset} frameMinHeight={550} autoLoad />
</S.DataWrapper>
<S.Header>
<h4>{props.asset.data.title}</h4>
<S.HeaderTitle>
<h4>{props.asset.data.title}</h4>
<IconButton
type={'alt1'}
src={urlCopied ? ASSETS.link : ASSETS.link}
handlePress={copyPageUrl}
dimensions={{
wrapper: 33.5,
icon: 17.5,
}}
disabled={urlCopied}
tooltip={urlCopied ? `${language.copied}!` : language.copyPageUrl}
useBottomToolTip
/>
</S.HeaderTitle>
<S.OwnerLinesWrapper>
{showCurrentlyOwnedBy() && (
<S.OwnerLine>
Expand Down
15 changes: 12 additions & 3 deletions src/views/Asset/AssetAction/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,19 @@ export const DataWrapper = styled.div`
}
`;

export const Header = styled.div`
export const Header = styled.div``;

export const HeaderTitle = styled.div`
display: flex;
align-items: flex-start;
gap: 10px;
justify-content: space-between;
margin: -12.5px 0 10px 0;
h4 {
line-height: 1.15;
margin: -5px 0 10px 0;
line-height: 1.5;
}
button {
margin: 10px 0 0 0;
}
`;

Expand Down

0 comments on commit 53f5316

Please sign in to comment.