Skip to content
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
3 changes: 3 additions & 0 deletions _locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,5 +115,8 @@
},
"i18nViolations": {
"message": "All Violations"
},
"i18nCurrentViolations": {
"message": "View Violations"
}
}
6 changes: 3 additions & 3 deletions src/css/popup.css
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ state-element {
box-sizing: border-box;
border-radius: 4px;
cursor: pointer;
height: 36px;
min-height: 36px;
font-family: SF Pro Text;
font-style: normal;
font-weight: 500;
font-size: 15px;
font-size: 13px;
line-height: 20px;
text-align: center;
letter-spacing: -0.23px;
Expand All @@ -68,7 +68,7 @@ state-element {
color: #ffffff;
}

.secondary_button {
.secondary_button, .tertiary_button {
background: #ffffff;
color: #1c2b33;
}
Expand Down
4 changes: 3 additions & 1 deletion src/html/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@
secondary-button-id="i18nAnomalyLearnMoreButton"
secondary-button-action="learn_more"
primary-button-id="i18nDownloadPrompt"
primary-button-action="download"></state-element>
primary-button-action="download"
tertiary-button-id="i18nCurrentViolations"
tertiary-button-action="violations_list"></state-element>
<state-element
inner-id="download"
header-message="i18nDownloadPrompt"
Expand Down
25 changes: 21 additions & 4 deletions src/js/popup/popup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ class StateElement extends HTMLElement {
'primary-button-action',
'secondary-button-id',
'secondary-button-action',
'tertiary-button-id',
'tertiary-button-action',
'header-message',
];

Expand All @@ -198,26 +200,35 @@ class StateElement extends HTMLElement {
const headerMessage = this.getAttribute('header-message');
const statusHeader = this.getAttribute('status-header');
const statusMessage = this.getAttribute('status-message');
const secondaryButtonId = this.getAttribute('secondary-button-id');
const primaryButtonId = this.getAttribute('primary-button-id');
const secondaryButtonId = this.getAttribute('secondary-button-id');
const tertiaryButtonId = this.getAttribute('tertiary-button-id');
const primaryButtonAction = this.getAttribute('primary-button-action');
const secondaryButtonAction = this.getAttribute('secondary-button-action');
const tertiaryButtonAction = this.getAttribute('tertiary-button-action');
const primaryButton = primaryButtonId
? `<button
id="${primaryButtonId}"
class="button primary_button"
type="button"></button>`
: '';
const secondaryButton = secondaryButtonId
? `<button
id="${secondaryButtonId}"
class="button secondary_button"
type="button"></button>`
: '';
const primaryButton = primaryButtonId
const tertiaryButton = tertiaryButtonId
? `<button
id="${primaryButtonId}"
class="button primary_button"
id="${tertiaryButtonId}"
class="button tertiary_button"
type="button"></button>`
: '';
const actionBar =
primaryButton || secondaryButton
? `<div class="action_bar">
${secondaryButton}
${tertiaryButton}
${primaryButton}
</div>`
: '';
Expand Down Expand Up @@ -255,6 +266,10 @@ class StateElement extends HTMLElement {
const button = document.getElementById(secondaryButtonId);
handleButtonAction(button!, secondaryButtonAction, innerId);
}
if (tertiaryButtonAction != null && tertiaryButtonId != null) {
const button = document.getElementById(tertiaryButtonId);
handleButtonAction(button!, tertiaryButtonAction, innerId);
}
}
}

Expand All @@ -276,6 +291,8 @@ const handleButtonAction = (
});
} else if (action === 'download') {
sendMessageToActiveTab('downloadSource');
} else if (action === 'violations_list') {
updateDisplay('violation_list');
}
});
};
Expand Down