Skip to content

Commit

Permalink
fix(passport): avatar
Browse files Browse the repository at this point in the history
  • Loading branch information
dimakorzhovnik committed May 29, 2024
1 parent 0e37adc commit d4b9b7c
Show file tree
Hide file tree
Showing 8 changed files with 68 additions and 20 deletions.
4 changes: 3 additions & 1 deletion front/src/constants.ts
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
export const BASE_DENOM = 'boot';
export const BASE_DENOM = "boot";

export const CYBER_GATEWAY = "https://gateway.ipfs.cybernode.ai";
6 changes: 4 additions & 2 deletions front/src/pages/Main/Passport/Passport.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import { Citizenship } from "@/types";
import React from "react";
import Balances from "./ui/Balances/Balances";
import Avatar from "./ui/Avatar/Avatar";

function Passport({ passport }: { passport: Citizenship }) {

const address = passport?.owner;
const cid = passport?.extension.avatar;

return (
<div>
{JSON.stringify(passport)}

<Avatar cid={cid} />

<Balances address={address} />

{/* <MusicalAddress address={passport.owner} /> */}
Expand Down
10 changes: 10 additions & 0 deletions front/src/pages/Main/Passport/ui/Avatar/Avatar.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
$size: 130px;

.wrapper {

img {
width: $size;
height: $size;
border-radius: 50%;
}
}
15 changes: 15 additions & 0 deletions front/src/pages/Main/Passport/ui/Avatar/Avatar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { CYBER_GATEWAY } from '@/constants';
import styles from './Avatar.module.scss';

function Avatar({ cid }: {cid: string}) {

const urlCid = `${CYBER_GATEWAY}/ipfs/${cid}`;

return (
<div className={styles.wrapper}>
<img src={urlCid} alt="avatar" />
</div>
);
}

export default Avatar;
13 changes: 0 additions & 13 deletions front/src/pages/Main/Passport/ui/Balances/Balances.module.scss
Original file line number Diff line number Diff line change
@@ -1,19 +1,6 @@
$size-title: 14px;
$size-item-text: 16px;

.wrapper {
display: grid;
gap: 15px;

.title {
text-align: center;
font-size: $size-title;
color: #616161;
}

}

.wrapperList {
display: grid;
gap: 20px;
}
Expand Down
8 changes: 4 additions & 4 deletions front/src/pages/Main/Passport/ui/Balances/Balances.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Denom } from "./type";
import { DenomListKey, configDenom } from "./utils/configDenom";
import styles from "./Balances.module.scss";
import { formatNumber } from "./utils/formatNumber";
import TitleItem from "../TitleItem/TitleItem";

function BalancesItem({
amount,
Expand Down Expand Up @@ -32,10 +33,9 @@ function Balances({ address }: { address: string }) {
});

return (
<div className={styles.wrapper}>
<span className={styles.title}>balances</span>
<div className={styles.wrapperList}>{renderItem}</div>
</div>
<TitleItem title="Balances">
<div className={styles.wrapper}>{renderItem}</div>
</TitleItem>
);
}

Expand Down
13 changes: 13 additions & 0 deletions front/src/pages/Main/Passport/ui/TitleItem/TitleItem.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
$size-title: 14px;

.wrapper {
display: grid;
gap: 15px;

.title {
text-align: center;
font-size: $size-title;
color: #616161;
}

}
19 changes: 19 additions & 0 deletions front/src/pages/Main/Passport/ui/TitleItem/TitleItem.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { ReactNode } from "react";
import styles from './TitleItem.module.scss';

function TitleItem({
title,
children,
}: {
title: string;
children: ReactNode;
}) {
return (
<div className={styles.wrapper}>
<span className={styles.title}>{title}</span>
{children}
</div>
);
}

export default TitleItem;

0 comments on commit d4b9b7c

Please sign in to comment.