Skip to content

Commit

Permalink
Slack
Browse files Browse the repository at this point in the history
  • Loading branch information
pontusab committed Nov 11, 2023
1 parent 47335ae commit 46f6d9f
Show file tree
Hide file tree
Showing 9 changed files with 68 additions and 13 deletions.
10 changes: 5 additions & 5 deletions apps/dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@
"@midday/supabase": "workspace:*",
"@midday/ui": "workspace:*",
"@novu/headless": "^0.21.0",
"@trigger.dev/nextjs": "^2.2.5",
"@trigger.dev/react": "^2.2.5",
"@trigger.dev/sdk": "^2.2.5",
"@trigger.dev/nextjs": "^2.2.6",
"@trigger.dev/react": "^2.2.6",
"@trigger.dev/sdk": "^2.2.6",
"change-case": "^5.1.2",
"framer-motion": "^10.16.4",
"next": "canary",
"next-international": "^1.1.4",
"next-safe-action": "^5.0.2",
"next-safe-action": "^5.0.3",
"next-themes": "^0.2.1",
"next-usequerystate": "^1.10.1",
"next-usequerystate": "^1.10.2",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-dropzone": "^14.2.3",
Expand Down
4 changes: 3 additions & 1 deletion apps/dashboard/src/app/[locale]/@login/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { GoogleSignIn } from "@/components/google-sign-in";
import { SlackSignIn } from "@/components/slack-sign-in";
import { Icons } from "@midday/ui/icons";
import Link from "next/link";

Expand Down Expand Up @@ -49,8 +50,9 @@ export default function Login() {
<br /> effortlessly.
</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">
<GoogleSignIn />
<SlackSignIn />
</div>

<p className="text-xs text-[#606060]">
Expand Down
2 changes: 1 addition & 1 deletion apps/dashboard/src/components/google-sign-in.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function GoogleSignIn() {
return (
<Button
onClick={handleSignIn}
className="active:scale-[0.98] rounded-xl bg-white px-6 py-4 text-black font-medium flex space-x-2"
className="active:scale-[0.98] rounded-xl bg-white px-6 py-4 text-black font-medium flex space-x-2 h-[40px]"
>
<Icons.Google />
<span>Continue with Google</span>
Expand Down
28 changes: 28 additions & 0 deletions apps/dashboard/src/components/slack-sign-in.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"use client";

import { createClient } from "@midday/supabase/client";
import { Button } from "@midday/ui/button";
import { Icons } from "@midday/ui/icons";

export function SlackSignIn() {
const supabase = createClient();

const handleSignIn = async () => {
await supabase.auth.signInWithOAuth({
provider: "slack",
options: {
redirectTo: `${location.origin}/api/auth/callback`,
},
});
};

return (
<Button
onClick={handleSignIn}
className="active:scale-[0.98] rounded-xl bg-white px-6 py-4 text-black font-medium flex space-x-2 h-[40px]"
>
<Icons.Slack />
<span>Continue with Slack</span>
</Button>
);
}
7 changes: 4 additions & 3 deletions apps/dashboard/src/jobs/transactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const dynamicSchedule = client.defineDynamicSchedule({
client.defineJob({
id: "bank-account-created",
name: "Bank Account Created",
version: "0.7.0",
version: "0.8.0",
trigger: supabaseTriggers.onInserted({
table: "bank_accounts",
}),
Expand Down Expand Up @@ -89,7 +89,7 @@ client.defineJob({
client.defineJob({
id: "transactions-sync",
name: "Transactions - Latest Transactions",
version: "0.7.0",
version: "0.8.0",
trigger: dynamicSchedule,
integrations: { supabase },
run: async (_, io, ctx) => {
Expand All @@ -102,6 +102,7 @@ client.defineJob({
if (!data) {
// TODO: Remove schedule
await io.logger.error(`Bank account not found: ${ctx.source.id}`);
await dynamicSchedule.unregister(ctx.source.id);
}

await io.logger.info(`Fetching Transactions for ID: ${data?.account_id}`);
Expand Down Expand Up @@ -136,7 +137,7 @@ client.defineJob({
client.defineJob({
id: "transactions-initial-sync",
name: "Transactions - Initial",
version: "0.7.0",
version: "0.8.0",
trigger: eventTrigger({
name: "transactions.initial.sync",
schema: z.object({
Expand Down
Binary file modified bun.lockb
Binary file not shown.
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
"dependencies": {
"@biomejs/biome": "1.3.3",
"@manypkg/cli": "^0.21.0",
"@trigger.dev/sdk": "^2.2.5",
"@trigger.dev/supabase": "^2.2.5",
"turbo": "^1.10.16",
"typescript": "^5.2.2"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/supabase/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"db:generate": "supabase gen types typescript --project-id pytddvqiozwrhfbwqazp --schema public > src/types/db.ts"
},
"dependencies": {
"@supabase/ssr": "^0.0.9",
"@supabase/ssr": "^0.0.10",
"@supabase/supabase-js": "^2.38.4",
"supabase": "^1.110.1"
},
Expand Down
26 changes: 26 additions & 0 deletions packages/ui/src/components/icons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,32 @@ export const Icons = {
/>
</svg>
),
Slack: (props: any) => (
<svg
width="20"
height="21"
viewBox="0 0 20 21"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<g clip-path="url(#clip0_1185_1063)">
<path
d="M4.20167 13.1375C4.20057 13.6943 3.97905 14.2281 3.58553 14.6221C3.19201 15.0161 2.65851 15.2382 2.10167 15.24C1.54453 15.2387 1.01061 15.0167 0.616729 14.6227C0.222852 14.2286 0.00110036 13.6946 0 13.1375C0.00154122 12.5807 0.223514 12.0472 0.617367 11.6537C1.01122 11.2601 1.5449 11.0386 2.10167 11.0375H4.20167V13.1375ZM5.26083 13.1375C5.26237 12.5809 5.48423 12.0475 5.8779 11.654C6.27158 11.2605 6.80504 11.0388 7.36167 11.0375C7.91829 11.0388 8.45176 11.2605 8.84543 11.654C9.2391 12.0475 9.46096 12.5809 9.4625 13.1375V18.3983C9.46118 18.9552 9.23945 19.4889 8.84577 19.8827C8.4521 20.2765 7.91851 20.4985 7.36167 20.5C6.80482 20.4985 6.27123 20.2765 5.87756 19.8827C5.48389 19.4889 5.26215 18.9552 5.26083 18.3983V13.1375ZM7.36167 4.70167C6.80511 4.70013 6.27177 4.47841 5.87815 4.08494C5.48452 3.69147 5.26259 3.15822 5.26083 2.60167C5.26215 2.04482 5.48389 1.51115 5.87756 1.11732C6.27123 0.723486 6.80482 0.50154 7.36167 0.5C7.91851 0.50154 8.4521 0.723486 8.84577 1.11732C9.23945 1.51115 9.46118 2.04482 9.4625 2.60167V4.70167H7.36167ZM7.36167 5.76083C7.91837 5.76237 8.45183 5.9842 8.84548 6.37785C9.23913 6.7715 9.46096 7.30496 9.4625 7.86167C9.46096 8.41837 9.23913 8.95183 8.84548 9.34548C8.45183 9.73913 7.91837 9.96096 7.36167 9.9625H2.10167C1.54482 9.96118 1.01115 9.73945 0.617316 9.34577C0.223486 8.9521 0.00154034 8.41851 0 7.86167C0.00154034 7.30482 0.223486 6.77123 0.617316 6.37756C1.01115 5.98389 1.54482 5.76215 2.10167 5.76083H7.36167ZM15.7967 7.86167C15.7982 7.30482 16.0202 6.77123 16.414 6.37756C16.8078 5.98389 17.3415 5.76215 17.8983 5.76083C18.4552 5.76215 18.9889 5.98389 19.3827 6.37756C19.7765 6.77123 19.9985 7.30482 20 7.86167C19.9985 8.41851 19.7765 8.9521 19.3827 9.34577C18.9889 9.73945 18.4552 9.96118 17.8983 9.9625H15.7967V7.86167ZM14.74 7.86167C14.7385 8.41866 14.5164 8.95237 14.1224 9.34607C13.7284 9.73976 13.1945 9.9614 12.6375 9.9625C12.0809 9.96096 11.5475 9.7391 11.154 9.34543C10.7605 8.95176 10.5388 8.41829 10.5375 7.86167V2.60167C10.5386 2.0449 10.7601 1.51122 11.1537 1.11737C11.5472 0.723514 12.0807 0.501541 12.6375 0.5C13.1946 0.5011 13.7286 0.722852 14.1227 1.11673C14.5167 1.51061 14.7387 2.04453 14.74 2.60167V7.86167ZM12.6375 16.2967C13.1946 16.2978 13.7286 16.5195 14.1227 16.9134C14.5167 17.3073 14.7387 17.8412 14.74 18.3983C14.7387 18.9555 14.5167 19.4894 14.1227 19.8833C13.7286 20.2771 13.1946 20.4989 12.6375 20.5C12.0807 20.4985 11.5472 20.2765 11.1537 19.8826C10.7601 19.4888 10.5386 18.9551 10.5375 18.3983V16.2967H12.6375ZM12.6375 15.24C12.0806 15.2385 11.547 15.0164 11.1534 14.6223C10.7598 14.2283 10.5384 13.6944 10.5375 13.1375C10.5388 12.581 10.7605 12.0476 11.154 11.654C11.5476 11.2605 12.081 11.0388 12.6375 11.0375H17.8983C18.4551 11.0386 18.9888 11.2601 19.3826 11.6537C19.7765 12.0472 19.9985 12.5807 20 13.1375C19.9989 13.6946 19.7771 14.2286 19.3833 14.6227C18.9894 15.0167 18.4555 15.2387 17.8983 15.24H12.6375Z"
fill="#636363"
/>
</g>
<defs>
<clipPath id="clip0_1185_1063">
<rect
width="20"
height="20"
fill="white"
transform="translate(0 0.5)"
/>
</clipPath>
</defs>
</svg>
),
FlightTakeoff: MdFlightTakeoff,
Desk: MdDesk,
FastFood: MdFastfood,
Expand Down

0 comments on commit 46f6d9f

Please sign in to comment.