Skip to content

Commit

Permalink
chore(merge): resolved 'main' conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
FindMalek committed Oct 8, 2024
2 parents f482cf1 + 944ca92 commit 7ae5e60
Show file tree
Hide file tree
Showing 20 changed files with 204 additions and 13,789 deletions.
10 changes: 7 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ NEXTAUTH_SECRET=

# GROQ API Key
GROQ_API_KEY=
GROQ_API_ENDPOINT=
GROQ_API_KEY_DEFAULT=
GR_LPU_API_KEY_DEFAULT=

# Google OAuth
GOOGLE_CLIENT_ID=
Expand All @@ -44,4 +43,9 @@ OPENAI_API_KEY=

# Supabase configuration
NEXT_PUBLIC_SUPABASE_URL=
NEXT_PUBLIC_SUPABASE_ANON_KEY=
NEXT_PUBLIC_SUPABASE_ANON_KEY=

# Inferences Default API Keys
SM_RDU_API_KEY_DEFAULT=
CR_INF_API_KEY_DEFAULT=
GR_LPU_API_KEY_DEFAULT=
4 changes: 3 additions & 1 deletion actions/key.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ export async function createKey(userId: string, name: string) {
return await db.aPIToken.create({
data: {
userId: userId,
token: env.GROQ_API_KEY_DEFAULT,
tokenGr: env.GR_LPU_API_KEY_DEFAULT,
tokenCr: env.CR_INF_API_KEY_DEFAULT,
tokenSm: env.SM_RDU_API_KEY_DEFAULT,
id: generateId(38),
name: name,
},
Expand Down
25 changes: 21 additions & 4 deletions actions/mail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,19 @@ import { render } from "@react-email/render"
import nodemailer from "nodemailer"

import { env } from "@/env.mjs"
import { MagicLinkData, MailOptions, MailType, NewUserData } from "@/types/mail"
import {
MagicLinkData,
MailOptions,
MailType,
NewUserData,
WaitlistData,
} from "@/types/mail"

import { siteConfig } from "@/config/site"

import { EmailMagicLink } from "@/components/app/email-magic-link"
import { EmailNewUser } from "@/components/app/email-new-user"
import { EmailWhitelist } from "@/components/app/email-whitelist"

/**
* This function sends an email to a user.
Expand All @@ -33,7 +40,7 @@ import { EmailNewUser } from "@/components/app/email-new-user"
*/
export async function sendMail(
type: MailType,
body: MagicLinkData | NewUserData
body: MagicLinkData | NewUserData | WaitlistData
) {
const mailTransporter = nodemailer.createTransport({
service: "gmail",
Expand All @@ -52,7 +59,7 @@ export async function sendMail(
mailOptions = {
from: `${siteConfig.name} <${env.FROM_EMAIL}>`,
to: (body as MagicLinkData).email,
subject: `Votre Magic Link et OTP code ${siteConfig.name}`,
subject: `Your Magic Link and OTP code ${siteConfig.name}`,
html,
}
break
Expand All @@ -64,7 +71,17 @@ export async function sendMail(
mailOptions = {
from: `${siteConfig.name} <${env.FROM_EMAIL}>`,
to: (body as NewUserData).email,
subject: `Bienvenu to ${siteConfig.name}`,
subject: `Welcome to ${siteConfig.name}`,
html,
}
break
}
case "whitelist": {
const html = render(EmailWhitelist())
mailOptions = {
from: `${siteConfig.name} <${env.FROM_EMAIL}>`,
to: (body as WaitlistData).email,
subject: `Welcome to ${siteConfig.name}`,
html,
}
break
Expand Down
17 changes: 9 additions & 8 deletions app/(dashboard)/dashboard/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,21 @@ export function generateMetadata() {
}
}

// TODO: use promise.all
export default async function DashboardPage() {
const user = await getAuthedUser()
if (!user) {
return redirect("/login")
}

const keys = await getKeys(user.id)
const funds = await getFunds(user.id)
const requestsMonth = await getRequests(
user.id,
new Date(Date.now() - 60 * 60 * 24 * 30 * 1000),
new Date()
)
const [keys, funds, requestsMonth] = await Promise.all([
getKeys(user.id),
getFunds(user.id),
getRequests(
user.id,
new Date(Date.now() - 60 * 60 * 24 * 30 * 1000),
new Date()
),
])

const requestsWeek = requestsMonth.filter(
(request) =>
Expand Down
2 changes: 1 addition & 1 deletion app/api/(compilation)/rag/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ export async function POST(request: NextRequest) {
parseInt(similaritySearchLength) || 5
)

const undrstnd = undrstnd_client(api_token.token)
const undrstnd = undrstnd_client(api_token.tokenGr)
const undrstnd_data = {
model: undrstnd(model.id),
system: results.map((result) => result.pageContent).join("\n\n"),
Expand Down
2 changes: 1 addition & 1 deletion app/api/(compilation)/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export async function POST(request: NextRequest) {
})
}

const undrstnd = undrstnd_client(api_token.token)
const undrstnd = undrstnd_client(api_token.tokenGr)

const undrstnd_data = {
model: undrstnd(model.id),
Expand Down
2 changes: 1 addition & 1 deletion app/api/(engine)/token/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ export async function GET(request: NextRequest) {
})
}

return NextResponse.json({ token: api_token.token })
return NextResponse.json({ token: api_token.tokenGr })
}
3 changes: 3 additions & 0 deletions components/app/email-magic-link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ export function EmailMagicLink({ magicLink }: { magicLink: MagicLinkData }) {
<Link href={siteConfig.url} style={reportLink}>
{siteConfig.name}
</Link>
<Text style={reportLink}>
Undrstnd Labs Inc, 5000 Monastir, Tunisia
</Text>
</Container>
</Body>
</Html>
Expand Down
108 changes: 108 additions & 0 deletions components/app/email-whitelist.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
import * as React from "react"
import {
Body,
Button,
Container,
Head,
Hr,
Html,
Img,
Preview,
Section,
Text,
} from "@react-email/components"

import { siteConfig } from "@/config/site"

export function EmailWhitelist() {
return (
<Html>
<Head />
<Preview>
We welcome you to {siteConfig.name}! Get started with us.
</Preview>
<Body style={main}>
<Container style={container}>
<Img
src={siteConfig.images.logo}
height="42"
alt={`${siteConfig.name} logo`}
style={logo}
/>
<Text style={paragraph}>Hi there,</Text>
<Text style={paragraph}>
Welcome to {siteConfig.name}! We&apos;re excited to have you on
board. Before you get started, we need to verify your email address.
Please click the button below to complete the registration process.
</Text>
<Section style={btnContainer}>
<Button style={button} href={`${siteConfig.url}/register`}>
Get started
</Button>
</Section>
<Hr style={hr} />

<Text style={paragraph}>
You are accepted in the whitelist, you can now access the platform.
We can&apos;t wait to see what you build with {siteConfig.name}!
Check out our documentation to get started.
</Text>
<Hr style={hr} />

<Text style={paragraph}>
Best,
<br />
The {siteConfig.name} team
</Text>
<Hr style={hr} />
<Text style={footer}>Undrstnd Labs Inc, 5000 Monastir, Tunisia</Text>
</Container>
</Body>
</Html>
)
}

const main = {
backgroundColor: "#ffffff",
fontFamily:
'-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif',
}

const container = {
margin: "0 auto",
padding: "20px 0 48px",
}

const logo = {
margin: "0 auto",
}

const paragraph = {
fontSize: "16px",
lineHeight: "26px",
}

const btnContainer = {
textAlign: "center" as const,
}

const button = {
backgroundColor: "#5F51E8",
borderRadius: "3px",
color: "#fff",
fontSize: "16px",
textDecoration: "none",
textAlign: "center" as const,
display: "block",
padding: "12px",
}

const hr = {
borderColor: "#cccccc",
margin: "20px 0",
}

const footer = {
color: "#8898aa",
fontSize: "12px",
}
2 changes: 1 addition & 1 deletion components/app/marketing-social-proof.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from "react"
import Link from "next/link"
import { models } from "@/data/models"
import { partnerships } from "@/data/partnerships"

import { Marquee } from "@/components/fancy/marquee"
import { partnerships } from "@/data/partnerships"

export function MarketingSocialProof() {
const companies = models.filter(
Expand Down
10 changes: 8 additions & 2 deletions components/app/marketing-waitlist.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { useFormStatus } from "react-dom"

import { Icons } from "@/components/shared/icons"

import { sendMail } from "@/actions/mail"
import { addWaitlist } from "@/actions/waitlist"

function SubmitButton() {
Expand Down Expand Up @@ -57,11 +58,16 @@ export function WaitlistForm() {
setSubmitted(true)

const email = formData.get("email") as string
await addWaitlist(email)
await Promise.all([
addWaitlist(email),
sendMail("whitelist", {
email,
}),
])

setTimeout(() => {
setSubmitted(false)
}, 5000)
}, 1000)
}}
>
<fieldset className="relative z-50 min-w-[300px] max-w-full">
Expand Down
2 changes: 1 addition & 1 deletion components/shared/github-sign-in.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export function GithubSignIn({
return (
<Button
onClick={handleSignIn}
className="flex h-[40px] w-full space-x-2 bg-primary px-6 py-4 font-medium text-secondary active:scale-[0.98]"
className="flex h-[40px] w-full space-x-2 bg-primary px-6 py-4 font-medium text-primary-foreground active:scale-[0.98]"
>
{isLoading ? (
<Icons.spinner className="size-4 animate-spin" />
Expand Down
2 changes: 1 addition & 1 deletion components/shared/google-sign-in.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export function GoogleSignIn({
return (
<Button
onClick={handleSignIn}
className="flex h-[40px] w-full space-x-2 bg-primary px-6 py-4 font-medium text-secondary active:scale-[0.98]"
className="flex h-[40px] w-full space-x-2 bg-primary px-6 py-4 font-medium text-primary-foreground active:scale-[0.98]"
>
{isLoading ? (
<Icons.spinner className="size-4 animate-spin" />
Expand Down
2 changes: 1 addition & 1 deletion config/site.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const siteConfig: SiteConfig = {
images: {
default: "https://dev.undrstnd-labs.com/og.png",
notFound: "https://dev.undrstnd-labs.com/not-found.png",
logo: "https://emojicdn.elk.sh/⏩?style=twitter",
logo: "https://raw.githubusercontent.com/undrstnd-labs/developers/refs/heads/main/public/favicons/android-chrome-512x512.png",
},
links: {
twitter: "https://twitter.com/foundmalek",
Expand Down
47 changes: 24 additions & 23 deletions data/partnerships.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
import { Icons } from "@/components/shared/icons"
import { Partnership } from "@/types"

export const partnerships: Partnership[] = [
{
company: "Tunisian I.T. Community",
href: "https://www.facebook.com/TunITCo",
label: "tunisian-it-community",
image: Icons.tic
},
{
company: "Google Developer Club",
href: "https://www.facebook.com/google.developer.groups.gdg.on.campus.esprit",
label: "google-developer-club",
image: Icons.gdg
},
{
company: "Open Source Tunisia",
href: "https://www.linkedin.com/company/open-source-tunisia/",
label: "open-source-tunisia",
image: Icons.ost
}
]
import { Partnership } from "@/types"

import { Icons } from "@/components/shared/icons"

export const partnerships: Partnership[] = [
{
company: "Tunisian I.T. Community",
href: "https://www.facebook.com/TunITCo",
label: "tunisian-it-community",
image: Icons.tic,
},
{
company: "Google Developer Club",
href: "https://www.facebook.com/google.developer.groups.gdg.on.campus.esprit",
label: "google-developer-club",
image: Icons.gdg,
},
{
company: "Open Source Tunisia",
href: "https://www.linkedin.com/company/open-source-tunisia/",
label: "open-source-tunisia",
image: Icons.ost,
},
]
Loading

0 comments on commit 7ae5e60

Please sign in to comment.