Skip to content

Commit

Permalink
Merge pull request midday-ai#18 from midday-ai/feature/website
Browse files Browse the repository at this point in the history
Website 0.5
  • Loading branch information
pontusab authored Mar 19, 2024
2 parents 43d90f5 + 768a75b commit 480e284
Show file tree
Hide file tree
Showing 130 changed files with 4,268 additions and 440 deletions.
4 changes: 4 additions & 0 deletions .env-example
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,7 @@ TELLER_CERTIFICATE_PRIVATE_KEY=
# Plaid
PLAID_CLIENT_ID=
PLAID_SECRET=

# Notion
NOTION_TOKEN=
NOTION_DATABASE_ID=
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<p align="center">
<p align="center">
<img width="150" height="150" src="/app-icon.png" alt="Logo">
<img src="/github.png" alt="Logo">
</p>
<h1 align="center"><b>Midday</b></h1>
<p align="center">
Expand All @@ -15,9 +15,9 @@
</p>
</p>

# Roadmap
# Under active development

View what's currently in progress, and what's planned for the future: [Midday Roadmap](https://midday-ai.notion.site/86823a9c0e2d4da6976d499df27cdfe3)
> We have been working with Midday for the past 4 months and our philosophy has been "make it work, make it right". Currently, we're actively improving Midday's code quality and best practices. In the meantime, fasten your seatbelts and enjoy the ride!
# App Architecture

Expand Down Expand Up @@ -54,3 +54,7 @@ View what's currently in progress, and what's planned for the future: [Midday Ro
## Repo Activity

<!-- ![Repo Activity](https://repobeats.axiom.co/api/embed/ "Repobeats analytics image") -->

```
```
Binary file removed app-icon.png
Binary file not shown.
19 changes: 11 additions & 8 deletions apps/dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,19 @@
"@todesktop/client-core": "^1.2.5",
"@todesktop/runtime": "^1.6.1",
"@trigger.dev/nextjs": "^2.3.18",
"@tsparticles/engine": "^3.3.0",
"@tsparticles/react": "^3.0.0",
"@tsparticles/slim": "^3.3.0",
"@uidotdev/usehooks": "^2.4.1",
"@vercel/edge-config": "^1.1.0",
"@vercel/speed-insights": "^1.0.10",
"@zip.js/zip.js": "2.7.40",
"ai": "^3.0.11",
"ai": "^3.0.12",
"base64-arraybuffer": "^1.0.2",
"change-case": "^5.4.3",
"dub": "^0.9.0",
"dub": "^0.10.0",
"fast-csv": "^5.0.1",
"framer-motion": "^11.0.12",
"framer-motion": "^11.0.14",
"geist": "^1.2.2",
"headless-currency-input": "^1.1.0",
"loops": "0.3.0",
Expand All @@ -51,16 +54,16 @@
"next-safe-action": "6.2.0",
"next-themes": "^0.3.0",
"nuqs": "^1.17.1",
"openai": "^4.29.0",
"openai": "^4.29.1",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-dropzone": "^14.2.3",
"react-hook-form": "^7.51.0",
"react-hook-form": "^7.51.1",
"react-hotkeys-hook": "^4.5.0",
"react-intersection-observer": "^9.8.1",
"react-pdf": "^7.7.1",
"react-plaid-link": "^3.5.1",
"recharts": "^2.12.2",
"recharts": "^2.12.3",
"resend": "^3.2.0",
"sharp": "^0.33.2",
"teller-connect-react": "^0.1.0",
Expand All @@ -73,8 +76,8 @@
"@midday/tsconfig": "workspace:*",
"@t3-oss/env-nextjs": "^0.9.2",
"@todesktop/tailwind-variants": "^1.0.1",
"@types/node": "^20.11.27",
"@types/react": "^18.2.65",
"@types/node": "^20.11.28",
"@types/react": "^18.2.66",
"@types/react-dom": "^18.2.22",
"typescript": "^5.4.2"
}
Expand Down
33 changes: 33 additions & 0 deletions apps/dashboard/src/actions/approve-user-actiont.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
"use server";

import { LogEvents } from "@midday/events/events";
import { logsnag } from "@midday/events/server";
import { Events, client as trigger } from "@midday/jobs";
import { client as redis } from "@midday/kv";
import { redirect } from "next/navigation";
import { action } from "./safe-action";
import { approveUserSchema } from "./schema";

export const approveUserAction = action(
approveUserSchema,
async ({ email, fullName }) => {
await redis.append("approved", email);

trigger.sendEvent({
name: Events.ONBOARDING_EMAILS,
payload: {
fullName,
email,
},
});

logsnag.track({
event: LogEvents.VerifiedEarlyAccess.name,
icon: LogEvents.VerifiedEarlyAccess.icon,
user_id: email,
channel: LogEvents.VerifiedEarlyAccess.channel,
});

redirect("/");
}
);
5 changes: 5 additions & 0 deletions apps/dashboard/src/actions/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ export const deleteBankAccountSchema = z.object({
id: z.string().uuid(),
});

export const approveUserSchema = z.object({
email: z.string().email(),
fullName: z.string(),
});

export const updateBankAccountSchema = z.object({
id: z.string().uuid(),
name: z.string().optional(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { TwitterShare } from "@/components/twitter-share";
import { UserMenu } from "@/components/user-menu";
import { Button } from "@midday/ui/button";
import { Icons } from "@midday/ui/icons";
import { Metadata } from "next";
import type { Metadata } from "next";
import Link from "next/link";
import { Suspense } from "react";

export const metadata: Metadata = {
title: "Private beta | Midday",
title: "Early access | Midday",
};

export default function Closed() {
Expand All @@ -31,18 +32,22 @@ export default function Closed() {
<div className="flex w-full flex-col relative">
<div className="pb-4">
<h1 className="font-medium pb-1 text-3xl">
We will soon open up for beta.{" "}
Thank you for requesting early access.
</h1>
</div>

<p className="font-medium pb-1 text-2xl text-[#606060]">
You can't log in yet, but keep a lookout in your email for when we
open up for beta testing.
We send out new invites daily, but you can get instant access by
sharing a post on X.
</p>

<div className="pointer-events-auto mt-6 flex flex-col mb-4">
<div className="pointer-events-auto mt-6 flex flex-col mb-4 space-y-4">
<TwitterShare />

<Link href="https://midday.ai" className="w-full">
<Button className="w-full">Back to home page</Button>
<Button className="w-full h-10" variant="outline">
Back to home page
</Button>
</Link>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// import { ActivityList } from "@/components/activity-list";
import { MfaSettingsList } from "@/components/mfa-settings-list";
import { AddNewDeviceModal } from "@/components/modals/add-new-device";
import { Metadata } from "next";
import type { Metadata } from "next";

export const metadata: Metadata = {
title: "Security | Midday",
Expand Down
4 changes: 2 additions & 2 deletions apps/dashboard/src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import { SpeedInsights } from "@vercel/speed-insights/next";
import { GeistMono } from "geist/font/mono";
import { GeistSans } from "geist/font/sans";
import type { Metadata } from "next";
import { type ReactElement } from "react";
import type { ReactElement } from "react";

export const metadata: Metadata = {
metadataBase: new URL("https://app.midday.ai"),
title: "Midday | The financial OS for your business",
title: "Midday | Run your business smarter",
description:
"Automate financial tasks, stay organized, and make informed decisions effortlessly.",
};
Expand Down
2 changes: 1 addition & 1 deletion apps/dashboard/src/components/delete-team.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export function DeleteTeam({ teamId }) {
<CardHeader>
<CardTitle>Delete team</CardTitle>
<CardDescription>
Permanently remove your Team and all of its contents from the Vercel
Permanently remove your Team and all of its contents from the Midday
platform. This action is not reversible — please continue with
caution.
</CardDescription>
Expand Down
95 changes: 95 additions & 0 deletions apps/dashboard/src/components/twitter-share.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
"use client";

import { approveUserAction } from "@/actions/approve-user-actiont";
import { createClient } from "@midday/supabase/client";
import { Button } from "@midday/ui/button";
import { Loader2 } from "lucide-react";
import { useAction } from "next-safe-action/hooks";
import { useState } from "react";
import { FaXTwitter } from "react-icons/fa6";

const popupCenter = ({ url, title, w, h }) => {
const dualScreenLeft =
window.screenLeft !== undefined ? window.screenLeft : window.screenX;
const dualScreenTop =
window.screenTop !== undefined ? window.screenTop : window.screenY;

const width = window.innerWidth
? window.innerWidth
: document.documentElement.clientWidth
? document.documentElement.clientWidth
: screen.width;
const height = window.innerHeight
? window.innerHeight
: document.documentElement.clientHeight
? document.documentElement.clientHeight
: screen.height;

const systemZoom = width / window.screen.availWidth;
const left = (width - w) / 2 / systemZoom + dualScreenLeft;
const top = (height - h) / 2 / systemZoom + dualScreenTop;
const newWindow = window.open(
url,
title,
`
scrollbars=yes,
width=${w / systemZoom},
height=${h / systemZoom},
top=${top},
left=${left}
`
);

return newWindow;
};

export function TwitterShare() {
const supabase = createClient();
const approvedUser = useAction(approveUserAction, {
onSuccess: () => setLoading(false),
});
const [isLoading, setLoading] = useState(false);

const onShare = async () => {
const {
data: { user },
} = await supabase.auth.getUser();

setLoading(true);

const popup = popupCenter({
url: "https://twitter.com/intent/tweet?text=I just signed up for @middayai, excited to try this out!",
title: "Share",
w: 800,
h: 400,
});

popup?.focus();

// NOTE: Okey, we trust you, we can't verify that you actually shared
// a post on X so if you pressed the button your in
setTimeout(() => {
approvedUser.execute({
email: user.email,
fullName: user.user_metadata?.full_name,
});
}, 20000);
};

return (
<Button
className="w-full flex items-center space-x-2 h-10"
onClick={onShare}
disabled={isLoading}
>
{isLoading ? (
<Loader2 className="h-4 w-4 animate-spin" />
) : (
<>
<span>Share a post on</span>
<FaXTwitter />
</>
)}
</Button>
);
}
4 changes: 4 additions & 0 deletions apps/dashboard/src/env.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ export const env = createEnv({
SUPABASE_SERVICE_KEY: z.string(),
OPENAI_API_KEY: z.string(),
API_ROUTE_SECRET: z.string(),
NOTION_TOKEN: z.string(),
NOTION_DATABASE_ID: z.string(),
},
/**
* Specify your server-side environment variables schema here. This way you can ensure the app isn't
Expand Down Expand Up @@ -72,6 +74,8 @@ export const env = createEnv({
SUPABASE_SERVICE_KEY: process.env.SUPABASE_SERVICE_KEY,
OPENAI_API_KEY: process.env.OPENAI_API_KEY,
API_ROUTE_SECRET: process.env.API_ROUTE_SECRET,
NOTION_TOKEN: process.env.NOTION_TOKEN,
NOTION_DATABASE_ID: process.env.NOTION_DATABASE_ID,
},
skipValidation: !!process.env.CI || !!process.env.SKIP_ENV_VALIDATION,
});
10 changes: 5 additions & 5 deletions apps/dashboard/src/middleware.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { client } from "@midday/kv";
import { createClient } from "@midday/supabase/middleware";
import { get } from "@vercel/edge-config";
import { createI18nMiddleware } from "next-international/middleware";
import { NextRequest, NextResponse } from "next/server";
import { type NextRequest, NextResponse } from "next/server";

const I18nMiddleware = createI18nMiddleware({
locales: ["en"],
Expand Down Expand Up @@ -42,11 +42,11 @@ export async function middleware(request: NextRequest) {
return NextResponse.redirect(url);
}

// Check if in beta list by email
// Check if in approved user list by email
if (
data?.user &&
!(await get("beta"))?.includes(data?.user.email) &&
newUrl.pathname !== "/closed"
newUrl.pathname === "/" &&
!(await client.get("approved"))?.includes(data?.user.email)
) {
return NextResponse.redirect(new URL("/closed", request.url));
}
Expand Down
Empty file added apps/docs/README.md
Empty file.
2 changes: 2 additions & 0 deletions apps/website/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
### Website

###
13 changes: 11 additions & 2 deletions apps/website/next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import path from "path";

/** @type {import("next").NextConfig} */
const config = {
reactStrictMode: true,
Expand All @@ -10,6 +8,17 @@ const config = {
typescript: {
ignoreBuildErrors: true,
},
images: {
remotePatterns: [
{
protocol: "https",
hostname: "**",
},
],
},
experimental: {
ppr: true,
},
};

export default config;
Loading

0 comments on commit 480e284

Please sign in to comment.