added mail service

This commit is contained in:
2024-04-10 21:24:25 +03:00
parent c76d4b9717
commit 78107d4ec7
80 changed files with 3478 additions and 329 deletions

View File

@@ -0,0 +1,18 @@
import { auth, signOut } from '@/config/auth'
const CabinetPage = async () => {
const session = await auth()
return (
<div>
{JSON.stringify(session)}
<form action={async () => {
'use server'
await signOut()
}}>
<button type="submit">SignOut {session?.user.role}</button>
</form>
</div>
)
}
export default CabinetPage

View File

@@ -0,0 +1,23 @@
'use client'
import mailer from '@/lib/mailer'
export default function AboutPage () {
const onClick = () => {
mailer({
to: [
{ name: 'Yevhen', address: 'it@amok.space' },
{ name: 'Євген', address: 'yevhen.odynets@gmail.com' },
],
subject: 'ПОСИЛЕННЯ МОБІЛІЗАЦІЇ В УКРАЇНІ',
html: `<div>Коли Рада <strong>розгляне</strong> законопроєкт про мобілізацію у <del>другому</del> читанні</div>`,
}).catch(console.error)
}
return (
<button onClick={onClick}
className="bg-transparent hover:bg-blue-500 text-blue-700 font-semibold hover:text-white py-2 px-4 border border-blue-500 hover:border-transparent">
sendmail
</button>
)
}

View File

@@ -0,0 +1,3 @@
export default function AboutUsPage () {
return (<div>AboutUsPage</div>)
}

View File

@@ -0,0 +1,29 @@
import { Poppins } from 'next/font/google'
import { getScopedI18n } from '@/locales/server'
import { cn } from '@/lib/utils'
import { Button } from '@/components/ui/button'
import LoginButton from '@/components/auth/LoginButton'
import { bg as bgg } from '@/config/layout'
const font = Poppins({
subsets: ['latin'], weight: ['600'],
})
export default async function Home () {
const t = await getScopedI18n('auth')
return (<main
className="flex flex-col items-center justify-center h-full bg-[radial-gradient(ellipse_at_top,_var(--tw-gradient-stops))] from-lime-400 to-emerald-800">
<div className="space-y-6 text-center">
<h1 className={cn('text-6xl font-semibold text-white drop-shadow-md',
font.className)}>
🔐 {t('title')}
</h1>
<p className="text-lg text-white">{t('subtitle')}</p>
<div>
<LoginButton>
<Button variant="secondary" size="lg">{t('sign_in')}</Button>
</LoginButton>
</div>
</div>
</main>)
}

View File

@@ -0,0 +1,9 @@
import ErrorCard from '@/components/auth/ErrorCard'
const AuthErrorPage = () => {
return (
<ErrorCard/>
)
}
export default AuthErrorPage

View File

@@ -0,0 +1,22 @@
'use client'
import { ReactElement } from 'react'
import Navbar from '@/components/auth/Navbar'
type Props = {
//params: { locale: string };
children: ReactElement;
}
const AuthLayout = ({ children }: Props) => {
return (
<>
<Navbar/>
<div
className="h-full flex items-center justify-center bg-[radial-gradient(ellipse_at_top,_var(--tw-gradient-stops))] from-sky-400 to-blue-800">
{children}
</div>
</>
)
}
export default AuthLayout

View File

@@ -0,0 +1,9 @@
import { LoginForm } from '@/components/auth/LoginForm'
const LoginPage = () => {
return (
<LoginForm/>
)
}
export default LoginPage

View File

@@ -0,0 +1,11 @@
import { RegisterForm } from '@/components/auth/RegisterForm'
const RegisterPage = () => {
return (
<div>
<RegisterForm/>
</div>
)
}
export default RegisterPage

66
app/[locale]/globals.css Normal file
View File

@@ -0,0 +1,66 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
html,
body,
:root {
height: 100%;
}
@layer base {
:root {
--background: 0 0% 100%;
--foreground: 222.2 84% 4.9%;
--card: 0 0% 100%;
--card-foreground: 222.2 84% 4.9%;
--popover: 0 0% 100%;
--popover-foreground: 222.2 84% 4.9%;
--primary: 221.2 83.2% 53.3%;
--primary-foreground: 210 40% 98%;
--secondary: 210 40% 96.1%;
--secondary-foreground: 222.2 47.4% 11.2%;
--muted: 210 40% 96.1%;
--muted-foreground: 215.4 16.3% 46.9%;
--accent: 210 40% 96.1%;
--accent-foreground: 222.2 47.4% 11.2%;
--destructive: 0 84.2% 60.2%;
--destructive-foreground: 210 40% 98%;
--border: 214.3 31.8% 91.4%;
--input: 214.3 31.8% 91.4%;
--ring: 221.2 83.2% 53.3%;
--radius: 0rem;
}
.dark {
--background: 222.2 84% 4.9%;
--foreground: 210 40% 98%;
--card: 222.2 84% 4.9%;
--card-foreground: 210 40% 98%;
--popover: 222.2 84% 4.9%;
--popover-foreground: 210 40% 98%;
--primary: 217.2 91.2% 59.8%;
--primary-foreground: 222.2 47.4% 11.2%;
--secondary: 217.2 32.6% 17.5%;
--secondary-foreground: 210 40% 98%;
--muted: 217.2 32.6% 17.5%;
--muted-foreground: 215 20.2% 65.1%;
--accent: 217.2 32.6% 17.5%;
--accent-foreground: 210 40% 98%;
--destructive: 0 62.8% 30.6%;
--destructive-foreground: 210 40% 98%;
--border: 217.2 32.6% 17.5%;
--input: 217.2 32.6% 17.5%;
--ring: 224.3 76.3% 48%;
}
}
@layer base {
* {
@apply border-border;
}
body {
@apply bg-background text-foreground;
}
}

29
app/[locale]/layout.tsx Normal file
View File

@@ -0,0 +1,29 @@
import type { Metadata } from 'next'
import { Inter } from 'next/font/google'
import './globals.css'
import { ReactElement } from 'react'
import { I18nProviderClient } from '@/locales/client'
import { lc } from '@/lib/utils'
const inter = Inter({ subsets: ['cyrillic'] })
export const metadata: Metadata = {
title: 'Create Next App', description: 'Generated by create next app',
}
type Props = {
params: { locale: string }; children: ReactElement;
}
export default function RootLayout ({
params: { locale }, children,
}: Readonly<Props>) {
return (<html lang={lc(locale).java}>
<body className={inter.className}>
<I18nProviderClient locale={locale} fallback={<p>Loading...</p>}>
{children}
</I18nProviderClient>
</body>
</html>)
}