Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add name component #20798

Merged
merged 11 commits into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions app/_locales/en/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions lavamoat/browserify/beta/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -1677,6 +1677,14 @@
"browserify>url": true
}
},
"@metamask/name-controller": {
"globals": {
"fetch": true
},
"packages": {
"@metamask/base-controller": true
}
},
"@metamask/network-controller": {
"globals": {
"URL": true,
Expand Down
8 changes: 8 additions & 0 deletions lavamoat/browserify/desktop/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -1828,6 +1828,14 @@
"browserify>url": true
}
},
"@metamask/name-controller": {
"globals": {
"fetch": true
},
"packages": {
"@metamask/base-controller": true
}
},
"@metamask/network-controller": {
"globals": {
"URL": true,
Expand Down
8 changes: 8 additions & 0 deletions lavamoat/browserify/flask/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -1828,6 +1828,14 @@
"browserify>url": true
}
},
"@metamask/name-controller": {
"globals": {
"fetch": true
},
"packages": {
"@metamask/base-controller": true
}
},
"@metamask/network-controller": {
"globals": {
"URL": true,
Expand Down
8 changes: 8 additions & 0 deletions lavamoat/browserify/main/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -1677,6 +1677,14 @@
"browserify>url": true
}
},
"@metamask/name-controller": {
"globals": {
"fetch": true
},
"packages": {
"@metamask/base-controller": true
}
},
"@metamask/network-controller": {
"globals": {
"URL": true,
Expand Down
8 changes: 8 additions & 0 deletions lavamoat/browserify/mmi/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -1818,6 +1818,14 @@
"browserify>url": true
}
},
"@metamask/name-controller": {
"globals": {
"fetch": true
},
"packages": {
"@metamask/base-controller": true
}
},
"@metamask/network-controller": {
"globals": {
"URL": true,
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@
"@metamask/logo": "^3.1.1",
"@metamask/message-manager": "^7.3.0",
"@metamask/metamask-eth-abis": "^3.0.0",
"@metamask/name-controller": "^1.0.0",
"@metamask/network-controller": "^12.1.1",
"@metamask/notification-controller": "^3.0.0",
"@metamask/obs-store": "^8.1.0",
Expand Down
2 changes: 2 additions & 0 deletions ui/components/app/app-components.scss
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@
@import 'network-account-balance-header/index';
@import 'approve-content-card/index';
@import 'transaction-alerts/transaction-alerts';
@import 'name/index';
@import 'name/name-details/index';
///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
@import '../institutional/interactive-replacement-token-notification/index';
@import '../institutional/confirm-remove-jwt-modal/index';
Expand Down
95 changes: 95 additions & 0 deletions ui/components/app/name/__snapshots__/name.test.tsx.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Name renders address with proposed name 1`] = `
<div>
<div>
<div
class="name name__missing"
>
<span
class="mm-box name__icon mm-icon mm-icon--size-lg mm-box--display-inline-block mm-box--color-inherit"
style="mask-image: url('./images/icons/warning.svg');"
/>
<span
class="name__value"
>
0xc0f...4978
</span>
<span
class="name__proposed"
>
TestProposedName
</span>
</div>
</div>
</div>
`;

exports[`Name renders address with proposed name according to source priority 1`] = `
<div>
<div>
<div
class="name name__missing"
>
<span
class="mm-box name__icon mm-icon mm-icon--size-lg mm-box--display-inline-block mm-box--color-inherit"
style="mask-image: url('./images/icons/warning.svg');"
/>
<span
class="name__value"
>
0xc0f...4978
</span>
<span
class="name__proposed"
>
TestProposedName
</span>
</div>
</div>
</div>
`;

exports[`Name renders address with saved name 1`] = `
<div>
<div>
<div
class="name name__saved"
>
<span
class="mm-box name__icon mm-icon mm-icon--size-lg mm-box--display-inline-block mm-box--color-inherit"
style="mask-image: url('./images/icons/save.svg');"
/>
<span
class="name__name"
>
TestName
</span>
</div>
</div>
</div>
`;

exports[`Name renders address without proposed name 1`] = `
<div>
<div>
<div
class="name name__missing"
>
<span
class="mm-box name__icon mm-icon mm-icon--size-lg mm-box--display-inline-block mm-box--color-inherit"
style="mask-image: url('./images/icons/warning.svg');"
/>
<span
class="name__value"
>
0xc0f...4979
</span>
</div>
</div>
</div>
`;
37 changes: 37 additions & 0 deletions ui/components/app/name/index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
.name {
border-radius: 36px;
padding: 6px 9px 6px 9px;
display: inline-flex;
align-items: center;
gap: 5px;
font-size: 12px;

&__missing {
background-color: var(--color-warning-muted);
}

&__saved {
background-color: var(--color-info-muted);
}

&__missing &__icon {
color: var(--color-warning-default);
}

&__saved &__icon {
color: var(--color-info-default);
}

&__value,
&__proposed {
color: var(--color-warning-default);
}

&__name {
color: var(--color-info-default);
}

&__proposed {
font-style: italic;
}
}
1 change: 1 addition & 0 deletions ui/components/app/name/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './name';
Loading