Skip to content

Commit

Permalink
Feature: transaction modal implementation (Codehagen#209)
Browse files Browse the repository at this point in the history
* refactor(www): make the add modal button more reusable

* refactor(www): make the modal's footer reusable by moving it to modals folder & not make it specific to add-asset-flow modal

* feat(www): transaction handling modal implementation

* fix(www): use AddButton instead of AddAssetButton

* fix(www): recover TransactionModal component in transactions-dashboard page

* fix(www): fix imports

* fix(www): updates imports in dashboard-1 component

* perform format script on files

* fix: add missing import to fix the lint pipeline

* fix: pass mailId prop as string
  • Loading branch information
ousszizou authored Mar 13, 2024
1 parent 6550a1c commit 4d37ec8
Show file tree
Hide file tree
Showing 13 changed files with 1,021 additions and 30 deletions.
8 changes: 4 additions & 4 deletions apps/www/app/(dashboard)/(workspaceId)/banking/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AddAssetButton } from "@/components/buttons/AddAssetButton";
import { AddButton } from "@/components/buttons/AddButton";
import { AddAssetFlow } from "@/components/modals/add-asset-flow";
import { NavItem } from "@/app/config";
import type { NavItem } from "@/app/config";

import { DashboardShell } from "../../_components/dashboard-shell";

Expand All @@ -23,9 +23,9 @@ export default function WorkspaceLayout(props: {
title="Banking"
description="Projects for this workspace will show up here"
headerAction={
<AddAssetButton triggerLabel="Add Asset">
<AddButton triggerLabel="Add Asset">
<AddAssetFlow />
</AddAssetButton>
</AddButton>
}
>
{props.children}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import {
import { Separator } from "@/components/ui/separator";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
import { TooltipProvider } from "@/components/ui/tooltip";
import { AddButton } from "@/components/buttons/AddButton";
import AddTransactionModal from "@/components/modals/add-transaction";

import { Mail } from "../data";
import { useMail } from "../use-mail";
Expand Down Expand Up @@ -55,20 +57,25 @@ export function TransactionsDashboard({
<Input placeholder="Search" className="pl-8" />
</div>
</form>
<TabsList>
<TabsTrigger
value="all"
className="text-zinc-600 dark:text-zinc-200"
>
All transactions
</TabsTrigger>
<TabsTrigger
value="unread"
className="text-zinc-600 dark:text-zinc-200"
>
Unread
</TabsTrigger>
</TabsList>
<div className="ms-4 flex flex-grow items-center justify-between">
<TabsList>
<TabsTrigger
value="all"
className="text-zinc-600 dark:text-zinc-200"
>
All transactions
</TabsTrigger>
<TabsTrigger
value="unread"
className="text-zinc-600 dark:text-zinc-200"
>
Unread
</TabsTrigger>
</TabsList>
<AddButton triggerLabel="Add Transaction">
<AddTransactionModal />
</AddButton>
</div>
</div>
<Separator />
<TabsContent value="all" className="m-0">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
import { ScrollArea } from "@/components/ui/scroll-area";
import { Separator } from "@/components/ui/separator";
import { TooltipProvider } from "@/components/ui/tooltip";
import { AddAssetButton } from "@/components/buttons/AddAssetButton";
import { AddButton } from "@/components/buttons/AddButton";
import { AddAssetFlow } from "@/components/modals/add-asset-flow";
import { WorkspaceSwitcher } from "@/app/(dashboard)/_components/workspace-switcher";
import { SidebarNav } from "@/app/(dashboard)/(workspaceId)/_components/sidebar-nav";
Expand Down
6 changes: 3 additions & 3 deletions apps/www/app/(dashboard)/(workspaceId)/dashboard/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";

import { AddAssetButton } from "@/components/buttons/AddAssetButton";
import { AddButton } from "@/components/buttons/AddButton";
import { AddAssetFlow } from "@/components/modals/add-asset-flow";

import { DashboardShell } from "../../_components/dashboard-shell";
Expand All @@ -15,9 +15,9 @@ export default function WorkspaceLayout(props: {
title="Dashboard"
description="Projects for this workspace will show up here"
headerAction={
<AddAssetButton triggerLabel="Add Asset">
<AddButton triggerLabel="Add Asset">
<AddAssetFlow />
</AddAssetButton>
</AddButton>
}
>
{props.children}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,23 @@ import { Dialog, DialogContent, DialogTrigger } from "../ui/dialog";
interface FlowModalProps {
triggerLabel: string;
children: ReactNode;
showCloseButton?: boolean;
}

export const AddAssetButton: FC<FlowModalProps> = ({
export const AddButton: FC<FlowModalProps> = ({
triggerLabel,
children,
showCloseButton = true,
}) => {
return (
<Dialog>
<DialogTrigger asChild>
<Button variant="outline">{triggerLabel}</Button>
</DialogTrigger>
<DialogContent className="sm:max-w-[425px]" showCloseButton={false}>
<DialogContent
className="sm:max-w-[425px]"
showCloseButton={showCloseButton}
>
{children}
</DialogContent>
</Dialog>
Expand Down
Loading

0 comments on commit 4d37ec8

Please sign in to comment.