Skip to content

Commit 78c70a2

Browse files
authored
Merge pull request #25 from lirena00/new_update
update v1.4.1
2 parents 285b0c1 + d515946 commit 78c70a2

File tree

11 files changed

+445
-191
lines changed

11 files changed

+445
-191
lines changed

README.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
A sleek browser extension that turns your web browsing experience into grayscale, helping reduce digital distractions and avoid doomscrolling.
44

5-
![Version](https://img.shields.io/badge/version-1.4.0-black)
5+
![Version](https://img.shields.io/badge/version-1.4.1-black)
66
![License](https://img.shields.io/badge/license-MIT-black)
77

88
<p align="center">
@@ -19,8 +19,13 @@ A sleek browser extension that turns your web browsing experience into grayscale
1919
- **One-Click Toggle** - Instantly switch between color and grayscale modes
2020
- **Intensity Control** - Fine-tune the grayscale effect (0-100%)
2121
- **Site Exclusions** - Maintain a blacklist of sites where color should remain enabled
22+
- **Smart Scheduling** - Automatically enable/disable monochrome mode at specific times
2223
- **Real-time Updates** - Changes apply instantly without page refresh
23-
- **Minimal Interface** - Clean, modern UI
24+
- **Backup & Restore** - Export and import your settings configuration
25+
- **Current Site Management** - Quick add/remove current website to exclusions
26+
- **Fullscreen Support** - Seamlessly works with fullscreen content and videos
27+
- **Search & Filter** - Easily find and manage excluded sites with search functionality
28+
- **Minimal Interface** - Clean, modern UI with intuitive controls
2429

2530
## 🛠️ **Development**
2631

@@ -31,13 +36,13 @@ Clone the repository and install dependencies:
3136
```bash
3237
git clone https://github.com/your-username/monochromate.git
3338
cd monochromate
34-
npm install
39+
pnpm install
3540
```
3641

3742
Start the development server with:
3843

3944
```bash
40-
npm dev
45+
pnpm dev
4146
```
4247

4348
This will build the extension in **watch mode**, so changes automatically reflect when reloaded in the browser.
@@ -47,8 +52,8 @@ This will build the extension in **watch mode**, so changes automatically reflec
4752
To generate an optimized build:
4853

4954
```bash
50-
npm zip
51-
npm zip:firefox
55+
pnpm zip
56+
pnpm zip:firefox
5257
```
5358

5459
This creates a final version inside the `dist/` folder, ready for submission to the Chrome Web Store and Mozilla Add-ons.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "monochromate",
33
"description": "An extension that greyscales the webpage to reduce doomscrolling",
44
"private": true,
5-
"version": "1.4.0",
5+
"version": "1.4.1",
66
"type": "module",
77
"scripts": {
88
"dev": "wxt",

src/components/BackupCard.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1+
import { settings } from "#imports";
12
import { Upload, Download, Check } from "lucide-react";
23
import { useState } from "react";
34

45
export default function Backup() {
56
const handleExport = async () => {
67
try {
7-
const data = await browser.storage.local.get("Monofilter");
8-
const settings = data.Monofilter;
8+
const data = await settings.getValue();
99

10-
if (settings) {
10+
if (data) {
1111
const exportData = {
1212
version: browser.runtime.getManifest().version,
1313
timestamp: new Date().toISOString(),
14-
settings: settings,
14+
settings: data,
1515
};
1616

1717
const blob = new Blob([JSON.stringify(exportData, null, 2)], {
@@ -41,7 +41,7 @@ export default function Backup() {
4141
const importData = JSON.parse(text);
4242

4343
if (importData.settings) {
44-
await browser.storage.local.set({ Monofilter: importData.settings });
44+
await settings.setValue(importData.settings);
4545
console.log("Settings imported successfully");
4646
}
4747
} catch (error) {

src/components/BlacklistCard.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from "react";
22
import { Shield } from "lucide-react";
33

4-
interface BlacklistCardCardProps {
4+
interface BlacklistCardProps {
55
currentUrl: string;
66
blacklist: string[];
77
isCurrentUrlBlacklisted: boolean;
@@ -10,7 +10,7 @@ interface BlacklistCardCardProps {
1010
onManageAllSites: () => void;
1111
}
1212

13-
const BlacklistCardCard: React.FC<BlacklistCardCardProps> = ({
13+
const BlacklistCardCard: React.FC<BlacklistCardProps> = ({
1414
currentUrl,
1515
blacklist,
1616
isCurrentUrlBlacklisted,

src/components/BlacklistManagement.tsx

Lines changed: 64 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from "react";
2-
import { ArrowLeft, Search, AlertCircle, X } from "lucide-react";
2+
import { ArrowLeft, Search, AlertCircle, X, Shield } from "lucide-react";
33
import Footer from "./Footer";
44

55
interface BlacklistManagementProps {
@@ -24,38 +24,36 @@ const BlacklistManagement: React.FC<BlacklistManagementProps> = ({
2424
onRemoveSite,
2525
}) => {
2626
return (
27-
<div className="flex flex-col min-h-[700px]">
28-
<div className="flex items-center gap-3 mb-4">
27+
<div className="flex flex-col h-[700px] overflow-hidden">
28+
<div className="flex items-center gap-3 mb-6">
2929
<button
3030
onClick={onReturnToMain}
31-
className="p-1 rounded-full hover:bg-neutral-100"
31+
className="p-1 rounded-full hover:bg-neutral-100 flex items-center justify-center"
3232
>
33-
<ArrowLeft size={18} />
33+
<ArrowLeft size={24} />
3434
</button>
35-
<h1 className="text-xl font-bold">Manage Excluded Sites</h1>
35+
<h1 className="text-xl font-bold text-neutral-800">
36+
Manage Excluded Sites
37+
</h1>
3638
</div>
3739

38-
<div className="relative mb-3">
39-
<div className="absolute left-3 top-1/2 -translate-y-1/2 text-neutral-500">
40-
<Search size={15} />
40+
{/* Current Site Card */}
41+
<div className="bg-neutral-100 border-neutral-300 border rounded-xl p-4 hover:border-neutral-400 transition-all mb-4">
42+
<div className="flex items-center gap-3 mb-3">
43+
<div className="text-neutral-700">
44+
<Shield size={20} />
45+
</div>
46+
<div>
47+
<h2 className="font-semibold text-neutral-800">Current Site</h2>
48+
<p className="text-sm text-neutral-500 italic">
49+
Manage current website
50+
</p>
51+
</div>
4152
</div>
42-
<input
43-
type="text"
44-
className="w-full pl-9 pr-3 py-2 bg-white border border-neutral-200 rounded-lg text-sm"
45-
placeholder="Search excluded sites..."
46-
value={searchTerm}
47-
onChange={(e) => onSearchChange(e.target.value)}
48-
autoFocus
49-
/>
50-
</div>
5153

52-
<div className="mb-4">
53-
<h2 className="text-sm font-medium text-neutral-500 mb-2">
54-
Current Site
55-
</h2>
5654
<div className="bg-white rounded-lg border border-neutral-200 p-3 flex justify-between items-center">
5755
<div className="flex items-center gap-2">
58-
<div className="w-5 h-5 bg-neutral-200 rounded-full overflow-hidden">
56+
<div className="w-4 h-4 bg-neutral-200 rounded-full overflow-hidden">
5957
{currentUrl && (
6058
<img
6159
src={`https://www.google.com/s2/favicons?domain=${currentUrl}&sz=64`}
@@ -72,34 +70,67 @@ const BlacklistManagement: React.FC<BlacklistManagementProps> = ({
7270
{isCurrentUrlBlacklisted ? (
7371
<button
7472
onClick={() => onRemoveSite(currentUrl)}
75-
className="text-sm px-3 py-1 bg-neutral-200 text-neutral-700 rounded-sm hover:bg-neutral-300 transition-colors"
73+
className="text-xs px-2 py-1 bg-neutral-200 text-neutral-700 rounded-sm hover:bg-neutral-300 transition-colors"
7674
>
7775
Remove
7876
</button>
7977
) : (
8078
<button
8179
onClick={onAddCurrentSite}
82-
className="text-sm px-3 py-1 bg-neutral-900 text-white rounded-sm hover:bg-neutral-800 transition-colors flex items-center gap-1"
80+
className="text-xs px-2 py-1 bg-neutral-900 text-white rounded-sm hover:bg-neutral-800 transition-colors"
8381
>
8482
Exclude
8583
</button>
8684
)}
8785
</div>
8886
</div>
8987

90-
<div className="flex-1 overflow-hidden flex flex-col min-h-0">
91-
<h2 className="text-sm font-medium text-neutral-500 mb-2">
92-
All Excluded Sites
93-
</h2>
94-
<div className="flex-1 overflow-y-auto bg-white rounded-lg border border-neutral-200">
88+
{/* All Excluded Sites Card */}
89+
<div className="bg-neutral-100 border-neutral-300 border rounded-xl p-4 hover:border-neutral-400 transition-all flex-1 flex flex-col min-h-0">
90+
<div className="flex items-center gap-3 mb-3">
91+
<div className="text-neutral-700">
92+
<Search size={20} />
93+
</div>
94+
<div>
95+
<h2 className="font-semibold text-neutral-800">
96+
All Excluded Sites
97+
{filteredBlacklist.length > 0 && (
98+
<span className="ml-2 px-2 py-0.5 text-xs bg-neutral-200 rounded-full">
99+
{filteredBlacklist.length}
100+
</span>
101+
)}
102+
</h2>
103+
<p className="text-sm text-neutral-500 italic">
104+
Search and manage all excluded sites
105+
</p>
106+
</div>
107+
</div>
108+
109+
{/* Search Bar */}
110+
<div className="relative mb-3">
111+
<div className="absolute left-3 top-1/2 -translate-y-1/2 text-neutral-500">
112+
<Search size={15} />
113+
</div>
114+
<input
115+
type="text"
116+
className="w-full pl-9 pr-3 py-2 bg-white border border-neutral-200 rounded-lg text-sm hover:border-neutral-400 transition-all focus:outline-none focus:border-neutral-400"
117+
placeholder="Search excluded sites..."
118+
value={searchTerm}
119+
onChange={(e) => onSearchChange(e.target.value)}
120+
autoFocus
121+
/>
122+
</div>
123+
124+
{/* Sites List */}
125+
<div className="flex-1 overflow-y-auto bg-white rounded-lg border border-neutral-200 min-h-0">
95126
{filteredBlacklist.length > 0 ? (
96127
filteredBlacklist.map((site) => (
97128
<div
98129
key={site}
99-
className="flex justify-between items-center py-3 px-3 border-b border-neutral-200 last:border-0 hover:bg-neutral-50"
130+
className="flex justify-between items-center py-3 px-3 border-b border-neutral-200 last:border-0 hover:bg-neutral-50 transition-colors"
100131
>
101132
<div className="flex items-center gap-2">
102-
<div className="w-5 h-5 bg-neutral-200 rounded-full overflow-hidden">
133+
<div className="w-4 h-4 bg-neutral-200 rounded-full overflow-hidden">
103134
<img
104135
src={`https://www.google.com/s2/favicons?domain=${site}&sz=64`}
105136
alt=""
@@ -110,7 +141,7 @@ const BlacklistManagement: React.FC<BlacklistManagementProps> = ({
110141
</div>
111142
<button
112143
onClick={() => onRemoveSite(site)}
113-
className="text-neutral-500 hover:text-red-500"
144+
className="text-neutral-500 hover:text-red-500 transition-colors"
114145
>
115146
<X size={15} />
116147
</button>

src/components/WarningCard.tsx

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { AlertCircle } from "lucide-react";
2+
interface WarningCardProps {
3+
currentUrl: string;
4+
}
5+
6+
const WarningCard: React.FC<WarningCardProps> = ({ currentUrl }) => {
7+
return (
8+
<>
9+
{currentUrl &&
10+
(currentUrl.includes("chromewebstore.google.com") ||
11+
currentUrl.includes("addons.mozilla.org") ||
12+
currentUrl.includes("microsoftedge.microsoft.com")) && (
13+
<div className="bg-amber-100 border-amber-300 border rounded-xl p-4 hover:border-amber-400 transition-all">
14+
<div className="flex items-center gap-3">
15+
<div className="text-amber-700">
16+
<AlertCircle size={20} />
17+
</div>
18+
<div>
19+
<h2 className="font-semibold text-amber-800">
20+
Limited Functionality
21+
</h2>
22+
<p className="text-sm text-amber-700 italic">
23+
Monochromate cannot modify browser extension/addon pages due
24+
to browser security restrictions. Try visiting a regular
25+
website instead.
26+
</p>
27+
</div>
28+
</div>
29+
</div>
30+
)}
31+
</>
32+
);
33+
};
34+
35+
export default WarningCard;

0 commit comments

Comments
 (0)