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

chore: removing unused css #30214

Merged
merged 2 commits into from
Feb 7, 2025
Merged

chore: removing unused css #30214

merged 2 commits into from
Feb 7, 2025

Conversation

georgewrmarshall
Copy link
Contributor

@georgewrmarshall georgewrmarshall commented Feb 7, 2025

Description

This PR removes unused CSS classes and files from the codebase to improve maintainability and reduce CSS size by ~30kb. The changes include:

  1. Removing unused CSS files:
    • network.scss
    • send.scss
  2. Removing unused CSS classes from newui-sections.scss:
    • .lap-visible/.phone-visible classes
    • .fiat-amount
    • .token-balance__amount
    • .unlock-screen-container and related classes

Open in GitHub Codespaces

Related issues

Fixes: https://github.com/MetaMask/MetaMask-planning/issues/4172

Manual testing steps

  1. Pull the branch and build the extension
  2. Test all major UI flows to ensure no visual regressions:
    • Onboarding flow
    • Send flow
    • Network switching
    • Unlock flow
  3. Verify removed classes are not used in any components
  4. Check browser dev tools to confirm CSS bundle size reduction

Screenshots/Recordings

Before

Screenshot 2025-02-07 at 12 10 41 PM

After

Screenshot 2025-02-07 at 12 08 17 PM

Not visual regressions to the following flows"

Onboarding Flow

after.onboarding.mov

Send Flow

after.send.mov

Changing Network Flow

after.networks.mov

Unlock flow

after.password.mov

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

@georgewrmarshall georgewrmarshall added the team-design-system All issues relating to design system in Extension label Feb 7, 2025
@georgewrmarshall georgewrmarshall self-assigned this Feb 7, 2025
Copy link
Contributor

github-actions bot commented Feb 7, 2025

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

Comment on lines -52 to -55
await driver.assertElementNotPresent('.send-v2__error-amount', {
waitAtLeastGuard: 100, // A waitAtLeastGuard of 100ms is the best choice here
});

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing test looking for unused CSS classname

Screenshot 2025-02-07 at 11 41 45 AM

Comment on lines -1 to -4
@import './network';
@import './newui-sections';
@import './send';

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing deleted file imports

@@ -1,195 +0,0 @@
@use "design-system";

.network-component--disabled {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not used

Screenshot 2025-02-07 at 11 42 59 AM

Comment on lines -11 to -37
.network-component.pointer {
border: 1px solid var(--color-border-muted);
border-radius: 82px;
padding: 6px 3px;
flex: 0 0 auto;
display: flex;

&.ethereum-network .menu-icon-circle div {
background-color: rgba(3, 135, 137, 0.7) !important;
}

&.goerli-test-network .menu-icon-circle div {
background-color: rgba(48, 153, 242, 0.7) !important;
}

&.sepolia-test-network .menu-icon-circle div {
background-color: rgba(207, 181, 240, 0.7) !important;
}

&.linea-test-network .menu-icon-circle div {
background-color: rgba(0, 0, 0, 0.7) !important;
}

&.localhost-network .menu-icon-circle div {
background-color: rgba(3, 135, 137, 0.7) !important;
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not used

Screenshot 2025-02-07 at 11 42 59 AM

Comment on lines -39 to -54
.dropdown-menu-item {
.menu-icon-circle,
.menu-icon-circle--active {
margin: 0 14px;
}
}

.dropdown-menu-item .fa.delete {
color: var(--color-icon-default);
margin-right: 10px;
display: none;
}

.dropdown-menu-item:hover .fa.delete {
display: inherit;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not used

Screenshot 2025-02-07 at 11 48 46 AM

Comment on lines -56 to -76
.network-droppo {
background-color: var(--color-background-default);
border-radius: 4px;
right: 2px;

.color-indicator {
margin: 0 14px 0 4px;
}

@include design-system.screen-sm-min {
right: calc(((100% - 85vw) / 2) + 2px);
}

@include design-system.screen-md-min {
right: calc(((100% - 80vw) / 2) + 2px);
}

@include design-system.screen-lg-min {
right: calc(((100% - 65vw) / 2) + 2px);
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not used

Screenshot 2025-02-07 at 11 49 04 AM

Comment on lines -78 to -83
.network-name-item {
flex: 1;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not used

Screenshot 2025-02-07 at 11 49 58 AM

Comment on lines -85 to -88
.network-check__transparent {
opacity: 0;
width: 24px;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not used

Screenshot 2025-02-07 at 11 50 26 AM

Comment on lines -90 to -115
.menu-icon-circle,
.menu-icon-circle--active {
background: none;
border-radius: 22px;
display: flex;
justify-content: center;
align-items: center;
border: 1px solid transparent;
margin: 0 4px;
}

.menu-icon-circle--active {
border: 1px solid var(--color-border-default);
background: var(--color-background-default);
}

.menu-icon-circle div,
.menu-icon-circle--active div {
height: 12px;
width: 12px;
border-radius: 17px;
}

.menu-icon-circle--active div {
opacity: 1;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not used

Screenshot 2025-02-07 at 11 50 47 AM

Comment on lines -117 to -170
.network-dropdown-header {
display: flex;
flex-direction: column;
align-items: center;
width: 100%;
}

.network-dropdown-list {
max-height: 330px;
overflow-y: auto;
margin-bottom: 8px;
}

.network-dropdown-divider {
width: 100%;
height: 1px;
margin: 10px 0;
background-color: var(--color-border-default);
}

.network-dropdown-title {
@include design-system.H4;

height: 25px;
width: 120px;
color: var(--color-text-default);
text-align: center;
}

.network-dropdown-content {
@include design-system.H6;

min-height: 36px;
width: 265px;
color: var(--color-text-default);

&--link {
color: var(--color-primary-default);
cursor: pointer;
text-decoration: underline;

&:hover {
color: var(--color-primary-alternative);
}
}

&--dismiss {
position: absolute;
top: 63px;
right: 10px;
padding: 2px 8px;
width: auto;
}
}
Copy link
Contributor Author

@georgewrmarshall georgewrmarshall Feb 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not used

Screenshot 2025-02-07 at 11 51 20 AM

Comment on lines -172 to -174
.network-caret {
margin: 0 8px;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not used

Screenshot 2025-02-07 at 11 51 54 AM

Comment on lines -176 to -191
.network-loading-spinner {
display: flex;
flex-flow: row nowrap;
align-items: center;
position: relative;
height: 16px;
width: 16px;
margin-left: 5px;

img {
height: 26px;
position: absolute;
top: -5px;
left: -6px;
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not used

Screenshot 2025-02-07 at 11 52 24 AM

Comment on lines -193 to -195
.network__add-network-button {
padding: 0 16px;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not used

Screenshot 2025-02-07 at 11 52 50 AM

Comment on lines -53 to -55
.lap-visible {
display: flex;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not used

Screenshot 2025-02-07 at 11 54 26 AM

Comment on lines -57 to -59
.phone-visible {
display: none;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not used

Screenshot 2025-02-07 at 11 54 51 AM

Comment on lines -104 to -106
.fiat-amount {
text-transform: uppercase;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not used

Screenshot 2025-02-07 at 11 55 15 AM

Comment on lines -108 to -110
.token-balance__amount {
padding: 0 6px;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not used

Screenshot 2025-02-07 at 11 55 41 AM

Comment on lines -135 to -151
.unlock-screen-container {
z-index: design-system.$main-container-z-index;
display: flex;
justify-content: center;
align-items: center;
flex: 1 0 auto;
background: var(--color-background-alternative);
width: 100%;
}

.unlock-screen {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
flex: 1 0 auto;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not used

Screenshot 2025-02-07 at 11 56 11 AM

Comment on lines -3 to -47
.send-screen-wrapper {
display: flex;
flex-flow: column nowrap;
z-index: 25;

@include design-system.screen-sm-max {
width: 100%;
overflow-y: auto;
}

section {
flex: 0 0 auto;
}
}

.send-screen-card {
background-color: var(--color-background-default);
box-shadow: var(--shadow-size-xs) var(--color-shadow-default);
padding: 46px 40.5px 26px;
position: relative;
align-items: center;
display: flex;
flex-flow: column nowrap;
width: 498px;
flex: 1 0 auto;

@include design-system.screen-sm-max {
top: 0;
width: 100%;
box-shadow: none;
padding: 12px;
}
}

/* Send Screen */

.send-screen section {
margin: 4px 16px;
}

.send-screen input {
@include design-system.H7;

width: 100%;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not used

Screenshot 2025-02-07 at 11 56 59 AM

Comment on lines -49 to -65
.send-eth-icon {
border-radius: 50%;
width: 70px;
height: 70px;
border: 1px solid var(--color-border-muted);
box-shadow: var(--shadow-size-xs) var(--color-shadow-default);
position: absolute;
top: -35px;
z-index: 25;
padding: 4px;
background-color: var(--color-background-default);

@include design-system.screen-sm-max {
position: relative;
top: 0;
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not used

Screenshot 2025-02-07 at 11 57 36 AM

Comment on lines -67 to -108
.send-screen-input-wrapper {
width: 95%;
position: relative;

.fa-bolt {
padding-right: 4px;
}

.send-screen-gas-input {
border: 1px solid transparent;
}

&__error-message {
display: none;
}

&--error {
input,
.send-screen-gas-input {
border-color: var(--color-error-default) !important;
}

.send-screen-input-wrapper__error-message {
@include design-system.H7;

display: block;
position: absolute;
bottom: 4px;
left: 8px;
color: var(--color-error-default);
}
}

.send-screen-input-wrapper__error-message {
@include design-system.H7;

display: block;
position: absolute;
bottom: 4px;
left: 8px;
color: var(--color-error-default);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not used

Screenshot 2025-02-07 at 11 58 12 AM

Comment on lines -111 to -142
.send-screen-input {
width: 100%;
}

.send-screen-gas-input {
@include design-system.Paragraph;

width: 100%;
height: 41px;
border-radius: 3px;
background-color: var(--color-background-default);
border-width: 0;
border-style: none;
display: flex;
justify-content: space-between;
align-items: center;
padding-left: 10px;
padding-right: 12px;
color: var(--color-text-alternative);
}

.send-screen-amount-labels {
display: flex;
flex-direction: row;
justify-content: space-between;
}

.send-screen-gas-labels {
display: flex;
flex-direction: row;
justify-content: space-between;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not used

Screenshot 2025-02-07 at 11 58 37 AM

Comment on lines -144 to -154
.currency-toggle {
&__item {
color: var(--color-primary-default);
cursor: pointer;

&--selected {
color: var(--color-text-default);
cursor: default;
}
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not used

Screenshot 2025-02-07 at 11 59 04 AM

Comment on lines -156 to -161
.send-screen-gas-input-customize {
@include design-system.H7;

color: var(--color-primary-default);
cursor: pointer;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not used "send-screen" screenshot above

Comment on lines -163 to -232
.gas-tooltip-close-area {
position: fixed;
top: 0;
left: 0;
z-index: 1000;
width: 100%;
height: 100%;
}

.gas-tooltip-arrow {
height: 25px;
width: 25px;
z-index: 1200;
background: var(--color-background-default);
position: absolute;
transform: rotate(45deg);
left: 107px;
top: 294px;
box-shadow: var(--shadow-size-xs) var(--color-shadow-default);
}

.gas-tooltip {
display: flex;
justify-content: center;
}

.gas-tooltip-label {
@include design-system.Paragraph;

color: var(--color-text-alternative);
}

.gas-tooltip-header {
padding-bottom: 12px;
}

.gas-tooltip-input-label {
margin-bottom: 5px;
}

.gas-tooltip-input-label i {
color: var(--color-icon-muted);
margin-left: 6px;
}

.gas-tooltip-input-detail {
@include design-system.H7;

position: absolute;
top: 4px;
right: 26px;
color: var(--color-text-muted);
}

.gas-tooltip-input-arrows {
@include design-system.H6;

position: absolute;
top: 0;
right: 4px;
width: 17px;
height: 28px;
border: 1px solid var(--color-icon-muted);
border-left: 0;
display: flex;
flex-direction: column;
color: var(--color-text-muted);
padding: 1px 4px;
cursor: pointer;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not used as a className only a data-testid

Screenshot 2025-02-07 at 12 00 17 PM

Comment on lines -234 to -243
.token-gas {
&__amount {
display: inline-block;
margin-right: 4px;
}

&__symbol {
display: inline-block;
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not used

Screenshot 2025-02-07 at 12 01 16 PM

Comment on lines -245 to -268
.send-screen {
&__title {
@include design-system.H4;

color: var(--color-text-alternative);
}

&__subtitle {
@include design-system.H6;

margin: 10px 0 20px;
}

&__send-button,
&__cancel-button {
width: 163px;
text-align: center;
}

&__send-button__disabled {
opacity: 0.5;
cursor: auto;
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not used see "send-screen" screenshot above

Comment on lines -270 to -346
.send-token {
display: flex;
flex-flow: column nowrap;
z-index: 25;

&__content {
width: 498px;
height: 605px;
background-color: var(--color-background-default);
box-shadow: var(--shadow-size-xs) var(--color-shadow-default);
padding: 46px 40.5px 26px;
position: relative;
align-items: center;
display: flex;
flex-flow: column nowrap;
flex: 1 0 auto;

@include design-system.screen-sm-max {
top: 0;
width: 100%;
box-shadow: none;
padding: 12px;
}
}

.identicon {
position: absolute;
top: -35px;
z-index: 25;

@include design-system.screen-sm-max {
position: relative;
top: 0;
flex: 0 0 auto;
}
}

&__title {
@include design-system.H4;

color: var(--color-text-alternative);
}

&__description,
&__balance-text,
&__token-symbol {
@include design-system.H6;

margin-top: 10px;
text-align: center;
}

&__token-balance {
@include design-system.H1;

margin-top: 13px;

.token-balance__amount {
padding-right: 12px;
}
}

&__button-group {
display: flex;
flex-flow: column nowrap;
align-items: center;
flex: 0 0 auto;

@include design-system.screen-sm-max {
margin-top: 24px;
}

button {
width: 163px;
}
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not used as a classname

Screenshot 2025-02-07 at 12 02 08 PM

Comment on lines -348 to -352
.confirm-send-token {
&__hero-amount-wrapper {
width: 100%;
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not used as a classname

Screenshot 2025-02-07 at 12 02 45 PM

}
}

.send-v2 {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not used "send-v2" everything from here down to line 880 is under this classname

Screenshot 2025-02-07 at 12 03 21 PM

Comment on lines -882 to -890
.advanced-gas-options-btn {
@include design-system.H6;

display: flex;
justify-content: flex-end;
color: var(--color-primary-default);
cursor: pointer;
margin-top: 5px;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not used

Screenshot 2025-02-07 at 12 04 48 PM

Comment on lines -892 to -907
.sliders-icon-container {
@include design-system.Paragraph;

display: flex;
align-items: center;
justify-content: center;
height: 24px;
width: 24px;
border: 1px solid var(--color-primary-default);
border-radius: 4px;
background-color: var(--color-background-default);
position: absolute;
right: 15px;
top: 14px;
cursor: pointer;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not used

Screenshot 2025-02-07 at 12 05 22 PM

Comment on lines -909 to -923
.gas-fee-reset {
@include design-system.H6;

display: flex;
align-items: center;
justify-content: center;
height: 24px;
border-radius: 4px;
background-color: var(--color-background-default);
position: absolute;
right: 12px;
top: 14px;
cursor: pointer;
color: var(--color-primary-default);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not used

Screenshot 2025-02-07 at 12 05 45 PM

Comment on lines -925 to -927
.sliders-icon {
color: var(--color-primary-default);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not used

Screenshot 2025-02-07 at 12 06 18 PM

@metamaskbot
Copy link
Collaborator

Builds ready [a085117]
Page Load Metrics (1605 ± 54 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint13921879161211857
domContentLoaded13851851158210751
load13941867160511254
domInteractive2397422211
backgroundConnect899272512
firstReactRender1591402713
getState58215209
initialActions01000
loadScripts932135311249646
setupStore67516199
uiStartup16432249188019191
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@georgewrmarshall georgewrmarshall marked this pull request as ready for review February 7, 2025 21:32
@georgewrmarshall georgewrmarshall requested a review from a team as a code owner February 7, 2025 21:32
Comment on lines -51 to -54
.dropdown-menu-item {
font-size: 14px !important;
padding: 8px !important;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not used

Screenshot 2025-02-07 at 1 35 35 PM

Copy link
Contributor

@vinnyhoward vinnyhoward left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice clean up! LGTM

@georgewrmarshall georgewrmarshall added this pull request to the merge queue Feb 7, 2025
Merged via the queue into main with commit 5b8c780 Feb 7, 2025
87 checks passed
@georgewrmarshall georgewrmarshall deleted the fix/remove-unused-css branch February 7, 2025 23:55
@github-actions github-actions bot locked and limited conversation to collaborators Feb 7, 2025
@metamaskbot metamaskbot added the release-12.13.0 Issue or pull request that will be included in release 12.13.0 label Feb 7, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-12.13.0 Issue or pull request that will be included in release 12.13.0 team-design-system All issues relating to design system in Extension
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants