chore:little fixes and formating and linting and patches
This commit is contained in:
@@ -6,7 +6,11 @@ export function Button({
|
||||
href,
|
||||
children,
|
||||
style,
|
||||
}: { href: string; children: React.ReactNode; style?: React.CSSProperties }) {
|
||||
}: {
|
||||
href: string;
|
||||
children: React.ReactNode;
|
||||
style?: React.CSSProperties;
|
||||
}) {
|
||||
return (
|
||||
<EmailButton
|
||||
href={href}
|
||||
|
||||
@@ -7,7 +7,6 @@ import {
|
||||
Section,
|
||||
Text,
|
||||
} from '@react-email/components';
|
||||
import React from 'react';
|
||||
|
||||
const baseUrl = 'https://openpanel.dev';
|
||||
|
||||
@@ -16,7 +15,7 @@ export function Footer({ unsubscribeUrl }: { unsubscribeUrl?: string }) {
|
||||
<>
|
||||
<Hr />
|
||||
<Section className="w-full p-6">
|
||||
<Text className="text-[21px] font-regular" style={{ margin: 0 }}>
|
||||
<Text className="font-regular text-[21px]" style={{ margin: 0 }}>
|
||||
An open-source alternative to Mixpanel
|
||||
</Text>
|
||||
|
||||
@@ -26,40 +25,40 @@ export function Footer({ unsubscribeUrl }: { unsubscribeUrl?: string }) {
|
||||
<Column className="w-8">
|
||||
<Link href="https://git.new/openpanel">
|
||||
<Img
|
||||
alt="OpenPanel on Github"
|
||||
height="22"
|
||||
src={`${baseUrl}/icons/github.png`}
|
||||
width="22"
|
||||
height="22"
|
||||
alt="OpenPanel on Github"
|
||||
/>
|
||||
</Link>
|
||||
</Column>
|
||||
<Column className="w-8">
|
||||
<Link href="https://x.com/openpaneldev">
|
||||
<Img
|
||||
alt="OpenPanel on X"
|
||||
height="22"
|
||||
src={`${baseUrl}/icons/x.png`}
|
||||
width="22"
|
||||
height="22"
|
||||
alt="OpenPanel on X"
|
||||
/>
|
||||
</Link>
|
||||
</Column>
|
||||
<Column className="w-8">
|
||||
<Link href="https://go.openpanel.dev/discord">
|
||||
<Img
|
||||
alt="OpenPanel on Discord"
|
||||
height="22"
|
||||
src={`${baseUrl}/icons/discord.png`}
|
||||
width="22"
|
||||
height="22"
|
||||
alt="OpenPanel on Discord"
|
||||
/>
|
||||
</Link>
|
||||
</Column>
|
||||
<Column className="w-auto">
|
||||
<Link href="mailto:hello@openpanel.dev">
|
||||
<Img
|
||||
alt="Contact OpenPanel with email"
|
||||
height="22"
|
||||
src={`${baseUrl}/icons/email.png`}
|
||||
width="22"
|
||||
height="22"
|
||||
alt="Contact OpenPanel with email"
|
||||
/>
|
||||
</Link>
|
||||
</Column>
|
||||
|
||||
@@ -22,39 +22,39 @@ export function Layout({ children, unsubscribeUrl }: Props) {
|
||||
<Tailwind>
|
||||
<head>
|
||||
<Font
|
||||
fontFamily="Geist"
|
||||
fallbackFontFamily="Helvetica"
|
||||
fontFamily="Geist"
|
||||
fontStyle="normal"
|
||||
fontWeight={400}
|
||||
webFont={{
|
||||
url: 'https://cdn.jsdelivr.net/npm/@fontsource/geist-sans@5.0.1/files/geist-sans-latin-400-normal.woff2',
|
||||
format: 'woff2',
|
||||
}}
|
||||
fontWeight={400}
|
||||
fontStyle="normal"
|
||||
/>
|
||||
|
||||
<Font
|
||||
fontFamily="Geist"
|
||||
fallbackFontFamily="Helvetica"
|
||||
fontFamily="Geist"
|
||||
fontStyle="normal"
|
||||
fontWeight={500}
|
||||
webFont={{
|
||||
url: 'https://cdn.jsdelivr.net/npm/@fontsource/geist-sans@5.0.1/files/geist-sans-latin-500-normal.woff2',
|
||||
format: 'woff2',
|
||||
}}
|
||||
fontWeight={500}
|
||||
fontStyle="normal"
|
||||
/>
|
||||
</head>
|
||||
<Body className="bg-[#fff] my-auto mx-auto font-sans">
|
||||
<Body className="mx-auto my-auto bg-[#fff] font-sans">
|
||||
<Container
|
||||
className="border-transparent md:border-[#E8E7E1] my-[40px] mx-auto max-w-[600px]"
|
||||
className="mx-auto my-[40px] max-w-[600px] border-transparent md:border-[#E8E7E1]"
|
||||
style={{ borderStyle: 'solid', borderWidth: 1 }}
|
||||
>
|
||||
<Section className="p-6">
|
||||
<Img
|
||||
src={'https://openpanel.dev/logo.png'}
|
||||
width="80"
|
||||
height="80"
|
||||
alt="OpenPanel Logo"
|
||||
height="80"
|
||||
src={'https://openpanel.dev/logo.png'}
|
||||
style={{ borderRadius: 4 }}
|
||||
width="80"
|
||||
/>
|
||||
</Section>
|
||||
<Section className="p-6">{children}</Section>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { Button, Link, Text } from '@react-email/components';
|
||||
import React from 'react';
|
||||
import { z } from 'zod';
|
||||
import { Layout } from '../components/layout';
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { Button, Link, Text } from '@react-email/components';
|
||||
import React from 'react';
|
||||
import { z } from 'zod';
|
||||
import { Layout } from '../components/layout';
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { Link, Text } from '@react-email/components';
|
||||
import React from 'react';
|
||||
import { Text } from '@react-email/components';
|
||||
import { z } from 'zod';
|
||||
import { Layout } from '../components/layout';
|
||||
import { List } from '../components/list';
|
||||
@@ -51,8 +50,8 @@ export function OnboardingDashboards({
|
||||
</Text>
|
||||
<span style={{ margin: '0 -20px', display: 'block' }}>
|
||||
<img
|
||||
src="https://openpanel.dev/_next/image?url=%2Fscreenshots%2Fdashboard-dark.webp&w=3840&q=75"
|
||||
alt="Dashboard"
|
||||
src="https://openpanel.dev/_next/image?url=%2Fscreenshots%2Fdashboard-dark.webp&w=3840&q=75"
|
||||
style={{
|
||||
width: '100%',
|
||||
height: 'auto',
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { Link, Text } from '@react-email/components';
|
||||
import React from 'react';
|
||||
import { z } from 'zod';
|
||||
import { Layout } from '../components/layout';
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { Text } from '@react-email/components';
|
||||
import React from 'react';
|
||||
import { z } from 'zod';
|
||||
import { Button } from '../components/button';
|
||||
import { Layout } from '../components/layout';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { Text } from '@react-email/components';
|
||||
import React from 'react';
|
||||
import { z } from 'zod';
|
||||
import { Button } from '../components/button';
|
||||
import { Layout } from '../components/layout';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { Heading, Link, Text } from '@react-email/components';
|
||||
import React from 'react';
|
||||
import { Link, Text } from '@react-email/components';
|
||||
import { z } from 'zod';
|
||||
import { Layout } from '../components/layout';
|
||||
import { List } from '../components/list';
|
||||
@@ -32,14 +31,14 @@ export function OnboardingWelcome({
|
||||
<List
|
||||
items={[
|
||||
<Link
|
||||
key=""
|
||||
href={'https://openpanel.dev/docs/get-started/install-openpanel'}
|
||||
key=""
|
||||
>
|
||||
Install tracking script
|
||||
</Link>,
|
||||
<Link
|
||||
key=""
|
||||
href={'https://openpanel.dev/docs/get-started/track-events'}
|
||||
key=""
|
||||
>
|
||||
Start tracking your events
|
||||
</Link>,
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { Text } from '@react-email/components';
|
||||
import React from 'react';
|
||||
import { z } from 'zod';
|
||||
import { Layout } from '../components/layout';
|
||||
import { List } from '../components/list';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { Button, Hr, Link, Text } from '@react-email/components';
|
||||
import React from 'react';
|
||||
import { z } from 'zod';
|
||||
import { Layout } from '../components/layout';
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import React from 'react';
|
||||
import { db } from '@openpanel/db';
|
||||
import { Resend } from 'resend';
|
||||
import type { z } from 'zod';
|
||||
|
||||
import { db } from '@openpanel/db';
|
||||
import { type TemplateKey, type Templates, templates } from './emails';
|
||||
import { getUnsubscribeUrl } from './unsubscribe';
|
||||
|
||||
@@ -18,7 +16,7 @@ export async function sendEmail<T extends TemplateKey>(
|
||||
options: {
|
||||
to: string;
|
||||
data: z.infer<Templates[T]['schema']>;
|
||||
},
|
||||
}
|
||||
) {
|
||||
const { to, data } = options;
|
||||
const template = templates[templateKey];
|
||||
@@ -41,7 +39,7 @@ export async function sendEmail<T extends TemplateKey>(
|
||||
|
||||
if (unsubscribed) {
|
||||
console.log(
|
||||
`Skipping email to ${to} - unsubscribed from ${template.category}`,
|
||||
`Skipping email to ${to} - unsubscribed from ${template.category}`
|
||||
);
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,10 @@ const SECRET =
|
||||
process.env.SECRET ||
|
||||
'default-secret-change-in-production';
|
||||
|
||||
export function generateUnsubscribeToken(email: string, category: string): string {
|
||||
export function generateUnsubscribeToken(
|
||||
email: string,
|
||||
category: string
|
||||
): string {
|
||||
const data = `${email}:${category}`;
|
||||
return createHmac('sha256', SECRET).update(data).digest('hex');
|
||||
}
|
||||
@@ -14,7 +17,7 @@ export function generateUnsubscribeToken(email: string, category: string): strin
|
||||
export function verifyUnsubscribeToken(
|
||||
email: string,
|
||||
category: string,
|
||||
token: string,
|
||||
token: string
|
||||
): boolean {
|
||||
const expectedToken = generateUnsubscribeToken(email, category);
|
||||
const tokenBuffer = Buffer.from(token, 'hex');
|
||||
|
||||
Reference in New Issue
Block a user