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

Dark theme #14

Merged
merged 38 commits into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
43c408f
refactoring svgs into their own directory
Dec 18, 2024
8e540c2
begin dark-theme
Dec 20, 2024
e7a6bcb
updated black theme
Astisme Dec 31, 2024
1fdcbeb
send comment when linter fails
Astisme Dec 31, 2024
4b6821f
fetch branch before switching
Astisme Dec 31, 2024
6993aa6
Fix code scanning alert no. 26: Incomplete regular expression for hos…
Astisme Dec 31, 2024
dddfaf6
changes to cleanupUrl function
Astisme Dec 31, 2024
9b85148
added ready for review
Astisme Dec 31, 2024
0e8a212
collapsed to single step
Astisme Dec 31, 2024
c668ad4
updated types
Astisme Dec 31, 2024
cbd499c
continue-on-error
Astisme Dec 31, 2024
18a8792
deno formatting
invalid-email-address Dec 31, 2024
d0c6f88
check deno task result
Astisme Dec 31, 2024
665e45a
exit with 2
Astisme Dec 31, 2024
bbb244a
added trap
Astisme Dec 31, 2024
dc9d9a5
updated token
Astisme Dec 31, 2024
fe555ce
use github script
Astisme Dec 31, 2024
0f389ef
script instead of run
Astisme Dec 31, 2024
f4eaad3
removed run
Astisme Dec 31, 2024
1923fd6
github-script
Astisme Jan 2, 2025
e240ddf
moved body
Astisme Jan 2, 2025
694b20b
updated to js
Astisme Jan 2, 2025
a477fa9
fixup
Astisme Jan 2, 2025
3a3ba5f
no deno, node
Astisme Jan 2, 2025
cc90212
removed exec import
Astisme Jan 2, 2025
08fb4ef
removed exec
Astisme Jan 2, 2025
d5f7b4b
guess
Astisme Jan 2, 2025
fcf6d93
fix
Astisme Jan 2, 2025
1092a3c
permit write on pull-requests
Astisme Jan 2, 2025
641139e
remove log after checked
Astisme Jan 2, 2025
f9fa254
clean error output
Astisme Jan 2, 2025
0458b94
splitted regex
Astisme Jan 2, 2025
856bff6
run on failure only
Astisme Jan 2, 2025
578431b
str to errorOutput
Astisme Jan 2, 2025
fe23c64
fail after commenting
Astisme Jan 2, 2025
2a2120a
fixed error commented by action
Astisme Jan 2, 2025
f60ebdb
check for problems string to comment
Astisme Jan 2, 2025
80e3dda
update push fmt
Astisme Jan 2, 2025
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
63 changes: 48 additions & 15 deletions .github/workflows/pr-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@ on:
pull_request:
types:
- opened
- edited
- synchronize
- reopened
- ready_for_review
branches:
- main

permissions:
contents: write
pull-requests: write

jobs:
test:
Expand All @@ -24,27 +27,57 @@ jobs:
deno-version: v2.x

- name: Switch to branch
run: git switch "${{ github.head_ref }}"
run: |
git fetch origin "${{ github.head_ref }}"
git switch "${{ github.head_ref }}"

- name: Run linter and capture errors
id: lint
continue-on-error: true
run: |
# Run the Deno linter and capture stderr
deno task lint 2> lint-error.log || true # do not fail

- name: Comment on PR if linter fails
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');

// Read the linter error output
const errorOutput = fs.readFileSync('lint-error.log', 'utf8');
const problemsFoundRegex = /Found [0-9]+ problem(s)?\n/m
if (!errorOutput || !errorOutput.match(problemsFoundRegex)) {
console.log("No lint errors.");
return;
}

// Remove ANSI codes
const ansiRegex = /\x1b\[[0-9;]*m/g;
const cleanErrorOutput = errorOutput.replace(ansiRegex, '');

// Create a comment on the PR with the error message
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `## Linter Failed:\n\n\`\`\`${cleanErrorOutput}\`\`\``
});

// fail due to error found on previous step
process.exit(1);

- name: Run linter
run: deno task lint
- name: Remove lint-error.log
run: rm lint-error.log

- name: Verify formatting
run: deno task fmt

- name: Ensure Changes Exist
run: |
if git diff --exit-code; then
echo "No changes to commit, exiting."
exit 0
fi

- name: Set up Git user
- name: Push fmt changes
run: |
if ! git diff --exit-code; then
git config user.name "github-actions"
git config user.email "[email protected]"

- name: Push fmt changes
run: |
git commit -am "deno formatting"
git push https://x-access-token:${{ github.token }}@github.com/${{ github.repository }} "${{ github.head_ref }}"
fi
25 changes: 18 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@

![Release version](https://img.shields.io/github/manifest-json/v/Astisme/again-why-salesforce?filename=manifest%2Ftemplate-manifest.json&label=Version)
![Last commit](https://img.shields.io/github/last-commit/Astisme/again-why-salesforce?labelColor=black&color=white)
![License](https://img.shields.io/github/license/astisme/again-why-salesforce)
![Code size](https://img.shields.io/github/languages/code-size/astisme/again-why-salesforce)
![License](https://img.shields.io/github/license/Astisme/again-why-salesforce)
![Code size](https://img.shields.io/github/languages/code-size/Astisme/again-why-salesforce)

<!--
![Chrome users](https://img.shields.io/chrome-web-store/users/:storeId)
![Chrome stars](https://img.shields.io/chrome-web-store/stars/:storeId)
![Firefox users](https://img.shields.io/amo/users/:addonId)
![Firefox stars](https://img.shields.io/amo/stars/:addonId)
![GitHub closed issues](https://img.shields.io/github/issues-closed/astisme/again-why-salesforce)
![GitHub stars](https://img.shields.io/github/stars/astisme/again-why-salesforce)
![GitHub closed issues](https://img.shields.io/github/issues-closed/Astisme/again-why-salesforce)
![GitHub stars](https://img.shields.io/github/stars/Astisme/again-why-salesforce)
-->

This extension allows users to create custom tabs in Setup for their most-used settings.
Expand All @@ -25,7 +26,7 @@ This is a fork of [Why Salesforce](https://www.github.com/walters954/why-salesfo

[Install on Chrome Web Store](https://chrome.google.com/webstore/detail/why-salesforce/ghakkjfjpnhpggbkfkeplbefkipfoaod)

### Roadmap
## Roadmap

- [x] Ability to customize tab
- [x] Salesforce SLDS
Expand All @@ -43,8 +44,18 @@ This is a fork of [Why Salesforce](https://www.github.com/walters954/why-salesfo
- [x] Favourite button on current Setup page #12
- [x] Import & Export tabs

Contributors
## Contributing

All contributions are welcome. Please head to the [issues page](https://github.com/Astisme/again-why-salesforce/issues) and pick one unassigned issue to work on.

We'll assign it to you after you comment on it.

## Best Practices

The Best Practices followed by this project can be found [at this link](https://blog.jetbrains.com/webstorm/2024/10/javascript-best-practices-2024/).

## Contributors

- [Warren Walters](https://www.linkedin.com/in/walters954/)
- [Chris Rouse (Firefox port)](https://www.linkedin.com/in/chris-rouse/)
- [Astisme](https://www.github.com/astisme/)
- [Astisme](https://www.github.com/Astisme/)
54 changes: 44 additions & 10 deletions action/basic.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
*, :before, :after {
box-sizing: border-box;
background-color: transparent;
}

html {
Expand All @@ -15,13 +16,14 @@ html {
"Segoe UI Emoji",
"Segoe UI Symbol";
line-height: 1.5;
color: var(--color);
background-color: var(--background-color);
}

body {
padding: 0 !important;
margin: 0;
font-size: 0.8125rem;
background-color: transparent;
}

header {
Expand Down Expand Up @@ -51,6 +53,10 @@ a {
}
}

input {
color: var(--color);
}

.button,
button {
position: relative;
Expand All @@ -60,7 +66,7 @@ button {
padding-bottom: 0;
padding-left: 1rem;
padding-right: 1rem;
border: none;
border: none;
border-radius: 0.25rem;
line-height: 1.875rem;
text-decoration: none;
Expand All @@ -74,19 +80,47 @@ button {
margin-left: 0.25rem;
width: 4rem;
min-height: 2.3rem;
background-color: #e9e9ed;
color: var(--color);
background-color: var(--button-background-color);

&:hover {
background-color: var(--button-background-color-hover);
}
}

.success {
background-color: var(--success);

&:hover {
background-color: #cccccc;
}
&:hover {
background-color: var(--success-hover);
}
}

.error {
background-color: var(--error);

&:hover {
background-color: var(--error-hover);
}
}

.highlight {
background-color: lightblue;
color: var(--background-color);
background-color: var(--highlight);

&:hover {
background-color: skyblue;
}
&:hover {
background-color: var(--highlight-hover);
}
}

:disabled {
color: var(--background-color);
background-color: var(--shade-hover);
cursor: not-allowed !important;

&:hover {
background-color: var(--shade-hover);
}
}

.slds-assistive-text {
Expand Down
1 change: 1 addition & 0 deletions action/logo.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ a {
margin-right: 0.75rem;
display: flex;
align-items: center;
color: var(--color);

& > span {
line-height: 1;
Expand Down
6 changes: 5 additions & 1 deletion action/logo.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
<link rel="stylesheet" href="./variables.css" />
<link rel="stylesheet" href="./logo.css" />
<link rel="stylesheet" href="./basic.css" />
<div>
<a href="https://www.github.com/Astisme/again-why-salesforce">
<span title="Again, Why Salesforce">
<img alt="Again, Why Salesforce logo" src="../assets/icons/awsf-256.png" />
<img
alt="Again, Why Salesforce logo"
src="../assets/icons/awsf-256.png"
/>
<span class="slds-assistive-text">Again, Why Salesforce</span>
</span>
<h2>
Expand Down
17 changes: 11 additions & 6 deletions action/notSalesforceSetup.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="./variables.css" />
<link rel="stylesheet" href="./notSalesforceSetup.css" />
<link rel="stylesheet" href="./basic.css" />
<script src="./notSalesforceSetup.js" type="module"></script>
Expand All @@ -16,12 +17,16 @@
</header>
<div>
<h3>This is not a Salesforce Lightning Setup Page</h3>
<a id="login" class="button" href="https://login.salesforce.com">
Login to Salesforce
</a>
<a id="go-setup" class="hidden highlight button" href="/lightning/setup">
Open Setup
</a>
<a id="login" class="button" href="https://login.salesforce.com">
Login to Salesforce
</a>
<a
id="go-setup"
class="hidden highlight button"
href="/lightning/setup"
>
Open Setup
</a>
</div>
</body>
</html>
77 changes: 39 additions & 38 deletions action/notSalesforceSetup.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
// deno-lint-ignore-file no-window
const authorizedDomainRegex = /^https:\/\/[a-zA-Z0-9.-]+\.lightning\.force\.com\/.*/;
const authorizedDomainRegex =
/^https:\/\/[a-zA-Z0-9.-]+\.lightning\.force\.com\/.*/;
const page = new URLSearchParams(window.location.search).get("url");
const sfsetupTextEl = document.querySelector("h3");

const div = document.createElement("div");
const prefix = document.createTextNode("This is not a ")
const strongEl = document.createElement("strong")
const prefix = document.createTextNode("This is not a ");
const strongEl = document.createElement("strong");
const otherText = document.createTextNode("");

sfsetupTextEl.innerText = "";
Expand All @@ -14,45 +15,45 @@ let insertPrefix = true;
let strongFirst = true;

if (page != null) { // we're in a salesforce page
let domain;
let domain;

try {
domain = new URL(page).origin;
} catch(error){
strongEl.textContent = "Invalid URL";
otherText.textContent = " detected."
insertPrefix = false;
}
try {
domain = new URL(page).origin;
} catch (_) {
strongEl.textContent = "Invalid URL";
otherText.textContent = " detected.";
insertPrefix = false;
}

// domain is null if an error occurred
if(domain != null){
// Validate the domain (make sure it's a Salesforce domain)
if (!authorizedDomainRegex.test(page)) {
strongEl.textContent = "Invalid Salesforce";
otherText.textContent = " domain detected.";
insertPrefix = false;
} else {
// switch which button is shown
document.getElementById("login").classList.add("hidden");
const goSetup = document.getElementById("go-setup");
goSetup.classList.remove("hidden");
// update the button href to use the domain
goSetup.href = `${domain}/lightning/setup/SetupOneHome/home`;
// update the bold on the text
otherText.textContent = "Salesforce Lightning";
strongEl.textContent = " Setup Page"
strongFirst = false;
}
}
// domain is null if an error occurred
if (domain != null) {
// Validate the domain (make sure it's a Salesforce domain)
if (!authorizedDomainRegex.test(page)) {
strongEl.textContent = "Invalid Salesforce";
otherText.textContent = " domain detected.";
insertPrefix = false;
} else {
// switch which button is shown
document.getElementById("login").classList.add("hidden");
const goSetup = document.getElementById("go-setup");
goSetup.classList.remove("hidden");
// update the button href to use the domain
goSetup.href = `${domain}/lightning/setup/SetupOneHome/home`;
// update the bold on the text
otherText.textContent = "Salesforce Lightning";
strongEl.textContent = " Setup Page";
strongFirst = false;
}
}
} else {
strongEl.textContent = "Salesforce Lightning";
otherText.textContent = " Setup Page";
strongEl.textContent = "Salesforce Lightning";
otherText.textContent = " Setup Page";
}
insertPrefix && div.appendChild(prefix);
if(strongFirst){
div.appendChild(strongEl);
div.appendChild(otherText)
if (strongFirst) {
div.appendChild(strongEl);
div.appendChild(otherText);
} else {
div.appendChild(otherText)
div.appendChild(strongEl);
div.appendChild(otherText);
div.appendChild(strongEl);
}
Loading
Loading