Skip to content

Commit

Permalink
Added action that forces prettier (#10583)
Browse files Browse the repository at this point in the history
  • Loading branch information
OhMyGuus authored Dec 25, 2023
1 parent eda9ed7 commit a1e8cf0
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 21 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/prettier.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Prettier

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
prettier:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install dependencies
run: npm ci

- name: Run Prettier
run: npm run prettier

- name: Check for changes
id: changes
run: |
git diff --name-only --exit-code HEAD^ HEAD | grep -vE 'package-lock.json'
- name: Fail if changes found
run: |
if [ -n "${{ steps.changes.outputs.stdout }}" ]; then
echo "There are changes after running Prettier. Please run Prettier locally and commit the changes.";
exit 1;
fi
27 changes: 18 additions & 9 deletions src/data/menu/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,25 @@ <h3>
<span id="hostname">example.com</span>
</h3>
<select id="report_issue_type">
<option value="general" data-translate="generalIssueOption">
</option>
<option value="scrollbar" data-translate="scrollbarIssueOption">
</option>
<option value="modal" data-translate="modalIssueOption">
</option>
<option value="general" data-translate="generalIssueOption"></option>
<option
value="scrollbar"
data-translate="scrollbarIssueOption"
></option>
<option value="modal" data-translate="modalIssueOption"></option>
</select>
<label id="general_issue_description" data-translate="reportAnonNotes"></label>
<label id="scrollbar_issue_description" data-translate="scrollbarIssueDescription"></label>
<label id="modal_issue_description" data-translate="modalIssueDescription"></label>
<label
id="general_issue_description"
data-translate="reportAnonNotes"
></label>
<label
id="scrollbar_issue_description"
data-translate="scrollbarIssueDescription"
></label>
<label
id="modal_issue_description"
data-translate="modalIssueDescription"
></label>
<textarea id="report-notes"></textarea>
<button id="report_anon_send" data-translate="reportAnonSend"></button>
<button
Expand Down
26 changes: 16 additions & 10 deletions src/data/menu/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,24 @@ document.getElementById("report_anon").addEventListener("click", function (e) {
});

issueTypeSelect.addEventListener("change", () => {
let issueTypeValue = issueTypeSelect.options[issueTypeSelect.selectedIndex].value;

document.querySelectorAll("label[id*='issue_description']").forEach((label) => {
label.style.display = "none";
});

reportNotesTextarea.style.display = (issueTypeValue == "general") ? "block" : "none";
document.getElementById(`${issueTypeValue}_issue_description`).style.display = "block";
let issueTypeValue =
issueTypeSelect.options[issueTypeSelect.selectedIndex].value;

document
.querySelectorAll("label[id*='issue_description']")
.forEach((label) => {
label.style.display = "none";
});

reportNotesTextarea.style.display =
issueTypeValue == "general" ? "block" : "none";
document.getElementById(`${issueTypeValue}_issue_description`).style.display =
"block";
});

document.getElementById("report_anon_send").addEventListener("click", () => {
let issueTypeValue = issueTypeSelect.options[issueTypeSelect.selectedIndex].value;
let issueTypeValue =
issueTypeSelect.options[issueTypeSelect.selectedIndex].value;

switchMenu("menu_loading");
chrome.runtime.sendMessage(
Expand All @@ -79,7 +85,7 @@ document.getElementById("report_anon_send").addEventListener("click", () => {
tabId: currentTab.id,
anon: true,
issueType: issueTypeValue,
notes: (issueTypeValue == "general") ? reportNotesTextarea.value : null,
notes: issueTypeValue == "general" ? reportNotesTextarea.value : null,
},
(message) => {
if (message.error) {
Expand Down
5 changes: 3 additions & 2 deletions src/data/menu/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,12 @@ h3 {
margin-top: 0px;
}

#report_issue_type, label[id*='issue_description'] {
#report_issue_type,
label[id*="issue_description"] {
margin-bottom: 5px;
}

label[id*='issue_description'] {
label[id*="issue_description"] {
color: rgb(43, 43, 43);
font-style: italic;
display: none;
Expand Down

0 comments on commit a1e8cf0

Please sign in to comment.