Skip to content

Commit

Permalink
Export wip
Browse files Browse the repository at this point in the history
  • Loading branch information
pontusab committed Nov 17, 2023
1 parent b819f93 commit 12334fd
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 21 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
"use client";

import { Button } from "@midday/ui/button";
import {
Dialog,
DialogContent,
DialogDescription,
DialogFooter,
DialogHeader,
DialogTitle,
} from "@midday/ui/dialog";
Expand All @@ -12,14 +14,22 @@ export function ExportTransactionsModal({ isOpen, setOpen }) {
return (
<Dialog open={isOpen} onOpenChange={setOpen}>
<DialogContent>
<div className="p-4">
<div className="p-6">
<DialogHeader className="mb-8">
<DialogTitle>Export</DialogTitle>
<DialogDescription>
Heads up, we’ve noticed that 12 of your transactions are missing
receipts. Click “show more” and we’ll filter them for you.
</DialogDescription>
</DialogHeader>
<DialogFooter>
<div className="space-x-4">
<Button variant="outline" onClick={() => setOpen(false)}>
Cancel
</Button>
<Button>Export</Button>
</div>
</DialogFooter>
</div>
</DialogContent>
</Dialog>
Expand Down
3 changes: 1 addition & 2 deletions apps/dashboard/src/components/reconnect-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
import { buildLink, createEndUserAgreement } from "@midday/gocardless";
import { Button } from "@midday/ui/button";
import { Icons } from "@midday/ui/icons";
import { usePathname, useRouter } from "next/navigation";
import { useRouter } from "next/navigation";

export function ReconnectButton({ id, institutionId }) {
const pathname = usePathname();
const router = useRouter();

const handleCreateEndUserAgreement = async () => {
Expand Down
23 changes: 21 additions & 2 deletions apps/dashboard/src/jobs/transactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ client.defineJob({
await dynamicSchedule.register(payload.record.id, {
type: "interval",
options: {
seconds: 60 * 10, // every 4h
seconds: 3600 * 4, // every 4h
},
});
},
Expand Down Expand Up @@ -168,7 +168,7 @@ client.defineJob({
currency: transaction.currency,
}).format(transaction.amount),
from: transaction.name,
} // TODO: Format
}
),
},
user: {
Expand Down Expand Up @@ -279,3 +279,22 @@ client.defineJob({
await io.logger.info(`Transactions Created: ${transactionsData?.length}`);
},
});

client.defineJob({
id: "transactions-export",
name: "Transactions - Export",
version: "1.0.0",
trigger: eventTrigger({
name: "transactions.export",
schema: z.object({
from: z.string().datetime(),
to: z.string().datetime(),
}),
}),
integrations: { supabase },
run: async (payload, io) => {
const { from, to } = payload;

await io.logger.info("Transactions Export");
},
});
Binary file modified bun.lockb
Binary file not shown.
12 changes: 6 additions & 6 deletions packages/gocardless/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export async function getBanks(countryCode: string) {
"Content-Type": "application/json",
Authorization: `Bearer ${token}`,
},
},
}
);

return res.json();
Expand Down Expand Up @@ -221,18 +221,18 @@ export async function getAccounts({
bank: banks.find((bank) => bank.id === accountData.institution_id),
balances: {
available: balances.find(
(balance) => balance.balanceType === balanceType.interimAvailable,
(balance) => balance.balanceType === balanceType.interimAvailable
)?.balanceAmount,
boked: balances.find(
(balance) => balance.balanceType === balanceType.interimBooked,
(balance) => balance.balanceType === balanceType.interimBooked
)?.balanceAmount,
},
};
}),
})
);

return result.sort((a, b) =>
a.balances.available - b.balances.available ? 1 : -1,
a.balances.available - b.balances.available ? 1 : -1
);
}

Expand All @@ -247,7 +247,7 @@ export async function getTransactions(accountId: string) {
"Content-Type": "application/json",
Authorization: `Bearer ${token}`,
},
},
}
);

return result.json();
Expand Down
2 changes: 1 addition & 1 deletion packages/kv/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"check:types": "tsc --noEmit"
},
"dependencies": {
"@vercel/kv": "^1.0.0"
"@vercel/kv": "0.2.4"
}
}

18 changes: 9 additions & 9 deletions packages/ui/src/components/dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const DialogOverlay = React.forwardRef<
ref={ref}
className={cn(
"fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
className,
className
)}
{...props}
/>
Expand All @@ -34,15 +34,15 @@ const DialogContent = React.forwardRef<
<DialogOverlay />
<DialogPrimitive.Content
ref={ref}
className="fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[90vw] max-w-xl p-px shadow-lg text-white rounded-lg z-50 "
className="fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[90vw] max-w-xl p-px shadow-lg text-white rounded-2xl z-50 "
style={{
background:
"linear-gradient(-45deg, rgba(235,248,255,.18) 0%, #727d8b 50%, rgba(235,248,255,.18) 100%)",
}}
{...props}
>
<div className="bg-background p-2 rounded-[7px]">{children}</div>
<DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
<div className="bg-background p-2 rounded-[15px]">{children}</div>
<DialogPrimitive.Close className="absolute right-6 top-6 opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
<Cross2Icon className="h-4 w-4" />
<span className="sr-only">Close</span>
</DialogPrimitive.Close>
Expand All @@ -58,7 +58,7 @@ const DialogHeader = ({
<div
className={cn(
"flex flex-col space-y-1.5 text-center sm:text-left",
className,
className
)}
{...props}
/>
Expand All @@ -72,7 +72,7 @@ const DialogFooter = ({
<div
className={cn(
"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
className,
className
)}
{...props}
/>
Expand All @@ -86,8 +86,8 @@ const DialogTitle = React.forwardRef<
<DialogPrimitive.Title
ref={ref}
className={cn(
"text-lg font-semibold leading-none tracking-tight",
className,
"text-lg font-semibold leading-none tracking-tight mb-4",
className
)}
{...props}
/>
Expand All @@ -100,7 +100,7 @@ const DialogDescription = React.forwardRef<
>(({ className, ...props }, ref) => (
<DialogPrimitive.Description
ref={ref}
className={cn("text-sm text-muted-foreground", className)}
className={cn("text-sm text-[#878787]", className)}
{...props}
/>
));
Expand Down

0 comments on commit 12334fd

Please sign in to comment.