Skip to content

Commit

Permalink
Merge pull request #10 from rarimo/fixes
Browse files Browse the repository at this point in the history
Fixes
  • Loading branch information
WhiteNik16 authored Dec 8, 2023
2 parents 1d32bfd + f91d8a3 commit c0f230f
Show file tree
Hide file tree
Showing 13 changed files with 44 additions and 27 deletions.
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
VITE_APP_NAME='Rarime dashboard'
VITE_APP_DOMAIN='https://dashboard.rarime.com'
VITE_DEFAULT_CHAIN='SEPOLIA'
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"dependencies": {
"@distributedlab/tools": "^1.0.0-rc.8",
"@distributedlab/w3p": "^1.0.0-rc.8",
"@rarimo/rarime-connector": "^1.1.0-rc.0",
"@rarimo/rarime-connector": "^1.0.2",
"@walletconnect/modal": "^2.6.2",
"downshift": "^7.1.2",
"framer-motion": "^10.12.10",
Expand Down
2 changes: 1 addition & 1 deletion src/common/AppNavbar/AppNavbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const AppNavbar: FC<HTMLAttributes<HTMLDivElement>> = ({
scheme='none'
size='none'
iconLeft={IconNames.AccountBalanceWallet}
routePath={RoutesPaths.App}
routePath={RoutesPaths.Profiles}
/>
</div>
</div>
Expand Down
3 changes: 2 additions & 1 deletion src/common/AppNavbar/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
gap: toRem(24);
padding: toRem(24) var(--app-padding-right) toRem(24) var(--app-padding-left);
border-bottom: var(--border-primary-main);
height: 100vh;
min-height: 100vh;
height: 100%;
background: var(--background-secondary-main);
position: absolute;
left: 0;
Expand Down
3 changes: 2 additions & 1 deletion src/enums/routes.enum.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export enum RoutesPaths {
App = '/profiles',
App = '/',
Profiles = '/profiles',
SignIn = '/sign-in',
}
4 changes: 2 additions & 2 deletions src/localization/resources/en.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"profile-page": {
"title" : "Add Credentials",
"description": "Explore credentials marketplace with different providers",
"title" : "Profiles & Wallets",
"description": "Manage your identity credentials and Soulbound Tokens (SBTs) easily from this dashboard",
"wallet": "Wallet",
"filter": "Filter",
"credential": "credential",
Expand Down
15 changes: 12 additions & 3 deletions src/pages/ProfilePage/ProfilePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,24 @@ import { CredentialsTile, Sidebar } from './components'

const ProfilePage = () => {
const [credentials, setCredentials] = useState([] as W3CCredential[])
const { getCredentials } = useMetamaskZkpSnapContext()
const { getCredentials, checkSnapExists, connectOrInstallSnap } =
useMetamaskZkpSnapContext()
const { provider } = useWeb3Context()
const navigate = useNavigate()
const { t } = useTranslation()

const getUserCredentials = useCallback(async () => {
await checkConnectSnap()
setCredentials(await getCredentials())
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [getCredentials])

const checkConnectSnap = useCallback(async () => {
if (!(await checkSnapExists())) {
await connectOrInstallSnap()
}
}, [checkSnapExists, connectOrInstallSnap])

useEffect(() => {
if (!provider?.address) {
navigate(RoutesPaths.SignIn)
Expand Down Expand Up @@ -76,10 +85,10 @@ const ProfilePage = () => {
name={IconNames.PlusInCircle}
/>
<span className='profile-page__content-empty-title'>
{t('profile-page.title')}
{t('profile-page.empty-title')}
</span>
<p className='profile-page__content-empty-description'>
{t('profile-page.description')}
{t('profile-page.empty-description')}
</p>
<AppButton
className='profile-page__content-empty-button'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
font-size: toRem(16);
font-weight: 500;
line-height: toRem(20);
padding-bottom: toRem(16);
padding: toRem(16) 0;
}

.credential-tile__content-subtitle {
Expand Down
5 changes: 3 additions & 2 deletions src/pages/ProfilePage/styles.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
.profile-page {
background: var(--background-secondary-main);
padding: var(--app-primary-page-padding) var(--app-primary-page-padding) var(--app-primary-page-padding) var(--sidebar-full-width);
height: 100vh;
min-height: 100vh;
height: 100%;
}

.profile-page__header {
Expand All @@ -12,7 +13,7 @@
.profile-page__wrapper {
border-radius: toRem(16);
background: var(--white);
height: 100%;
min-height: calc(100vh - (2 * var(--app-primary-page-padding)));
padding: toRem(32) toRem(28);
display: flex;
flex-direction: column;
Expand Down
16 changes: 11 additions & 5 deletions src/pages/SignInPage/SignInPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,24 @@ const SignInPage = () => {
const navigate = useNavigate()
const { t } = useTranslation()
const { init: initWeb3, provider } = useWeb3Context()
const { connectOrInstallSnap } = useMetamaskZkpSnapContext()
const { connectOrInstallSnap, checkSnapExists } = useMetamaskZkpSnapContext()

const connectWallet = async () => {
await initWeb3(PROVIDERS.Metamask)
await connectOrInstallSnap()
navigate(RoutesPaths.Profiles)
}

useEffect(() => {
if (provider?.isConnected) {
navigate(RoutesPaths.App)
const redirectToProfiles = async () => {
if (provider?.address && (await checkSnapExists())) {
navigate(RoutesPaths.Profiles)
}
}, [navigate, provider?.isConnected])
}

useEffect(() => {
redirectToProfiles()
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [navigate])

return (
<div className='sign-in-page'>
Expand Down
6 changes: 1 addition & 5 deletions src/pages/SignInPage/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,12 @@
justify-content: center;
height: 100vh;
width: 100%;
background-image: url("/imgs/app-background.webp");
background-image: url("/imgs/app-bg.png");
background-repeat: no-repeat;
background-position: right;
background-size: 50% / cover;
backdrop-filter: opacity(0.1);

&.no-webp {
background-image: url("/imgs/app-bg.png");
}

&:before {
content: "";
pointer-events: none;
Expand Down
2 changes: 1 addition & 1 deletion src/routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const AppRoutes = () => {
children: [
{
index: true,
path: RoutesPaths.App,
path: RoutesPaths.Profiles,
element: <ProfilePage />,
},
{
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1085,10 +1085,10 @@
picocolors "^1.0.0"
tslib "^2.5.0"

"@rarimo/rarime-connector@^1.1.0-rc.0":
version "1.1.0-rc.0"
resolved "https://registry.yarnpkg.com/@rarimo/rarime-connector/-/rarime-connector-1.1.0-rc.0.tgz#e7374eccc811a68b862a5dc833ab64b45535ef9b"
integrity sha512-d5CHbWtpkOOH5MhsJY+qzmtVkTeetc5dhVUPaRT7WKYbmFvcRf2WG/h1DOlRPzQ7UHSdbx7UQCOcLmTw2B+PGw==
"@rarimo/rarime-connector@^1.0.2":
version "1.0.2"
resolved "https://registry.yarnpkg.com/@rarimo/rarime-connector/-/rarime-connector-1.0.2.tgz#966f260e9ccfde53c99900273d6c0421198ea1a8"
integrity sha512-783NYW34bYIl7/5k8ggA53ZEo4yUBNhEGU51MAvjRnqiCn6W6x4LUGbZyu14jn3/D47DkOYI3pnOWsZpeFHfGw==
dependencies:
"@ethersproject/providers" "5.7.2"
ethers "5.7.2"
Expand Down

0 comments on commit c0f230f

Please sign in to comment.