Skip to content

Commit

Permalink
Add about page
Browse files Browse the repository at this point in the history
  • Loading branch information
stevencrader committed Aug 22, 2024
1 parent f72cfad commit c255dfb
Show file tree
Hide file tree
Showing 16 changed files with 111 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## 1.4.6

- Fix context menu showing up on all pages instead of only Rumble video pages
- Add About page

## 1.4.5

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,5 +191,5 @@ If you want to support me:
- [PayPal](https://www.paypal.me/stevencrader)
- [$craders](https://www.cash.app/$craders)
- [Venmo](https://venmo.com/code?user_id=467277291978752568&created=1654152122)
- [Twitter (Rant Stats)](https://twitter.com/stevencrader)
- [Twitter (Me)](https://twitter.com/rantstats_com)
- [X (Rant Stats)](https://x.com/stevencrader)
- [X (Me)](https://x.com/rantstats_com)
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"scripts": {
"build": "run-p -cln 'build:*'",
"build:webpack": "webpack --mode=development",
"build:sass": "sass src/styles.scss:output/styles.css src/pages/rants/rants.scss:output/pages/rants/rants.css src/pages/pages.scss:output/pages/pages.css src/pages/options/options.scss:output/pages/options/options.css src/components/rants/rants.scss:output/components/rants/rants.css src/components/rants/rant.scss:output/components/rants/rant.css src/components/open-chat/open-chat.scss:output/components/open-chat/open-chat.css",
"build:sass": "sass src/styles.scss:output/styles.css src/pages/rants/rants.scss:output/pages/rants/rants.css src/pages/pages.scss:output/pages/pages.css src/pages/options/options.scss:output/pages/options/options.css src/pages/about/about.scss:output/pages/about/about.css src/components/rants/rants.scss:output/components/rants/rants.css src/components/rants/rant.scss:output/components/rants/rant.css src/components/open-chat/open-chat.scss:output/components/open-chat/open-chat.css",
"watch": "run-p -cln 'watch:*'",
"watch:webpack:": "yarn build:webpack --watch",
"watch:sass": "yarn build:sass --watch",
Expand All @@ -21,7 +21,7 @@
"build-release": "run-p -cln 'build-release:*'",
"build-release:lint": "yarn lint",
"build-release:js": "yarn build --mode=production",
"build-release:sass": "sass --style=compressed src/styles.scss output/styles.css"
"build-release:sass": "sass --style=compressed src/styles.scss:output/styles.css src/pages/rants/rants.scss:output/pages/rants/rants.css src/pages/pages.scss:output/pages/pages.css src/pages/options/options.scss:output/pages/options/options.css src/pages/about/about.scss:output/pages/about/about.css src/components/rants/rants.scss:output/components/rants/rants.css src/components/rants/rant.scss:output/components/rants/rant.css src/components/open-chat/open-chat.scss:output/components/open-chat/open-chat.css"
},
"repository": {
"type": "git",
Expand Down
17 changes: 17 additions & 0 deletions src/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,20 @@ const handleOpenRantsPage = (): void => {
)
}

/**
* Handle receiving message {@link Messages.OPEN_ABOUT}
*
* Opens about page
*/
const handleOpenAboutPage = (): void => {
chrome.tabs.create(
{
url: "pages/about/about.html",
},
() => {},
)
}

/**
* Handle receiving message {@link Messages.PAGE_LOADED}
*
Expand Down Expand Up @@ -122,6 +136,9 @@ chrome.runtime.onMessage.addListener((message: Message, _sender, sendResponse) =
case Messages.OPEN_RANTS:
handleOpenRantsPage()
break
case Messages.OPEN_ABOUT:
handleOpenAboutPage()
break
case Messages.PAGE_LOADED:
handlePageLoaded(message.data.tab as string)
break
Expand Down
7 changes: 7 additions & 0 deletions src/components/events/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ export const triggerOpenRantsPage = (): void => {
sendAction(Messages.OPEN_RANTS)
}

/**
* Send Message to open about page
*/
export const triggerOpenAboutPage = (): void => {
sendAction(Messages.OPEN_ABOUT)
}

/**
* Send Message with updated Options
* @param options updated option values
Expand Down
1 change: 1 addition & 0 deletions src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"components/open-chat/open-chat.css",
"components/rants/rants.css",
"components/rants/rant.css",
"pages/about/about.css",
"pages/options/options.css",
"pages/rants/rants.css"
],
Expand Down
33 changes: 33 additions & 0 deletions src/pages/about/about.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!doctype html>
<html class="rantstats">
<head>
<title>About | RantStats Extension for Rumble.com</title>

<!--suppress HtmlUnknownTarget -->
<link rel="stylesheet" type="text/css" href="about.css" />
</head>

<body id="about">
<header>
<h1>About</h1>
</header>

<main>
<p>If you want to support me:</p>
<ul>
<li><a href="https://www.paypal.me/stevencrader" target="_blank">PayPal</a></li>
<li><a href="https://www.cash.app/$craders" target="_blank">$craders</a></li>
<li>
<a href="https://venmo.com/code?user_id=467277291978752568&created=1654152122" target="_blank"
>Venmo</a
>
</li>
<li><a href="https://x.com/stevencrader" target="_blank">X (Rant Stats)</a></li>
<li><a href="https://x.com/rantstats_com" target="_blank">X (Me)</a></li>
</ul>
</main>

<!--suppress HtmlUnknownTarget -->
<script src="about.js"></script>
</body>
</html>
11 changes: 11 additions & 0 deletions src/pages/about/about.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@import "../pages";

#about {
p,
a {
font-size: 1.5em;
}
}

html.theme-dark {
}
23 changes: 23 additions & 0 deletions src/pages/about/about.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { registerTab } from "../../components/events/events"
import { registerSystemColorSchemeWatcher, updateTheme, updateThemeStyle } from "../../theme"
import { Message, Messages } from "../../types/messages"
import { Theme } from "../../types/option-types"

chrome.runtime.onMessage.addListener((message: Message, _sender, sendResponse) => {
if (message.action === Messages.RUMBLE_THEME_CHANGED_TAB) {
updateThemeStyle(message.data.theme as Theme)
}
sendResponse({ done: true })
})

/**
* Initialize the page
*/
const populateView = async (): Promise<void> => {
registerSystemColorSchemeWatcher()
await updateTheme()
}

populateView().then()

registerTab()
3 changes: 1 addition & 2 deletions src/pages/options/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,7 @@ <h1>RantStats Extension Options</h1>
</div>

<div class="row">
<p><a href="https://rantstats.com" target="_blank">RantStats.com</a></p>
<p><a href="https://twitter.com/stevencrader" target="_blank">By Steven Crader</a></p>
<button id="open-about">About</button>
</div>
</footer>

Expand Down
1 change: 1 addition & 0 deletions src/pages/options/options.scss
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@

footer {
font-size: 10px;
padding-bottom: 10px;

.clear-section {
font-size: 12px;
Expand Down
3 changes: 2 additions & 1 deletion src/pages/options/options.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { cleanHistory, getOptions, getUsage, updateOptions } from "../../cache"
import { optionsSaved, registerTab, triggerOpenRantsPage } from "../../components/events/events"
import { optionsSaved, registerTab, triggerOpenAboutPage, triggerOpenRantsPage } from "../../components/events/events"
import { handleUpdateOptions } from "../../message-options"
import { registerSystemColorSchemeWatcher, updateTheme, updateThemeStyle } from "../../theme"
import { CONSTS } from "../../types/consts"
Expand Down Expand Up @@ -203,6 +203,7 @@ bytesUseSpan.addEventListener("change", optionChanged)
alternateColorsCheckbox.addEventListener("change", optionChanged)
document.getElementById("clear").addEventListener("click", clearOptions)
document.getElementById("open-rants").addEventListener("click", triggerOpenRantsPage)
document.getElementById("open-about").addEventListener("click", triggerOpenAboutPage)

document.querySelectorAll(".has-sub-options").forEach((optionDiv: HTMLDivElement) => {
optionDiv.querySelectorAll(".option-row .selector input").forEach((checkbox) => {
Expand Down
3 changes: 1 addition & 2 deletions src/pages/rants/rants.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ <h1>Cached Rants</h1>
</div>

<div class="row">
<p><a href="https://rantstats.com" target="_blank">RantStats.com</a></p>
<p><a href="https://twitter.com/stevencrader" target="_blank">By Steven Crader</a></p>
<button id="open-about">About</button>
</div>
</footer>

Expand Down
4 changes: 3 additions & 1 deletion src/pages/rants/rants.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { cleanHistory, getAllStreams, getOptions, getStream, removeStream } from "../../cache"
import { registerTab } from "../../components/events/events"
import { registerTab, triggerOpenAboutPage } from "../../components/events/events"
import { displayCachedRants } from "../../components/rants/cached-rants"
import { parseLevels } from "../../components/rants/levels"
import { clearDisplayedMessages, setLastSortOrder, updateTotalText } from "../../components/rants/rant"
Expand Down Expand Up @@ -262,3 +262,5 @@ document.addEventListener("click", async (event) => {
})

registerTab()

document.getElementById("open-about").addEventListener("click", triggerOpenAboutPage)
1 change: 1 addition & 0 deletions src/types/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export enum Messages {
OPEN_OPTIONS,
OPTIONS_SAVED,
OPEN_RANTS,
OPEN_ABOUT,
PAGE_LOADED,
PAGE_UNLOADED,
OPTIONS_SAVED_TAB,
Expand Down
5 changes: 5 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ module.exports = (env, argv) => {
background: "./src/background.ts",
options: "./src/pages/options/options.ts",
rants: "./src/pages/rants/rants.ts",
about: "./src/pages/about/about.ts",
},
output: {
path: path.resolve(__dirname, "./output"),
Expand Down Expand Up @@ -53,6 +54,10 @@ module.exports = (env, argv) => {
from: "src/pages/rants/rants.html",
to: "pages/rants",
},
{
from: "src/pages/about/about.html",
to: "pages/about",
},
],
}),
],
Expand Down

0 comments on commit c255dfb

Please sign in to comment.