Skip to content

Commit d609b9e

Browse files
authored
Add smtp settings ui (#56)
1 parent 4b5f19b commit d609b9e

File tree

10 files changed

+124
-53
lines changed

10 files changed

+124
-53
lines changed

apps/web/src/app/(dashboard)/api-keys/page.tsx

Lines changed: 0 additions & 44 deletions
This file was deleted.

apps/web/src/app/(dashboard)/dasboard-layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export function DashboardLayout({ children }: { children: React.ReactNode }) {
7676
Campaigns
7777
</NavButton>
7878

79-
<NavButton href="/api-keys">
79+
<NavButton href="/dev-settings">
8080
<Code className="h-4 w-4" />
8181
Developer settings
8282
</NavButton>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
"use client";
2+
3+
import AddApiKey from "./add-api-key";
4+
import ApiList from "./api-list";
5+
6+
export default function ApiKeysPage() {
7+
return (
8+
<div>
9+
<div className="flex justify-between items-center">
10+
<h2 className="font-medium">API Keys</h2>
11+
<AddApiKey />
12+
</div>
13+
<ApiList />
14+
</div>
15+
);
16+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
"use client";
2+
3+
import { Tabs, TabsList, TabsTrigger, TabsContent } from "@unsend/ui/src/tabs";
4+
import { useState } from "react";
5+
import { SettingsNavButton } from "./settings-nav-button";
6+
7+
export const dynamic = "force-static";
8+
9+
export default function ApiKeysPage({
10+
children,
11+
}: {
12+
children: React.ReactNode;
13+
}) {
14+
return (
15+
<div>
16+
<h1 className="font-bold text-lg">Developer settings</h1>
17+
<div className="flex gap-4 mt-4">
18+
<SettingsNavButton href="/dev-settings/api-keys">
19+
API Keys
20+
</SettingsNavButton>
21+
<SettingsNavButton href="/dev-settings/smtp">SMTP</SettingsNavButton>
22+
</div>
23+
<div className="mt-8">{children}</div>
24+
</div>
25+
);
26+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
"use client";
2+
3+
import AddApiKey from "./api-keys/add-api-key";
4+
import ApiList from "./api-keys/api-list";
5+
6+
export default function ApiKeysPage() {
7+
return (
8+
<div>
9+
<div className="flex justify-between items-center">
10+
<h2 className="font-medium">API Keys</h2>
11+
<AddApiKey />
12+
</div>
13+
<ApiList />
14+
</div>
15+
);
16+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
"use client";
2+
3+
import { LogOut } from "lucide-react";
4+
import { signOut } from "next-auth/react";
5+
import Link from "next/link";
6+
import { usePathname } from "next/navigation";
7+
import React from "react";
8+
9+
export const SettingsNavButton: React.FC<{
10+
href: string;
11+
children: React.ReactNode;
12+
comingSoon?: boolean;
13+
}> = ({ href, children, comingSoon }) => {
14+
const pathname = usePathname();
15+
16+
const isActive = pathname?.startsWith(href);
17+
18+
if (comingSoon) {
19+
return (
20+
<div className="flex items-center justify-between hover:text-primary cursor-not-allowed mt-1">
21+
<div
22+
className={`flex items-center gap-3 rounded-lg px-3 py-2 transition-all hover:text-primary cursor-not-allowed ${isActive ? " bg-secondary" : "text-muted-foreground"}`}
23+
>
24+
{children}
25+
</div>
26+
<div className="text-muted-foreground px-4 py-0.5 text-xs bg-muted rounded-full">
27+
soon
28+
</div>
29+
</div>
30+
);
31+
}
32+
33+
return (
34+
<Link
35+
href={href}
36+
className={`flex text-sm items-center mt-1 gap-3 rounded px-2 py-1 transition-all hover:text-primary ${isActive ? " bg-accent" : "text-muted-foreground"}`}
37+
>
38+
{children}
39+
</Link>
40+
);
41+
};

apps/web/src/app/(dashboard)/api-keys/smtp.tsx renamed to apps/web/src/app/(dashboard)/dev-settings/smtp/page.tsx

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,35 +17,51 @@ export default function ExampleCard() {
1717
smtp: "smtp.example.com",
1818
port: "587",
1919
user: "user@example.com",
20-
password: "supersecretpassword"
20+
password: "supersecretpassword",
2121
};
2222

2323
return (
24-
<Card className="mt-9">
24+
<Card className="mt-9 max-w-xl">
2525
<CardHeader>
2626
<CardTitle>SMTP</CardTitle>
2727
<CardDescription>
28-
Send emails using SMTP instead of the REST API. See documentation for more information.
28+
Send emails using SMTP instead of the REST API. See documentation for
29+
more information.
2930
</CardDescription>
3031
</CardHeader>
3132
<CardContent>
3233
<div className="space-y-4">
3334
<div>
3435
<strong>Host:</strong>
35-
<TextWithCopyButton className="ml-1 text-zinc-500 rounded-lg mt-1 p-2 w-full bg-gray-900" value={"smtp.unsend.dev"}></TextWithCopyButton>
36+
<TextWithCopyButton
37+
className="ml-1 text-zinc-500 rounded-lg mt-1 p-2 w-full bg-gray-900"
38+
value={"smtp.unsend.dev"}
39+
></TextWithCopyButton>
3640
</div>
3741
<div>
3842
<strong>Port:</strong>
39-
<TextWithCopyButton className="ml-1 text-zinc-500 rounded-lg mt-1 p-2 w-full bg-gray-900" value={"465"}></TextWithCopyButton>
40-
<p className="ml-1 mt-1 text-zinc-500 ">For encrypted/TLS connections use <strong>2465</strong>, <strong>587</strong> or <strong>2587</strong></p>
43+
<TextWithCopyButton
44+
className="ml-1 text-zinc-500 rounded-lg mt-1 p-2 w-full bg-gray-900"
45+
value={"465"}
46+
></TextWithCopyButton>
47+
<p className="ml-1 mt-1 text-zinc-500 ">
48+
For encrypted/TLS connections use <strong>2465</strong>,{" "}
49+
<strong>587</strong> or <strong>2587</strong>
50+
</p>
4151
</div>
4252
<div>
4353
<strong>User:</strong>
44-
<TextWithCopyButton className="ml-1 text-zinc-500 rounded-lg mt-1 p-2 w-full bg-gray-900" value={"unsend"}></TextWithCopyButton>
54+
<TextWithCopyButton
55+
className="ml-1 text-zinc-500 rounded-lg mt-1 p-2 w-full bg-gray-900"
56+
value={"unsend"}
57+
></TextWithCopyButton>
4558
</div>
4659
<div>
4760
<strong>Password:</strong>
48-
<TextWithCopyButton className="ml-1 text-zinc-500 rounded-lg mt-1 p-2 w-full bg-gray-900" value={"YOUR_API_KEY"}></TextWithCopyButton>
61+
<TextWithCopyButton
62+
className="ml-1 text-zinc-500 rounded-lg mt-1 p-2 w-full bg-gray-900"
63+
value={"YOUR_API_KEY"}
64+
></TextWithCopyButton>
4965
</div>
5066
</div>
5167
</CardContent>

0 commit comments

Comments
 (0)