forked from midday-ai/midday
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request midday-ai#18 from midday-ai/feature/website
Website 0.5
- Loading branch information
Showing
130 changed files
with
4,268 additions
and
440 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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("/"); | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
apps/dashboard/src/app/[locale]/(app)/@dashboard/(root)/account/security/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
### Website | ||
|
||
### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.