fix: add copy-to-clipboard feedback and neutralize dark mode background tint

Copy source button now shows a checkmark and "Copied" text for 2s
after clicking. Dark mode email background blend target changed to
perfectly neutral gray (R=G=B) to eliminate perceived color cast on
certain displays.
This commit is contained in:
Matthieu MALVACHE
2026-03-23 15:14:14 +01:00
parent 3ba5cf16c3
commit d3ef46f760
2 changed files with 7 additions and 5 deletions
+5 -3
View File
@@ -425,13 +425,15 @@ export function EmailViewer({
return source;
};
const [sourceCopied, setSourceCopied] = useState(false);
const copySourceToClipboard = async () => {
if (!email) return;
try {
const source = generateEmailSource(email);
await navigator.clipboard.writeText(source);
// Could add a toast notification here
setSourceCopied(true);
setTimeout(() => setSourceCopied(false), 2000);
} catch {
return;
}
@@ -1753,8 +1755,8 @@ export function EmailViewer({
onClick={copySourceToClipboard}
className="flex items-center gap-1.5"
>
<Copy className="w-4 h-4" />
{t('copy_source')}
{sourceCopied ? <Check className="w-4 h-4 text-green-600 dark:text-green-400" /> : <Copy className="w-4 h-4" />}
{sourceCopied ? tCommon('copied') : t('copy_source')}
</Button>
<Button
variant="ghost"
+2 -2
View File
@@ -155,7 +155,7 @@ export function transformBgColorForDarkMode(colorString: string): string {
if (luminance < 0.2) return colorString;
const blendFactor = Math.min(0.9, (luminance - 0.2) * 1.125);
const darkR = 30, darkG = 31, darkB = 38;
const darkR = 35, darkG = 35, darkB = 35;
const r = Math.max(0, Math.round(rgb.r + (darkR - rgb.r) * blendFactor));
const g = Math.max(0, Math.round(rgb.g + (darkG - rgb.g) * blendFactor));
@@ -244,7 +244,7 @@ export function generateIframeStylesheet(): string {
@media (prefers-color-scheme: dark) {
body {
color: #e2e8f0;
background: #1e1f26;
background: #232323;
}
a { color: #60a5fa; }
img { opacity: 0.9; }